def sort: Unit ={ val file = sc.textFile("D:\\caIJIBAO\\out171101\\out\\418\\418\\*") val sortTime : RDD[(Long, String)] = file.map(line => { val sortline = line.trim.split(",") val sorttime = sortline(1) sorttime.toLong (sorttime.toLong,line) }) val sortByKey = sortTime.sortByKey() sortByKey.values.repartition(1).saveAsTextFile("D:\\caIJIBAO\\out171101\\out\\418\\418\\418_sort") }
简单spark单一字段排序
最新推荐文章于 2021-06-17 15:06:43 发布