Home > other >  The spark program execution
The spark program execution

Time:10-10

 val sgyRDD: RDD. [(Text, BytesWritable)]=sc newAPIHadoopFile (filePath, classOf [SecondInputFormat], 
ClassOf [Text], classOf [BytesWritable])
Var resBody=ArrayBuffer [SegyResult] ()
Var count=0
Val newRdd=sgyRDD. Coalesce (10)
NewRdd. Foreach {x=& gt;
Val bytes: Array (Byte)=x. _2. GetBytes
Val allBody=bytes. SplitAt (240)

Val header=allBody. _1
Bean240=dealBinaryStruct (header)


Val bodyByte: Array (Byte)=allBody. _2

Val doubleData: Array. [Double]=SgyUtil readDataInIBMFormat (bodyByte, beanHead. GetHns)
Val segyResult: segyResult=new segyResult ()
SegyResult. SetData (doubleData)
SegyResult. SetCdp (bean240 getCdp ())
SegyResult. SetInLine (bean240 getEp ())
SegyResult. SetHdt (beanHead. GetHdt ())
SegyResult. SetLabel (bean240 getLabel ())
SegyResult. SetPh (bean240 getFldr ())
SegyResult. SetDh (bean240 getTracf ())
ResBody +=segyResult
}
Println (" SSSSSSSS "+ resBody. ToArray. Length)



Why this code at the end of the resBody this array is empty
  • Related