Spark1.4源码走读笔记之模式匹配-创新互联

RDD里的模式匹配:

创新互联公司是一家专业的成都网站建设公司,我们专注网站设计制作、网站制作、网络营销、企业网站建设,卖友情链接一元广告为企业客户提供一站式建站解决方案,能带给客户新的互联网理念。从网站结构的规划UI设计到用户体验提高,创新互联力求做到尽善尽美。

def hasNext: Boolean = (thisIter.hasNext, otherIter.hasNext) match {

     case (true, true) => true

     case (false, false) => false

     case _ => throw new SparkException("Can only zip RDDs with " +

      "same number of elements in each partition")

    }

jobResult = jobResult match {

     case Some(value) => Some(f(value, taskResult.get))

     case None => taskResult

    }

  take(1) match {

   case Array(t) => t

   case _ => throw new UnsupportedOperationException("empty collection")

  }

下面的比较好理解:

val len = rdd.dependencies.length

   len match {

    case 0 => Seq.empty

    case 1 =>

     val d = rdd.dependencies.head

     debugString(d.rdd, prefix, d.isInstanceOf[ShuffleDependency[_, _, _]], true)

    case _ => //所有的都到碗里来

     val frontDeps = rdd.dependencies.take(len - 1)

     val frontDepStrings = frontDeps.flatMap(

      d => debugString(d.rdd, prefix, d.isInstanceOf[ShuffleDependency[_, _, _]]))

     val lastDep = rdd.dependencies.last

     val lastDepStrings =

      debugString(lastDep.rdd, prefix, lastDep.isInstanceOf[ShuffleDependency[_, _, _]], true)

     (frontDepStrings ++ lastDepStrings)

   }

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。

当前文章:Spark1.4源码走读笔记之模式匹配-创新互联
地址分享:https://www.cdcxhl.com/article42/iohhc.html

成都网站建设公司_创新互联,为您提供全网营销推广外贸网站建设定制网站App开发GoogleApp设计

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

成都定制网站网页设计