PySpark python problema: Py4JJavaError: si è verificato Un errore durante la chiamata o48.showString

ciao a tutti sto lavorando su PySpark Python e ho citato il codice e ottenere qualche problema, mi chiedo se qualcuno conosce il problema?

windowSpec = Window.partitionBy(df_Broadcast['id']).orderBy(df_Broadcast['id'])
windowSpec

IdShift = lag(df_Broadcast["id"]).over(windowSpec).alias('IdShift')

df_Broadcast = df_Broadcast.withColumn('CheckId', df_Broadcast[idI'] != IdShift)

df_Broadcast.show()

Questo è il mio pezzo di Codice e tornerà il bool valori true false, quando è stata l’esecuzione di questo codice funziona bene, ma dopo il riavvio il kernal, questo è quello che sto ricevendo un errore.

---------------------------------------------------------------------------
Py4JJavaError                             Traceback (most recent call last)
<ipython-input-11-2d28913c9e2c> in <module>()
----> 1 df_Broadcast.show()

~/anaconda3/lib/python3.6/site-packages/pyspark/sql/dataframe.py in show(self, n, truncate)
    334         """
    335         if isinstance(truncate, bool) and truncate:
--> 336             print(self._jdf.showString(n, 20))
    337         else:
    338             print(self._jdf.showString(n, int(truncate)))

~/anaconda3/lib/python3.6/site-packages/py4j/java_gateway.py in __call__(self, *args)
   1131         answer = self.gateway_client.send_command(command)
   1132         return_value = get_return_value(
-> 1133             answer, self.gateway_client, self.target_id, self.name)
   1134 
   1135         for temp_arg in temp_args:

~/anaconda3/lib/python3.6/site-packages/pyspark/sql/utils.py in deco(*a, **kw)
     61     def deco(*a, **kw):
     62         try:
---> 63             return f(*a, **kw)
     64         except py4j.protocol.Py4JJavaError as e:
     65             s = e.java_exception.toString()

~/anaconda3/lib/python3.6/site-packages/py4j/protocol.py in get_return_value(answer, gateway_client, target_id, name)
    317                 raise Py4JJavaError(
    318                     "An error occurred while calling {0}{1}{2}.\n".
--> 319                     format(target_id, ".", name), value)
    320             else:
    321                 raise Py4JError(

Py4JJavaError: An error occurred while calling o48.showString.
: org.apache.spark.SparkException: Job aborted due to stage failure: Task 18 in stage 5.0 failed 1 times, most recent failure: Lost task 18.0 in stage 5.0 (TID 116, localhost, executor driver): java.lang.OutOfMemoryError: Java heap space

Driver stacktrace:
    at org.apache.spark.scheduler.DAGScheduler.org$apache$spark$scheduler$DAGScheduler$$failJobAndIndependentStages(DAGScheduler.scala:1499)
    at org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1487)
    at org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1486)
    at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
    at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
    at org.apache.spark.scheduler.DAGScheduler.abortStage(DAGScheduler.scala:1486)
    at org.apache.spark.scheduler.DAGScheduler$$anonfun$handleTaskSetFailed$1.apply(DAGScheduler.scala:814)
    at org.apache.spark.scheduler.DAGScheduler$$anonfun$handleTaskSetFailed$1.apply(DAGScheduler.scala:814)
    at scala.Option.foreach(Option.scala:257)
    at org.apache.spark.scheduler.DAGScheduler.handleTaskSetFailed(DAGScheduler.scala:814)
    at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.doOnReceive(DAGScheduler.scala:1714)
    at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.onReceive(DAGScheduler.scala:1669)
    at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.onReceive(DAGScheduler.scala:1658)
    at org.apache.spark.util.EventLoop$$anon$1.run(EventLoop.scala:48)
    at org.apache.spark.scheduler.DAGScheduler.runJob(DAGScheduler.scala:630)
    at org.apache.spark.SparkContext.runJob(SparkContext.scala:2022)
    at org.apache.spark.SparkContext.runJob(SparkContext.scala:2043)
    at org.apache.spark.SparkContext.runJob(SparkContext.scala:2062)
    at org.apache.spark.sql.execution.SparkPlan.executeTake(SparkPlan.scala:336)
    at org.apache.spark.sql.execution.CollectLimitExec.executeCollect(limit.scala:38)
    at org.apache.spark.sql.Dataset.org$apache$spark$sql$Dataset$$collectFromPlan(Dataset.scala:2853)
    at org.apache.spark.sql.Dataset$$anonfun$head$1.apply(Dataset.scala:2153)
    at org.apache.spark.sql.Dataset$$anonfun$head$1.apply(Dataset.scala:2153)
    at org.apache.spark.sql.Dataset$$anonfun$55.apply(Dataset.scala:2837)
    at org.apache.spark.sql.execution.SQLExecution$.withNewExecutionId(SQLExecution.scala:65)
    at org.apache.spark.sql.Dataset.withAction(Dataset.scala:2836)
    at org.apache.spark.sql.Dataset.head(Dataset.scala:2153)
    at org.apache.spark.sql.Dataset.take(Dataset.scala:2366)
    at org.apache.spark.sql.Dataset.showString(Dataset.scala:245)
    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:280)
    at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
    at py4j.commands.CallCommand.execute(CallCommand.java:79)
    at py4j.GatewayConnection.run(GatewayConnection.java:214)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.OutOfMemoryError: Java heap space
InformationsquelleAutor id101112 | 2017-12-11



2 Replies
  1. 11

    L’errore è

    Causati da: java.lang.OutOfMemoryError: Java heap space

    Avete bisogno di più memoria per eseguire le operazioni ed evitare il OOM errore.

  2. 0

    Questo problema è becus di versione di JAVA. Ho avuto scintilla 2.3.3 e JAVA 11. Ho rimosso JAVA 11 e installare JAVA8.

    Il problema è stato risolto ..

    *********@*********-VirtualBox:/opt/java$ sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/jdk1.8.0_202/"
    update-alternatives: --install needs <link> <name> <path> <priority>
    
    Use 'update-alternatives --help' for program usage information.
    *********@*********-VirtualBox:/opt/java$ sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/jdk1.8.0_202/" 1
    update-alternatives: using /opt/java/jdk1.8.0_202/ to provide /usr/bin/java (java) in auto mode
    *********@*********-VirtualBox:/opt/java$ sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/jdk1.8.0_202/bin/java" 1
    *********@*********-VirtualBox:/opt/java$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/java/jdk1.8.0_202/bin/javac" 1 
    update-alternatives: using /opt/java/jdk1.8.0_202/bin/javac to provide /usr/bin/javac (javac) in auto mode
    *********@*********-VirtualBox:/opt/java$ java -version
    
    Command 'java' not found, but can be installed with:
    
    sudo apt install default-jre            
    sudo apt install openjdk-11-jre-headless
    sudo apt install openjdk-8-jre-headless 
    
    *********@*********-VirtualBox:/opt/java$ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/opt/java/jdk1.8.0_202/bin/javaws" 1
    update-alternatives: using /opt/java/jdk1.8.0_202/bin/javaws to provide /usr/bin/javaws (javaws) in auto mode
    *********@*********-VirtualBox:/opt/java$ sudo update-alternatives --install "/usr/bin/jar" "jar" "/opt/java/jdk1.8.0_202/bin/jar" 1
    update-alternatives: using /opt/java/jdk1.8.0_202/bin/jar to provide /usr/bin/jar (jar) in auto mode
    *********@*********-VirtualBox:/opt/java$ sudo update-alternatives --set "java" "/opt/java/jdk1.8.0_202/bin/java"
    update-alternatives: using /opt/java/jdk1.8.0_202/bin/java to provide /usr/bin/java (java) in manual mode
    *********@*********-VirtualBox:/opt/java$ sudo update-alternatives --set "javac" "/opt/java/jdk1.8.0_202/bin/javac" 
    *********@*********-VirtualBox:/opt/java$ sudo update-alternatives --set "javaws" "/opt/java/jdk1.8.0_202/bin/javaws"
    *********@*********-VirtualBox:/opt/java$ sudo update-alternatives --set "jar" "/opt/java/jdk1.8.0_202/bin/jar"
    *********@*********-VirtualBox:/opt/java$ cd
    *********@*********-VirtualBox:~$ java -version
    java version "1.8.0_202"
    Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
    Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)

Lascia un commento