# spark **Repository Path**: ldw598156412/spark ## Basic Information - **Project Name**: spark - **Description**: 基于Hadoop与Spark的大数据开发实战案例及作业答案 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 3 - **Forks**: 0 - **Created**: 2019-12-02 - **Last Updated**: 2024-10-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # spark #### 介绍 基于Hadoop与Spark的大数据开发实战案例及作业答案

09-Spark基础

    练习题 ``` val lines = sc.textFile("hdfs://hadoop000:8020/data/hello.txt") val words = lines.flatMap(line => line.split("\t")) val pairs = words.map(word => (word, 1)) val wordCounts = pairs.reduceByKey(_ + _) val sortedWordCounts = wordCounts.map(x=>(x._2,x._1)) .sortByKey(false).map(x=>(x._2,x._1)) sortedWordCounts.collect ```

10-Spark Core

11-Spark SQL

12-Spark Streaming