我在试着做点什么
我试图将xml读入一个Dataframe,并尝试使用explode将数据展平,如下所示。
val df=spark.read.format(“xml”).option(“rowtag”,“on”).option(“inferschema”,“true”).load(“filepath”)val parsxml=df.withcolumn(“exploded\u element”,exploded((“prgsvc.element”))。
我得到下面的错误。
command-5246708674960:4: error: type mismatch;
found : String("prgSvc.element")
required: org.apache.spark.sql.Column
.withColumn("exploded_element", explode(("prgSvc.element")))**
Before reading the XML into the data frame, I also tried to manually assign a custom schema and read the XML file. But the output is all NULL. Could you please let me know if my approach is valid and how to resolve this issue and achieve the output.
Thank you.
1条答案
按热度按时间l7mqbcuq1#
用这个