【发布时间】:2021-10-20 15:39:24
【问题描述】:
我无法通过 Databricks Notebooks(版本 8.3,Spark 3.1.1)中的 pySpark 读取 URL 的内容。我已经尝试了几乎所有的可能性,但无法找出确切的问题。这是我的代码。
from pyspark import SparkFiles
url = 'https://pds-atmospheres.nmsu.edu/PDS/data/mors_1101/tps/1998_028/8028d38a.tps'
spark.sparkContext.addFile(url)
df1 = spark.read.text("file://"+SparkFiles.get('8028d38a.tps'))
df1.show()
这是错误
org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 10.0 failed 4 times, most recent failure: Lost task 0.3 in stage 10.0 (TID 43) (10.139.64.4 executor 0): com.databricks.sql.io.FileReadException: Error while reading file file:/local_disk0/spark-95887d0f-a955-4075-86ac-520a51f0c64e/userFiles-9204e03a-a0fd-4999-9f40-9d9c3cc599a6/8028d38a.tps. It is possible the underlying files have been updated. You can explicitly invalidate the cache in Spark by running 'REFRESH TABLE tableName' command in SQL or by recreating the Dataset/DataFrame involved. If Delta cache is stale or the underlying files have been removed, you can invalidate Delta cache manually by restarting the cluster.
我以reading data from URL using spark databricks platform 为例。有没有人遇到过类似的问题?
【问题讨论】:
-
您是否尝试删除它 dbutils.fs.rm("/local_disk0/spark-95887d0f-a955-4075-86ac-520a51f0c64e", True) 并再次运行?
-
@HubertDudek 没用。上述命令的输出为 False。
标签: pyspark databricks