The following code has already been verified as working as I want it: i.e. adding a tuple to an existing sequence (also of tuples)
iter.map { r => // Iterator of org.apache.spark.sql.Row
r.toSeq :+ (outColName,locMap(r.getAs[String](inColName)))
}
However our build system has fail on warning
enabled and thus errors out the above code with:
[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
Now - as mentioned - this is what I want. But Travis
needs to be made happy. So what is the correct invocation to signfify the same -i.e. this is the desired behavior - and avoid the warnings here?
Try to help the compiler by explicitly adding the method invocation and the parenthesis.
iter.map { r: Row =>
r.toSeq.:+( (outColName,locMap(r.getAs[String](inColName))):Any )
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With