gpt4 book ai didi

python - 使用 toPandas() 和 databricks 连接时遇到 'java.lang.OutOfMemoryError: Java heap space'

转载 作者:行者123 更新时间:2023-12-04 11:44:57 24 4
gpt4 key购买 nike

我正在尝试将大小为 [2734984 行 x 11 列] 的 pyspark 数据帧转换为调用 toPandas() 的 Pandas 数据帧。虽然在使用 Azure Databricks Notebook 时它完全正常工作(11 秒),但当我使用 databricks-connect(db-connect 版本和 Databricks 运行时版本匹配并且都是 7.1)运行完全相同的代码时,我遇到了 java.lang.OutOfMemoryError: Java heap space 异常。
我已经增加了 spark 驱动程序内存 (100g) 和 maxResultSize (15g)。我想错误出在 databricks-connect 的某个地方,因为我无法使用 Notebooks 复制它。
任何提示这里发生了什么?
错误如下:

Exception in thread "serve-Arrow" java.lang.OutOfMemoryError: Java heap space
at com.ning.compress.lzf.ChunkDecoder.decode(ChunkDecoder.java:51)
at com.ning.compress.lzf.LZFDecoder.decode(LZFDecoder.java:102)
at com.databricks.service.SparkServiceRPCClient.executeRPC0(SparkServiceRPCClient.scala:84)
at com.databricks.service.SparkServiceRemoteFuncRunner.withRpcRetries(SparkServiceRemoteFuncRunner.scala:234)
at com.databricks.service.SparkServiceRemoteFuncRunner.executeRPC(SparkServiceRemoteFuncRunner.scala:156)
at com.databricks.service.SparkServiceRemoteFuncRunner.executeRPCHandleCancels(SparkServiceRemoteFuncRunner.scala:287)
at com.databricks.service.SparkServiceRemoteFuncRunner.$anonfun$execute0$1(SparkServiceRemoteFuncRunner.scala:118)
at com.databricks.service.SparkServiceRemoteFuncRunner$$Lambda$934/2145652039.apply(Unknown Source)
at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
at com.databricks.service.SparkServiceRemoteFuncRunner.withRetry(SparkServiceRemoteFuncRunner.scala:135)
at com.databricks.service.SparkServiceRemoteFuncRunner.execute0(SparkServiceRemoteFuncRunner.scala:113)
at com.databricks.service.SparkServiceRemoteFuncRunner.$anonfun$execute$1(SparkServiceRemoteFuncRunner.scala:86)
at com.databricks.service.SparkServiceRemoteFuncRunner$$Lambda$1031/465320026.apply(Unknown Source)
at com.databricks.spark.util.Log4jUsageLogger.recordOperation(UsageLogger.scala:210)
at com.databricks.spark.util.UsageLogging.recordOperation(UsageLogger.scala:346)
at com.databricks.spark.util.UsageLogging.recordOperation$(UsageLogger.scala:325)
at com.databricks.service.SparkServiceRPCClientStub.recordOperation(SparkServiceRPCClientStub.scala:61)
at com.databricks.service.SparkServiceRemoteFuncRunner.execute(SparkServiceRemoteFuncRunner.scala:78)
at com.databricks.service.SparkServiceRemoteFuncRunner.execute$(SparkServiceRemoteFuncRunner.scala:67)
at com.databricks.service.SparkServiceRPCClientStub.execute(SparkServiceRPCClientStub.scala:61)
at com.databricks.service.SparkServiceRPCClientStub.executeRDD(SparkServiceRPCClientStub.scala:225)
at com.databricks.service.SparkClient$.executeRDD(SparkClient.scala:279)
at com.databricks.spark.util.SparkClientContext$.executeRDD(SparkClientContext.scala:161)
at org.apache.spark.scheduler.DAGScheduler.submitJob(DAGScheduler.scala:864)
at org.apache.spark.scheduler.DAGScheduler.runJob(DAGScheduler.scala:928)
at org.apache.spark.SparkContext.runJob(SparkContext.scala:2331)
at org.apache.spark.SparkContext.runJob(SparkContext.scala:2426)
at org.apache.spark.sql.Dataset.$anonfun$collectAsArrowToPython$6(Dataset.scala:3638)
at org.apache.spark.sql.Dataset$$Lambda$3567/1086808304.apply$mcV$sp(Unknown Source)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:1581)
at org.apache.spark.sql.Dataset.$anonfun$collectAsArrowToPython$3(Dataset.scala:3642)```

最佳答案

这可能是因为 Databricks-connect 正在客户端机器上执行 toPandas,然后可能会耗尽内存。您可以通过设置 spark.driver.memory 来增加本地驱动程序内存。在(本地)配置文件中 ${spark_home}/conf/spark-defaults.conf哪里${spark_home}可以通过 databricks-connect get-spark-home 获得.

关于python - 使用 toPandas() 和 databricks 连接时遇到 'java.lang.OutOfMemoryError: Java heap space',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65222106/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com