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)
相关推荐
wtblszn5 小时前
水源井安全监测在线管理系统方案
大数据·安全
kyrie_sakura8 小时前
大模型学习32 --大模型微调3 -- 分布式训练算法
分布式·学习·算法
奇墨 ITQM9 小时前
AI网关MAIGateway怎么判断质量?多活切换实测
大数据·网络·人工智能·高可用·ai网关·故障切换
向科→向总工→空间动态计系统11 小时前
动态零轴融合三铁律
大数据·开发语言·人工智能·python·机器人
DataY轻量数据平台11 小时前
时序、流式、向量一库搞定:DataY 正式支持 YMatrix
大数据·数据库
逐米时代13 小时前
「制造新解法」AI转型路线图:分阶段目标与资源节奏设计
大数据·人工智能
Aloudata13 小时前
人工逐级追查 SQL vs 数据血缘追溯:监管报表异常排查
大数据·数据库·sql
注塑机数据采集联网14 小时前
中科晟达注塑机 MES 系统:通过自建网关采集数据并对接 AI 系统
大数据·人工智能·物联网·数据采集·注塑机网关·注塑机mes
程序猿追15 小时前
HarmonyOS 7 本机书签里,两篇同名文章怎样在重启后各自打开
大数据·数据分析·harmonyos
qq_4109603515 小时前
大模型 Prompt 工程在文件上传与分布式存储中的高级用
分布式·prompt