You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Spark读取含-ext-10000子目录的HDFS路径失败无报错问题

Spark读取Hive数据无法加载-ext-10000子目录数据问题

使用Spark 2.3读取Hive数据时,能递归读取dt=2022-10-11目录下的数据,但无法读取dt=2022-10-12/-ext-10000子目录中的数据,且无任何报错信息。

相关HDFS目录查看命令

hadoop fs -ls /user/warehouse/dbA/tableA/dt=2022-10-11/
hadoop fs -ls /user/warehouse/dbA/tableA/dt=2022-10-12/-ext-10000

已配置的Spark参数

--conf hive.exec.dynamic.partition=true
--conf hive.exec.dynamic.partition.mode=nonstrict
--conf mapreduce.input.fileinputformat.input.dir.recursive=true
--conf spark.hive.mapred.supports.subdirectories=true
--conf spark.hadoop.hive.supports.subdirectories=true
--conf spark.hadoop.hive.mapred.supports.subdirectories=true
--conf spark.hadoop.hive.input.dir.recursive=true
--conf spark.hadoop.mapreduce.input.fileinputformat.input.dir.recursive=true
--conf hive.exec.compress.output=true

解决方案

Spark 2.3默认会跳过命名包含-ext-的目录(这类目录多为Hive执行INSERT OVERWRITE等操作生成的临时工作目录),需添加以下配置参数禁用该过滤行为:

--conf spark.sql.hive.verifyPartitionPath=false
--conf spark.hadoop.hive.input.path.filter.class=""

若直接读取HDFS路径而非通过Hive表访问,还需在读取时显式开启递归文件查找:

spark.read.option("recursiveFileLookup", "true").parquet("/user/warehouse/dbA/tableA/dt=2022-10-12/")

内容的提问来源于stack exchange,提问作者Andy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.08 11:28:25