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)
相关推荐
实在智能RPA3 分钟前
3天变30分钟、40小时归零:跨境大卖用智能体在做什么?
大数据·人工智能·搜索引擎·实在智能·实在agent
能年玲奈喝榴莲牛奶5 分钟前
系统规划与管理师-第一章-考点记忆
大数据·数据库·软考·系统规划与管理师·系规
basketball61644 分钟前
软考中级网络工程师 第6章 网络安全 备考总结
大数据·网络·web安全·网络工程师·软考
liudashuang20172 小时前
Kafka Producer 隐藏深坑:Sender 线程自阻塞(自死锁)导致 BufferExhaustedException 完整复盘
java·分布式·kafka·linq
m0_527034332 小时前
异步任务审核系统设计:消息队列、超时重试与失败补偿
java·大数据·开发语言
只说证事2 小时前
大数据专业考研还是考证比较好
大数据·考研
用户3610588626122 小时前
Spark 核心之 Spark-SortShufflebypass 原理深度剖析
大数据·spark
Raas1003 小时前
MAIGateway,魔芋企业级AI网关的安全基建化设计
大数据·人工智能·网关·网络安全·api网关·mai gateway·魔芋
rustfs3 小时前
GitLab 如何与 RustFS 集成?
分布式·rust·gitlab
Anita-lee3 小时前
泛娱乐出海 APP 运营研究:用户量下滑成因与多语种客服数据化运营解决方案
大数据·产品运营·服务发现·娱乐