Apache Spark
y七心海棠
这个作者很懒,什么都没留下…
展开
-
为何eclipse 不能把scala文件打包
我的需求很简单,建立一个scala工程,写一个简单的object,带上main方法,但是这样eclipse 不能导出成jar 包,求各种大神拯救。原创 2015-05-12 09:08:13 · 2333 阅读 · 1 评论 -
scala的一些例子
scala食谱的例子原创 2015-05-27 20:06:02 · 517 阅读 · 0 评论 -
spark如何wordcount中文
典型的wordcount英文的例子 val conf = new SparkConf().setAppName("FirstApp").setMaster("local") val sc = new SparkContext(conf) val c = sc.textFile("hdfs://hadoop1:9000/input/sparkwc").flatMap(_.split("原创 2015-05-27 20:10:36 · 1010 阅读 · 0 评论 -
scala函数定义与使用
1.scala函数的完整定义:def 函数名 (参数名:参数类型):函数返回值类型 ={函数体}2.必须选项:def 函数名此处为定义一个不带参数,不带返回值的函数:例如def m{println("hello world")}不带参数可以省略(),但是调用的时候就不可以以 函数名() 的方式调用定义函数的时候带有(),调用的时候,可以使用 函数名() 或者直接函数名的原创 2015-05-17 11:01:25 · 3701 阅读 · 0 评论 -
ant 的实用例子
<javac classpath="${classpath}"encoding="utf-8" sourcepath="" source="1.7" target="1.7" srcdir="src" debug="on" destdir="${build.dir}">原创 2015-05-29 00:22:23 · 411 阅读 · 0 评论 -
避免GroupByKey
//wordCountsWithReduce val words = Array("one", "two", "two", "three", "three", "three")val wordPairsRDD = sc.parallelize(words).map(word => (word, 1))val wordCountsWithReduce = wordPairsRDD.reduce原创 2015-06-01 11:48:14 · 623 阅读 · 0 评论 -
Spark读取文件
1.textFile: 其定义为:def textFile(path: String, minPartitions: Int = defaultMinPartitions): RDD[String];从HDFS,本地或者任何Hadoop支持的文件系统URI读取文件,返回String RDD。 2.wholeTextFiles: 其定义为:def wholeTextFiles(p原创 2015-07-04 12:05:22 · 3404 阅读 · 0 评论