Skip to content

Instantly share code, notes, and snippets.

@Yuichiroh
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yuichiroh/75e7100ac938e6cdd534 to your computer and use it in GitHub Desktop.
Save Yuichiroh/75e7100ac938e6cdd534 to your computer and use it in GitHub Desktop.
import org.apache.spark.SparkContext
import org.apache.spark.SparkContext._ //implicit conversion用 このソースでは使っていないけど書いておくといい
import org.apache.spark.SparkConf
object SampleApp {
def main(args: Array[String]) {
val srcFileName = "/work/data/something.gz"
val conf = new SparkConf().setAppName("SampleApp")
val sc = new SparkContext(conf)
val src = sc.textFile(srcFileName).cache()
val lines = src.count()
println("Lines %,d".format(lines))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment