【发布时间】:2020-11-15 12:12:09
【问题描述】:
当我在 Scala 中运行这个 Spark 代码时:
df.withColumn(x, when(col(x).isin(values:_*),col(x)).otherwise(lit(null).cast(StringType)))
我遇到了这个错误:
java.lang.RuntimeException: Compiling "GeneratedClass": Code of method
"apply(Lorg/apache/spark/sql/catalyst/InternalRow;)Lorg/apache/spark/sql
/catalyst /expressions/UnsafeRow;" of class
"org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificUnsafeProjection"
grows beyond 64 KB
at org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:361)
at org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:234)
df:Spark 数据集
x:StringType 列,每一行类似于“US,Washington,Seattle”
值:数组[字符串]
【问题讨论】:
-
当您的代码太长而没有任何操作时,可能会发生这种情况。您应该在某个时候缓存您的数据框。
标签: scala apache-spark compiler-errors apache-spark-sql