Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sqlContext.createDataFrame(
- inputLines.map( rowValues =>
- RowFactory.create(rowValues.zip(schema.toSeq)
- .map{ case (value, struct) =>
- struct.dataType match {
- case BinaryType => value.toCharArray().map(ch => ch.toByte)
- case ByteType => value.toByte
- case BooleanType => value.toBoolean
- case DoubleType => value.toDouble
- case FloatType => value.toFloat
- case ShortType => value.toShort
- case DateType => value
- case IntegerType => value.toInt
- case LongType => value.toLong
- case _ => value
- }
- })), schema)
- 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