Spark:使用基础类型的dataFrame

时间:2017-04-27 12:53:24

标签: scala apache-spark

我正在这样创建一个数据帧:

DF: DataFrame = df.sqlContext.createDataFrame(myTypeRDD, getMyTypeSchema())

MyType是一种复杂的数据类型。

出于测试目的,我想将其用作MyType集合。

我的尝试:

  1. 尝试强制转换dataFrame:
  2. DF.as[MyType]& DF.map(row => row.asInstanceOf[MyType]给了:

      

    找不到org.joda.time.DateTime

    的编码器
    1. 收集后试图施放:
    2. DF.collect().asInstanceOf[MyType]给了:

        

      org.apache.spark.sql.catalyst.expressions.GenericRowWithSchema无法转换为MyType

      任何建议都将不胜感激

0 个答案:

没有答案