Spark英文單詞分析案例
1、有如下檔案testdata.txt()
At a high level
every Spark application consists of a driver program that runs the user’s main function and executes various parallel operations on a cluster
The main abstraction Spark provides is a resilient distributed dataset (RDD)
which is a collection of elements partitioned across the nodes of the cluster that can be operated on in parallel
RDDs are created by starting with a file in the Hadoop file system (or any other Hadoop-supported file system)
or an existing Scala collection in the driver program
and transforming it
Users may also ask Spark to persist an RDD in memory
allowing it to be reused efficiently across parallel operations. Finally
RDDs automatically recover from node failures
要求完成如下功能
(1)篩選出包含Spark的行,並統計行數
(2)輸出包含單詞最多的那一行的單詞數
(3)統計資料中包含“a”的行數和包含“b”的行數
|