spark aggregateByKey函数执行结果异常问题
来源:互联网 发布:mysql递归 编辑:程序博客网 时间:2024/06/05 11:39
执行函数异常代码
</pre><pre name="code" class="java"> val conf = new SparkConf().setAppName("SparkWordCount").setMaster("local[1]") val sc = new SparkContext(conf) val data = sc.parallelize(List((1, 3), (1, 200), (1, 100), (2, 3), (2, 4), (2, 5))) def seqOp(a: Int, b: Int): Int = { println("seq: " + a + "\t " + b) math.max(a, b) } def combineOp(a: Int, b: Int): Int = { println("comb: " + a + "\t " + b) a + b } // val localIterator=data.aggregateByKey(0)((_,_)._2, _+_).collect(); val localIterator = data.aggregateByKey(4)(seqOp, combineOp).collect(); for (i <- localIterator) println(i) sc.stop()//这样的代码执行完后的结果不正确,原因是数据分片默认太少,将代码的第三行改为:
val data = sc.parallelize(List((1, 3), (1, 200), (1, 100), (2, 3), (2, 4), (2, 5)), 6)
即可
0 0
- spark aggregateByKey函数执行结果异常问题
- spark aggregateByKey函数使用问题
- Spark函数讲解:aggregateByKey
- Spark函数讲解:aggregateByKey
- spark的aggregateByKey简单用法
- spark中算子详解:aggregateByKey
- aggregateByKey
- Spark操作—aggregate、aggregateByKey详解
- Spark算子[09]:aggregateByKey、aggregate详解
- Java中Split函数的用法技巧 结果异常问题
- [spark] Task成功执行的结果处理
- 结合Spark源码分析, combineByKey, aggregateByKey, foldByKey, reduceByKey
- 【Spark Java API】Transformation(6)—aggregate、aggregateByKey
- Spark中的aggregate和aggregateByKey的区别及疑惑
- Spark编程之基本的RDD算子-aggregate和aggregateByKey
- Spark中的aggregate和aggregateByKey的区别及疑惑
- [Spark--基础]--聚合操作-reduceByKey、combineBykey、groupBy和AggregateByKey
- Spark 异常 serialVersionUID 不一致问题
- bzoj 3894(最小割)
- get get_children方法
- jvisualvm远程监控Tomcat
- 使用SpringAop 验证方法参数是否合法
- 向服务器端发送请求 GET POST
- spark aggregateByKey函数执行结果异常问题
- Integer Break
- 作业五
- shell 的ftp简单应用
- 搭建Spring所需的各类jar包汇总详解
- finish with non-zero exit value 1
- GridView
- C#:文件创建、复制、移动、删除
- android自动化测试