I have loaded multiple parquet files to create multiple DFs, but when I am using for loop, I am getting errors.
Markdown and HTML are turned off in code blocks:
val sqlContext = new org.apache.spark.sql.SQLContext(sc)
val url_1 = "s3://file_path/folder1.parquet/*"
val url_2 = "s3://file_path/folder2.parquet/*"
val url_3 = "s3://file_path/folder3.parquet/*"
for (url <- Array(url_1 ,url_2 ,url_3)) var parqfile=sqlContext.read.load(url)
for (item <- Array("tb1","tb2","tb3")) parqfile.registerTempTable(item)
但我不能这样做,因为它说我有:1:错误:简单表达式的非法开始
请帮忙。。。谢谢!
1条答案
按热度按时间vvppvyoh1#
正确的方法是Spark2.x而不是1.6,但同样的原则也适用。更简单,使用df作为源。注意{}。