pyspark - checkpointLocation 需要正确的 hdfs 路径
问题描述
我是 Spark 的新手。
我尝试使用流。
我写了以下代码:
streaming_query = input_df.groupBy("sensor_id").count().writeStream \
.format("console") \
.outputMode("update") \
.option("timestampFormat", "YYYY-mm-dd HH:MM:SS") \
.option("checkpointLocation", os.path.join(basepath, "Spark-Streaming-Demo")) \
.trigger(processingTime="1 second") \
.start()
streaming_query.awaitTermination()
但是,在运行这段代码时,我收到错误消息:
java.lang.IllegalStateException: Error reading delta file file:/path/on/local-system/state/0/0/1.delta of HDFSStateStoreProvider[id = (op=0,part=0),dir = file:/path/on/local-system/state/0/0]: file:/path/on/local-system/state/0/0/1.delta does not exist
我认为checkpointLocation
应该是 HDFS 文件路径而不是本地绝对路径。
如何找出 HDFS URI 的os.path.join(basepath, "Spark-Streaming-Demo")
?
解决方案
推荐阅读
- php - 通过在表 2 中搜索从表 1 中获取用户?
- python - 如何确定 Django 中是否创建了新对象?
- jersey - 百里香内联原始 i18n 消息到 javascript
- reactjs - React Onclick - 没有重载匹配这个调用
- c# - 我应该如何在命令栏项目中设置搜索框?
- javascript - React 钩子上的无限调用 API 的问题
- java - 为什么 Liveness / Readiness 探测失败?
- sqlalchemy - sqlalchemy.exc.InternalError: (psycopg2.errors.InternalError_) 找不到从未知到描述枚举的转换函数
- ios - 我想在 Xcode 上使用 Swift 让我的暗模式同时在所有视图控制器上工作。我该怎么做?
- sql - 在 Quill SQL 中连接多个中缀