spark3 crashes with py4j.protocol.Py4JJavaError

992 views Asked by At

I'm trying to migrate from emr-5.28.0(spark 2.4.4) to emr-6.2.0(spark 3.0.1), and the most basic usage of spark crashes no matter what I do.

This my test_pyspark.py file:

from pyspark.sql import SparkSession

spark = SparkSession.builder.getOrCreate()

df = spark.createDataFrame(
    [
        (1, "foo"),  # create your data here, be consistent in the types.
        (2, "bar"),
    ],
    ["id", "label"]  # add your column names here
)

df.printSchema()

I upload it to S3 and use

spark-submit --deploy-mode cluster s3://<my-s3-bucket>/test_pyspark.py

And it crashes.

This is the container log :

Traceback (most recent call last):
  File "test_pyspark.py", line 10, in <module>
    ["id", "label"]  # add your column names here
  File "/mnt/yarn/usercache/hadoop/appcache/application_1618321478998_0009/container_1618321478998_0009_02_000001/pyspark.zip/pyspark/sql/session.py", line 602, in createDataFrame
  File "/mnt/yarn/usercache/hadoop/appcache/application_1618321478998_0009/container_1618321478998_0009_02_000001/pyspark.zip/pyspark/sql/session.py", line 629, in _create_dataframe
  File "/mnt/yarn/usercache/hadoop/appcache/application_1618321478998_0009/container_1618321478998_0009_02_000001/py4j-0.10.9-src.zip/py4j/java_gateway.py", line 1305, in __call__
  File "/mnt/yarn/usercache/hadoop/appcache/application_1618321478998_0009/container_1618321478998_0009_02_000001/pyspark.zip/pyspark/sql/utils.py", line 131, in deco
  File "/mnt/yarn/usercache/hadoop/appcache/application_1618321478998_0009/container_1618321478998_0009_02_000001/py4j-0.10.9-src.zip/py4j/protocol.py", line 328, in get_return_value
py4j.protocol.Py4JJavaError: An error occurred while calling o64.applySchemaToPythonRDD.
: java.lang.VerifyError: class org.apache.spark.sql.catalyst.plans.logical.UpdateAction overrides final method children.()Lscala/collection/Seq;
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    at org.apache.spark.sql.execution.SparkSqlParser.<init>(SparkSqlParser.scala:43)
    at org.apache.spark.sql.internal.BaseSessionStateBuilder.sqlParser$lzycompute(BaseSessionStateBuilder.scala:129)
    at org.apache.spark.sql.internal.BaseSessionStateBuilder.sqlParser(BaseSessionStateBuilder.scala:128)
    at org.apache.spark.sql.internal.BaseSessionStateBuilder.build(BaseSessionStateBuilder.scala:329)
    at org.apache.spark.sql.SparkSession$.org$apache$spark$sql$SparkSession$$instantiateSessionState(SparkSession.scala:1107)
    at org.apache.spark.sql.SparkSession.$anonfun$sessionState$2(SparkSession.scala:157)
    at scala.Option.getOrElse(Option.scala:189)
    at org.apache.spark.sql.SparkSession.sessionState$lzycompute(SparkSession.scala:155)
    at org.apache.spark.sql.SparkSession.sessionState(SparkSession.scala:152)
    at org.apache.spark.sql.Dataset$.$anonfun$ofRows$1(Dataset.scala:91)
    at org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:763)
    at org.apache.spark.sql.Dataset$.ofRows(Dataset.scala:90)
    at org.apache.spark.sql.SparkSession.internalCreateDataFrame(SparkSession.scala:553)
    at org.apache.spark.sql.SparkSession.applySchemaToPythonRDD(SparkSession.scala:740)
    at org.apache.spark.sql.SparkSession.applySchemaToPythonRDD(SparkSession.scala:725)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
    at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
    at py4j.Gateway.invoke(Gateway.java:282)
    at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
    at py4j.commands.CallCommand.execute(CallCommand.java:79)
    at py4j.GatewayConnection.run(GatewayConnection.java:238)
    at java.lang.Thread.run(Thread.java:748)

Couldn't find anything about

class org.apache.spark.sql.catalyst.plans.logical.UpdateAction overrides final method children

So any help would be very appreciated.

1

There are 1 answers

0
Ben Siman On

Turns out we had an old version of DeltaLake-core jar that was causing the problem.

Thanks @stevel, your comment really pointed me to the right direction