我正在使用spark 2.3.1,但收到一个奇怪的错误,我找不到任何信息,也无法确定其来源。
不幸的是,我无法发布整个代码,因为它很多。但是我进行了一长串的DataFrame转换,并在df.as[CaseClass]
末尾转换为DataSet,然后尝试对DataSet调用操作并收到以下信息:
java.lang.UnsupportedOperationException: Only code-generated evaluation is supported
如果在将数据类型转换为DataSet之前手动将模式应用于DataFrame(通过转换为rdd并使用sqlContext.createDataFrame),一切都还好,但这是相当昂贵的计算步骤,因此我想跳过它,首先我会想找出问题的根本原因。
有人遇到过这个问题吗?这是堆栈跟踪的(可能)相关部分:
Only code-generated evaluation is supported
java.lang.UnsupportedOperationException: Only code-generated evaluation is supported
at org.apache.spark.sql.catalyst.expressions.objects.WrapOption.eval(objects.scala:419)
at org.apache.spark.sql.catalyst.optimizer.ConstantFolding$$anonfun$apply$1$$anonfun$applyOrElse$1.applyOrElse(expressions.scala:53)
at org.apache.spark.sql.catalyst.optimizer.ConstantFolding$$anonfun$apply$1$$anonfun$applyOrElse$1.applyOrElse(expressions.scala:46)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$2.apply(TreeNode.scala:267)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$2.apply(TreeNode.scala:267)
at org.apache.spark.sql.catalyst.trees.CurrentOrigin$.withOrigin(TreeNode.scala:70)
at org.apache.spark.sql.catalyst.trees.TreeNode.transformDown(TreeNode.scala:266)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$transformDown$1.apply(TreeNode.scala:272)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$transformDown$1.apply(TreeNode.scala:272)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$4$$anonfun$apply$11.apply(TreeNode.scala:335)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
at scala.collection.immutable.List.foreach(List.scala:392)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
at scala.collection.immutable.List.map(List.scala:296)