6
私は次の操作を実行します。scala wrappedArrayを反復処理する方法は? (スパーク)
val tempDict = sqlContext.sql("select words.pName_token,collect_set(words.pID) as docids
from words
group by words.pName_token").toDF()
val wordDocs = tempDict.filter(newDict("pName_token")===word)
val listDocs = wordDocs.map(t => t(1)).collect()
listDocs: Array
[Any] = Array(WrappedArray(123, 234, 205876618, 456))
私の質問は、私はこのラップ配列の反復処理や、これはリストに変換します方法です。私はlistDocsのために取得するオプションがあります:apply
asInstanceOf
clone
isInstanceOf
length
toString
update
はどのように進むのか?
基本的に私にイテレータを与えます。 – boY
ありがとう@boY、私は答えを更新しました。前の1つは少し冗長でした。 –
私はWrappedArrayに問題があり、Seq [Int]に置き換えることができました。 – jspooner