package date_20250415

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object task2 {
    def main(args: Array[String]): Unit = {
        val conf = new SparkConf().setMaster("local")
          .setAppName("Spark-WordCount")

        val sc = new SparkContext(conf)
        val linesRDD: RDD[String] = sc.textFile("hdfs://hadoop102:8020/input/data/sort_data.txt")

        linesRDD
          .map(x => {
              val arr: Array[String] = x.split(" ")
              (arr(0).toInt, arr(1).toInt)
          })
          .sortBy(_._1)
          .collect()
          .foreach(println)

    }

}
