scala - 错误 AzureNativeFileSystemStore : DirectoryIsNotEmpty

标签 scala azure apache-spark hadoop azure-hdinsight

我正在尝试在 Azure HdInsigth 中执行此代码。我有一个与 Data Lake Storage 连接的 Spark 集群。

spark.conf.set(
"fs.azure.sas.data.spmdevsharedstorage.blob.core.windows.net",
"xxxxxxxxxxx key xxxxxxxxxxx"
)


val shared_data = "wasbs://<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f195908590b182819c95948782999083949582859e83909694df939d9e93df929e8394df86989f959e8682df9f9485" rel="noreferrer noopener nofollow">[email protected]</a>/"

//Read Csv
val dfCsv = spark.read.option("inferSchema", "true").option("header", true).csv(shared_data + "/test/4G-pixel.csv")
val dfCsv_final_withcolumn = dfCsv.select($"latitude",$"longitude")
val dfCsv_final = dfCsv_final_withcolumn.withColumn("new_latitude",col("latitude")*100)

//write
dfCsv_final.coalesce(1).write.format("com.databricks.spark.csv").option("header", "true").mode("overwrite").save(shared_data + "/test/4G-pixel_edit.csv")

该代码可以很好地读取 csv 文件。因此,当写入新文件 csv 时,我看到以下错误:

20/04/03 14:58:12 ERROR AzureNativeFileSystemStore: Encountered Storage Exception for delete on Blob: https://spmdevsharedstorage.blob.core.windows.net/data/test/4G-pixel_edit.csv/_temporary/0, Exception Details: This operation is not permitted on a non-empty directory. Error Code: DirectoryIsNotEmpty
org.apache.hadoop.fs.azure.AzureException: com.microsoft.azure.storage.StorageException: This operation is not permitted on a non-empty directory.
  at org.apache.hadoop.fs.azure.AzureNativeFileSystemStore.delete(AzureNativeFileSystemStore.java:2627)
  at org.apache.hadoop.fs.azure.AzureNativeFileSystemStore.delete(AzureNativeFileSystemStore.java:2637)

新文件 csv 已写入数据湖,但代码停止。我需要你不要看到这个错误。 我该如何修复它?

最佳答案

我也遇到过类似的问题。

我通过使用以下配置解决了这个问题。将其设置为 true。

--conf spark.hadoop.mapreduce.fileoutputcommitter.cleanup.skipped=true

spark.conf.set("spark.hadoop.mapreduce.fileoutputcommitter.cleanup.skipped","true")

关于scala - 错误 AzureNativeFileSystemStore : DirectoryIsNotEmpty,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60531211/

相关文章:

azure - 什么决定了 Azure 中应用服务的出站 IP 地址?

apache-spark - Spark中转换的失败处理

apache-spark - Spark reduceByKey 以及如何最小化混洗

java - shuffle内存池空闲: SPARK with Java

database - Lift 映射器中的外键约束

scala - 如何统计来自 squeryl 的查询

javascript - 如何在javascript中的异步函数中回调

linux - 在托管 Linux 代理上运行的 VSTS 构建期间挂载 Azure 文件存储失败

未明确指定类型参数时,Scala 下限类型参数不起作用

scala - 将惰性值作为函数或方法参数传递而不对其求值?