2
我在含有COLUMNNAMES我HDFS一个配置文件从JSON文件选择火花阶读取配置文件
JSON
{
a:string
b:int
c struct
{
id: string
count : integer
}
}
Config.txt
"a","b","c.id"
的架构在代码
val df = sqlcontext.read.json("jsonfile"
val config_file = "Config.txt"
val config = scala.io.Source.fromFile(config_file).mkString
val df_contents=df.selectExpr(config)
df_contents.printSchema()
df_cust_att_contents.show()
我在df.selectExpr(config)中出现错误。它不被承认。它的投掷错误。如何将列名从配置文件传递给selectExpr。请帮忙
嗨Gaweda,其现在的工作,非常感谢。保持摇摆人! – gayathri
@gayathri所以请接受它并投票表决:) –
是的,我已经投了票 – gayathri