美文网首页
spark初步

spark初步

作者: 冰_茶 | 来源:发表于2016-07-22 11:59 被阅读0次

    实例1

    var text = sc.parallelize(Seq("a","b","c","a","b","b"))

    text.filter(_.contains("a")).count

    var wc = text.flatMap(line=>line.split("")).map(word=>(word,1)).reduceByKey((a,b)=>a+b)

    wc.collect


    val text = sc.textFile("/data/sofoware/unpacks/spark-1.6.2-bin-hadoop2.6/README.md")

    text.filter(line=>line.contains("Apache Spark")).count

    相关文章

      网友评论

          本文标题:spark初步

          本文链接:https://www.haomeiwen.com/subject/kfdijttx.html