· 6 years ago · Aug 05, 2019, 09:52 PM
1#Create my table
2spark.sql("create external table if not exists table1 ( c0 string, c1 string, c2 string) STORED AS parquet LOCATION 'hdfs://hadoop_data/hive/table1'")
3
4hdfs="hdfs://hadoop_data/hive/table1/output.parquet"
5
6#Read my data file
7e=spark.read.text("/home/path/sample_txt_files/sample5.txt")
8
9#Write it to hdfs table as a parquet file
10e.write.parquet("hdfs")
11
12ID,Name,Age
131,James,15