以下代码已经过验证,可以正常工作:即将元组添加到现有序列(也是元组)
iter.map { r => // Iterator of org.apache.spark.sql.Row r.toSeq :+ (outColName,locMap(r.getAs[String](inColName))) }
但是,我们的构建系统已fail on warning
启用并因此错误地输出上述代码:
[info] 'compiler-interface' not yet compiled for Scala 2.10.6. Compiling... [info] Compilation completed in 24.504 s [error] /home/../Sampling.scala:40: Adapting argument list by creating a 2-tuple: this may not be what you want. [error] signature: SeqLike.:+[B >: A, That](elem: B)(implicit bf: scala.collection.generic.CanBuildFrom[Repr,B,That]): That [error] given arguments: outColName, locMap(r.getAs[String](inColName)) [error] after adaptation: SeqLike.:+((outColName, locMap(r.getAs[String](inColName))): (String, Int)) [error] r.toSeq :+ (outColName,locMap(r.getAs[String](inColName))) [error] ^ [error] one error found
现在 - 如上所述 - 这就是我想要的.但Travis
需要变得快乐.那么正确的调用是什么来表示相同的 - 这是期望的行为 - 并避免这里的警告?