Spark1.4源码走读笔记之隐式转换

 RDD源码中隐式转换

延庆ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为成都创新互联的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:18980820575(备注:SSL证书合作)期待与您的合作!

 def distinct(numPartitions: Int)(implicit ord: Ordering[T] = null): RDD[T] = withScope {

    map(x => (x, null)).reduceByKey((x, y) => x, numPartitions).map(_._1)

  }

使用了隐式参数,运行时不需要手动提供参数ord,运行时会根据上下文注入参数

  def groupBy[K](f: T => K)(implicit kt: ClassTag[K]): RDD[(K, Iterable[T])] = withScope {

    groupBy[K](f, defaultPartitioner(this))

  }

  def groupBy[K](

      f: T => K,

      numPartitions: Int)(implicit kt: ClassTag[K]): RDD[(K, Iterable[T])] = withScope {

    groupBy(f, new HashPartitioner(numPartitions))

  }


网页题目:Spark1.4源码走读笔记之隐式转换
URL链接:http://bzwzjz.com/article/joisoi.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 定制网站设计 四川成都网站设计 专业网站设计 成都网站设计 企业网站设计 企业网站建设公司 成都营销网站制作 专业网站建设 营销型网站建设 营销网站建设 高端品牌网站建设 成都h5网站建设 网站设计制作 成都网站建设 重庆网站建设 成都网站建设 成都企业网站制作 成都网站建设 网站建设公司 成都网站建设 成都网站设计制作公司 自适应网站设计