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)
相关推荐
是Judy咋!2 小时前
RabbitMQ---搭建(自定义数据以及日志目录)
分布式·centos·rabbitmq
keep__go3 小时前
spark 单机安装
大数据·运维·分布式·spark
君不见,青丝成雪5 小时前
网关整合验签
大数据·数据结构·docker·微服务·系统架构
茗鹤APS和MES10 小时前
APS高级计划排程:汽车零部件厂生产排产的智慧之选
大数据·制造·精益生产制造·aps高级排程系统
蒙特卡洛的随机游走11 小时前
Spark的persist和cache
大数据·分布式·spark
蒙特卡洛的随机游走11 小时前
Spark 中 distribute by、sort by、cluster by 深度解析
大数据·分布式·spark
梦里不知身是客1111 小时前
Spark中的宽窄依赖-宽窄巷子
大数据·分布式·spark
化作星辰11 小时前
java 给鉴权kafka2.7(sasl)发送消息权限异常处理
java·大数据·开发语言·kafka
过往记忆11 小时前
Kafka 作为事件流的商业模式正在消亡
分布式·kafka
KYumii11 小时前
智慧判官-分布式编程评测平台
vue.js·spring boot·分布式·spring cloud·java-rabbitmq