码迷,mamicode.com
首页 > 其他好文 > 详细

001Spark文件分析测试

时间:2015-09-02 09:22:08      阅读:123      评论:0      收藏:0      [点我收藏+]

标签:

使用spark-1.4.1-bin-hadoop2.6进行处理,测试文件大小为3G,
测试结果:
1:统计一个文件中某个字符的个数
scala> sc.textFile("/home/y/my_temp/1.txt").filter(line=>line.contains("ok")).count()
scala> sc.textFile("/home/y/my_temp/1.txt").

用时:Duration    13 s
记录条数:res5: Long = 101824020

2:统计行数
scala> sc.textFile("/home/y/my_temp/1.txt").count()

用时:Duration    12 s
记录条数:res2: Long = 10

 

001Spark文件分析测试

标签:

原文地址:http://www.cnblogs.com/yshyee/p/4777595.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!