Guest User

Untitled

a guest
Mar 25th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. sqlContext.createDataFrame(
  2. inputLines.map( rowValues =>
  3. RowFactory.create(rowValues.zip(schema.toSeq)
  4. .map{ case (value, struct) =>
  5. struct.dataType match {
  6. case BinaryType => value.toCharArray().map(ch => ch.toByte)
  7. case ByteType => value.toByte
  8. case BooleanType => value.toBoolean
  9. case DoubleType => value.toDouble
  10. case FloatType => value.toFloat
  11. case ShortType => value.toShort
  12. case DateType => value
  13. case IntegerType => value.toInt
  14. case LongType => value.toLong
  15. case _ => value
  16. }
  17. })), schema)
  18.  
  19. java.lang.RuntimeException: Failed to convert value [Ljava.lang.Object;@6e9ffad1 (class of class [Ljava.lang.Object;}) with the type of IntegerType to JSON
Advertisement
Add Comment
Please, Sign In to add comment