Spark 之 partitons

Listing leaf files and directories

分析其并行化

org.apache.spark.util.HadoopFSUtils

复制代码
      sc.parallelize(paths, numParallelism)
        .mapPartitions { pathsEachPartition =>
          val hadoopConf = serializableConfiguration.value
          pathsEachPartition.map { path =>
            val leafFiles = listLeafFiles(
              path = path,
              hadoopConf = hadoopConf,
              filter = filter,
              contextOpt = None, // Can't execute parallel scans on workers
              ignoreMissingFiles = ignoreMissingFiles,
              ignoreLocality = ignoreLocality,
              isRootPath = isRootLevel,
              parallelismThreshold = Int.MaxValue,
              parallelismMax = 0)
            (path, leafFiles)
          }
        }.collect()

    // Set the number of parallelism to prevent following file listing from generating many tasks
    // in case of large #defaultParallelism.
    val numParallelism = Math.min(paths.size, parallelismMax)

parallelismMax 最终由以下配置决定。

复制代码
  val PARALLEL_PARTITION_DISCOVERY_PARALLELISM =
    buildConf("spark.sql.sources.parallelPartitionDiscovery.parallelism")
      .doc("The number of parallelism to list a collection of path recursively, Set the " +
        "number to prevent file listing from generating too many tasks.")
      .version("2.1.1")
      .internal()
      .intConf
      .createWithDefault(10000)
相关推荐
杰建云16711 分钟前
门店小程序怎么运营
大数据·小程序
KANGBboy13 分钟前
hadoop冷热数据分离
大数据·hadoop·分布式
skilllite作者16 分钟前
Evotown——开启本地化、可验证的AI智能体进化新时代
人工智能·分布式·安全·搜索引擎·agentskills
SelectDB17 分钟前
Agent 应用范式下,企业数据基础设施如何演进?
大数据·数据库·数据分析
vx_biyesheji000420 分钟前
计算机毕业设计:Python医疗数据分析平台 Flask框架 数据分析 可视化 医疗大数据 用户画像(建议收藏)✅
大数据·python·深度学习·数据分析·django·flask·课程设计
科技小花1 小时前
2026 年度生成式引擎优化(GEO)标杆产品:百分点科技 Generforce 的差异化路径
大数据·人工智能·科技·geo·ai搜索
研华科技Advantech1 小时前
新一代工业控制开发平台:破解三大痛点
大数据
敏君宝爸1 小时前
RabbitMQ多线程消费与死信队列方案
分布式·rabbitmq
tsyjjOvO1 小时前
深入浅出 RabbitMQ:从原理到实战
分布式·rabbitmq
爱吃苹果的梨叔1 小时前
2026年分布式坐席系统技术指南:从KVM延长到全IP坐席协作
分布式·网络协议·tcp/ip