2
当我试图通过RDD转换的火花,数据帧和我得到以下异常“无法推断架构类型:”无法推断架构类型:<类型“的unicode”>转换时RDD到数据帧
例如:
>> rangeRDD.take(1).foreach(println)
(301,301,10)
>> sqlContext.inferSchema(rangeRDD)
Can not infer schema for type: <type 'unicode'>
任何指针如何解决它?我甚至尝试注入架构自己在sqlContext.createDataFrame(RDD,架构)
schema = StructType([
StructField("x", IntegerType(), True),
StructField("y", IntegerType(), True),
StructField("z", IntegerType(), True)])
df = sqlContext.createDataFrame(rangeRDD, schema)
print df.first()
但在运行时错误结束了 'ValueError异常:意外的元组U'(301,301,10) '与StructType'