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, 답변을 업데이트했습니다. 이전 하나는 약간 장황했다. –
WrappedArray에 문제가있어서 Seq [Int]로 바꿀 수있었습니다. – jspooner