Converting JavaRDD to DataFrame in Spark java

后端 未结 4 794
暗喜
暗喜 2020-12-19 01:27

I am trying to process the LogFile. first i read the log file and split these file as per my requirement and saved each column into separate JavaRDD. Now i need to convert t

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-19 02:14

    You can directly read the file using sqlContext directly

    Use read method of sqlContext

    For more info you can follow this link

    https://spark.apache.org/docs/1.6.0/sql-programming-guide.html#creating-dataframes

    Or you can import the

    import sqlContext.implicits.*;
    

    Then use toDF() method on rdd to convert into dataframe.

提交回复
热议问题