0
(使用Apache火花版本1.6) 我提到以下链接尝试unpivot的特点: unpivot in spark-sql/pyspark栈()的火花SQL - 运行时异常
这里的问题在执行时,我得到了一些运行时异常:
df.select($"A", expr("stack(2, 'large', large, 'small', small) as (c, d)")).where("c is not null or b is not null")
例外:
User class threw exception: java.lang.Exception: Application failed with 1 errors: Action UnPivot3: java.lang.RuntimeException: [1.10] failure: identifier expected
stack(2, 'large', large,'small', small) as (c, d)
^
at scala.sys.package$.error(package.scala:27)
at org.apache.spark.sql.catalyst.SqlParser$.parseExpression(SqlParser.scala:49)
at org.apache.spark.sql.functions$.expr(functions.scala:1076)
1)不知道如何解决这个问题? 2)任何有关stack()的文档帮助都会很棒。
是否有任何替代在1.6中实现相同的功能?我不能改变在服务器上部署的spark版本。 – Shabeel
@Shabeel我不这么认为,但它是没有问题的范围;)你可以尝试爆炸函数 –