该错误是由于以下事实引起的:
textFilefrom中的方法
SparkContext返回,
RDD而我需要的是
Dataframe。
SparkSession有一个内幕
SQLContext。因此,我需要先使用
DataframeReader来正确读取CSV文件,然后再将其转换为镶木地板文件。
spark = SparkSession .builder .appName("Protob Conversion to Parquet") .config("spark.some.config.option", "some-value") .getOrCreate()# read csvdf = spark.read.csv("/temp/proto_temp.csv")# Displays the content of the Dataframe to stdoutdf.show()df.write.parquet("output/proto.parquet")


