• 假期四


    vim ./sparkapp/src/main/scala/SimpleApp.scala #在 ./sparkapp/src/main/scala 下建立一个名为 SimpleApp.scala 的文件,并添加如下代码

    /* SimpleApp.scala */
    import org.apache.spark.SparkContext
    import org.apache.spark.SparkContext._
    import org.apache.spark.SparkConf

    object SimpleApp {
    def main(args: Array[String]) {
    val logFile = "file:///usr/local/spark/README.md" // Should be some file on your system
    val conf = new SparkConf().setAppName("Simple Application")
    val sc = new SparkContext(conf)
    val logData = sc.textFile(logFile, 2).cache()
    val numAs = logData.filter(line => line.contains("a")).count()
    val numBs = logData.filter(line => line.contains("b")).count()
    println("Lines with a: %s, Lines with b: %s".format(numAs, numBs))
    }
    }

  • 相关阅读:
    [bzoj4364] [IOI2014]wall砖墙
    [bzoj3064] [Tyvj 1518] CPU监控
    [bzoj3434] [WC2014]时空穿梭
    ASP.NET
    ASP.NET
    ASP.NET
    ASP.NET
    ASP.NET
    ASP.NET
    MSSQL
  • 原文地址:https://www.cnblogs.com/jbwen/p/12261751.html
Copyright © 2020-2023  润新知