云計算-cloud如選擇投影求交集、并集連接成組聚合_第1頁
云計算-cloud如選擇投影求交集、并集連接成組聚合_第2頁
云計算-cloud如選擇投影求交集、并集連接成組聚合_第3頁
云計算-cloud如選擇投影求交集、并集連接成組聚合_第4頁
云計算-cloud如選擇投影求交集、并集連接成組聚合_第5頁
免費預覽已結束,剩余21頁可下載查看

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

副研究員博士 4如:選擇,投影,求交集、并集,連接,成組,聚合5討 one:doc1doc3fish:one:doc1doc3fish:doc1,doc2two:doc1red:doc2,doc3blue:doc2bird:doc3onefishtwooneonered bluefish→doc1,doc2red→doc2,doc3redfish→doc2importimportimportimportpublicclassInvertedIndexMapperextendsMapper<Text,Text,Text, //defaultRecordReader:LineRecordReader;key:lineoffset;value:line FileSplitfileSplit=(FileSplit)context.getInputSplit();StringfileName=fileSplit.getPath().getName();Textword=newText();TextfileName_lineOffset=newfor(;itr.hasMoreTokens();) }}}importjava.io.IOException;importjava.util.Collections;importjava.util.Iterator;importimport throwsIOException, Iterator<Text>it=values.iterator();StringBuilderall=newStringBuilder();for(;it.hasNext();) }}publicclass{publicstaticvoidmain(String[]{tryConfigurationconf=newjob=newJob(conf,"invertFileInputFormat.addInputPath(job,newFileOutputFormat.setOutputPath(job,new pletion(true)?0:}catch(Exceptione) }}11一個倒排索引由大量的postingslist一個postingslist由多個posting構成(按docid排序一個postingslist與一個term一個posting包含一 id和一個 中出現情況相關的信息(e.g.termfrequency,positions,termproperties)同時還有對應Web文檔到其URL的映射111:class procedureMap(docidn,docd) H←newAssociativeArray foralltermt∈docddo H{t}←H{t}+ foralltermt∈H Emit(termt,posting<n,H{t}>)1:classReducer procedureReduce(termt,postings[<n1,f1>,<n2, P←new forallposting<a,f>∈postings[<n1,f1>,<n2,f2>…] Append(P,<a,f>) Emit(termt;postings11文檔倒排索引1文檔倒排索引進入reduce的鍵值對按照(termdocid)進入reduce的鍵值對按照(termdocid)Customized1帶詞頻等屬性的文檔倒排算法(改進Class rtitionerextends// //overridethegetPartition(Kkey,Vvalue,int term=key.toString().split(“,”)[0];//<term,super.getPartition(term,value,}}SetthecustomizedpartitionerinjobJob. 2DistributedData10MB?10GB?2SortAlgorithminmap(k1,*)->(k1, //Identity(1)total-order(2)localreduce(k1,*)->(k1, //IdentityAcustomizedtotal-orderrecallthatshufflephaseneedsaPartitionertopartitionthekeythatdependsonyourdata22(1)如何避免在某些Reducer 過多的數據而拖慢了整個程(2)當有大量的key要分配到多個partition(也就是Reducer)時,如何高效地找到每Key的分布預讀一小部分數據采樣對采樣數據排序后均分,假設有N個reducer,則取得N-1個分割usesasortedlistofN-1sampledkeysthatdefinethekeyrangeforeachInparticular,allkeyssuchthatsample[i-1]<=key<sample[i]aresenttoreducei.guaranteesthattheoutputofreduceiarealllessthantheoutputofreduce設reduce數目為3,采到9取兩個分割點60,68;劃分區間為:[*,60),[60,68),3M.R.Algorithm(“pairs”approach)pseudo-1:class2:methodMap(docida,doc foralltermw∈docd foralltermu∈Neighbors(w) //Emitcountforeachco-occurrenceEmit(pair(w,u),count1)1:class2:methodReduce(pairp;counts[c1, s← forallcountc2counts[c1,c2,…] s←s+ //Sumco-occurrence Emit(pairp,count3構建單詞同現矩陣-wearenotwewanttobutatwearenotweusedto同現定義wordsthatco-occurwithwwithina2-word3構建單詞同現矩陣把小的鍵值對合并成大的鍵值通常一個計算問題會產生大量的鍵值對,為了減少鍵值對傳輸和排序的開銷,一些題中的大量小的鍵值對可以被合并成一些大的鍵值對(pair

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論