warning: non-variable type argument Int in type pattern scala.collection.mutable.WrappedArray[Int] is unchecked since it is eliminated by erasure
问题:
scala> indexes.rdd.foreach{
| case Row(wa: WrappedArray[Int]) =>
| println(vocab(wa(0))+"--"+vocab(wa(1))+"--"+vocab(wa(2)))
| }
<console>:64: warning: non-variable type argument Int in type pattern scala.collection.mutable.WrappedArray[Int] is unchecked since it is eliminated by erasure
case Row(wa: WrappedArray[Int]) =>
^
解决:
1.导包
scala> import scala.reflect.runtime.universe._
2.增加 @unchecked
indexes.rdd.foreach{
case Row(wa: WrappedArray[Int] @unchecked) =>
println(vocab(wa(0))+"--"+vocab(wa(1))+"--"+vocab(wa(2)))
}
或者
val aa = indexes.rdd.map{ case Row(wa: WrappedArray[Int] @unchecked) =>
(vocab(wa(0)), vocab(wa(1)), vocab(wa(2)))
}
aa.collect().take(1).foreach(println)