Apache spark 在hdfs上使用spark stream写入拼花地板文件时,Uri未经授权:hdfs:/data/_spark_元数据错误

Apache spark 在hdfs上使用spark stream写入拼花地板文件时,Uri未经授权:hdfs:/data/_spark_元数据错误,apache-spark,hdfs,Apache Spark,Hdfs,我正在尝试从卡夫卡读取数据并保存到hdfs上的拼花文件。 我的代码类似于下面的代码,区别在于我是用Java编写的 val df = spark .readStream .format("kafka") .option("kafka.bootstrap.servers", "host1:port1,host2:port2") .option("subscribe", "topic1") .load() df.selectExpr("CA

我正在尝试从卡夫卡读取数据并保存到hdfs上的拼花文件。 我的代码类似于下面的代码,区别在于我是用Java编写的

val df = spark
      .readStream
      .format("kafka")
      .option("kafka.bootstrap.servers", "host1:port1,host2:port2")
      .option("subscribe", "topic1")
      .load()

df.selectExpr("CAST(key AS STRING)","CAST(value AS STRING)").writeStream.format("parquet").option("path",outputPath).option("checkpointLocation", "/tmp/sparkcheckpoint1/").outputMode("append").start().awaiteTermination()
但是,它在没有授权的情况下抛出了
Uri:hdfs:/data/\u spark\u元数据
异常,其中
hdfs:///data
是输出路径

当我将代码更改为
spark.read
df.write
以一次性写出拼花地板文件时,没有任何异常,因此我猜它与我的hdfs配置无关

有人能帮我吗

有人建议将hdfs://从路径中删除,但将其保留在检查点中。然而,对我来说,在HDP沙盒中,它在有hdfs://和没有hdfs://的情况下都可以工作:

.option("path", "/user/username/outpath")
.option("checkpointLocation", "/tmp/checkpoint")