加入横向视图爆炸Spark1 vs Spark2

时间:2019-04-23 16:41:33

标签: apache-spark hadoop apache-spark-sql explode lateral-join

如果我在spark 1.6中运行以下命令,则工作正常,但在spark 2.2中,出现以下错误。有人知道为什么以及如何修复语法吗?

sqlContext.sql("SELECT a.* FROM table1 a Lateral View explode(attributes) attributes_table as attributesfull inner join table2 c ON a.iID = c.iID")

org.apache.spark.sql.catalyst.parser.ParseException:
mismatched input 'inner' expecting {<EOF>, ',', 'WHERE', 'GROUP', 'ORDER', 'HAVING', 'LIMIT', 'LATERAL', 'WINDOW', 'UNION', 'EXCEPT', 'MINUS', 'INTERSECT', 'SORT', 'CLUSTER', 'DISTRIBUTE'}(line 1, pos 92)

== SQL ==
SELECT a.* FROM table1 a Lateral View explode(attributes) attributes_table as attributesfull inner join table2 c ON a.iID = c.iID
---------------------------------------------------------------------------------------------^^^

  at org.apache.spark.sql.catalyst.parser.ParseException.withCommand(ParseDriver.scala:217)
  at org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parse(ParseDriver.scala:114)
  at org.apache.spark.sql.execution.SparkSqlParser.parse(SparkSqlParser.scala:48)
  at org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parsePlan(ParseDriver.scala:68)
  at org.apache.spark.sql.SparkSession.sql(SparkSession.scala:637)
  at org.apache.spark.sql.SQLContext.sql(SQLContext.scala:691)
  ... 50 elided

我想我可以通过使用仅用于爆炸值的表并加入该表来解决它,但想知道为什么它不再起作用或有更好的主意。

0 个答案:

没有答案