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)
相关推荐
ZKNOW甄知科技15 小时前
AI-ITSM的时代正在到来:深度解读Gartner最新报告
大数据·运维·人工智能·低代码·网络安全·微服务·重构
xinyuan_12345615 小时前
数智化招采平台实战指南:AI如何让采购管理实现效率与价值落地
大数据·人工智能
Tezign_space15 小时前
技术实战:Crocs如何构建AI驱动的智能内容矩阵,实现内容播放量提升470%?
大数据·人工智能·矩阵·aigc·内容运营·多智能体系统·智能内容矩阵
八月瓜科技15 小时前
八月瓜科技参与“数据要素驱动产业升级”活动,分享【数据赋能科技创新全链条】
java·大数据·人工智能·科技·机器人·程序员创富
梁萌15 小时前
分布式事物seata的AT模式实战
分布式·微服务·实战·seata·一致性·事物
shaohaoyongchuang15 小时前
01-分布式基础-创建微服务项目
分布式·微服务·架构
梦里不知身是客1115 小时前
flink的CDC 的种类
大数据·flink
TOWE technology16 小时前
PDU、工业连接器与数据中心机柜电力系统
大数据·人工智能·数据中心·idc·pdu·智能pdu·定制电源管理
五度易链-区域产业数字化管理平台16 小时前
行业研究+大数据+AI:“五度易链”如何构建高质量产业数据库?
大数据·人工智能