sample

package sparkcore

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

object Demo05Sample {
def main(args: Array[String]): Unit = {
val conf: SparkConf = new SparkConf().setAppName("Sample").setMaster("local")

val sc = new SparkContext(conf)

val students: RDD[String] = sc.textFile("data/students.txt")

/**
* sample:抽样算子
*/
val sampleRDD: RDD[String] = students.sample(false,0.1)

sampleRDD.foreach(println)
}

}

sample

上一篇:不破不立!为什么说浪潮iGIX是真正属于大型企业的中台?


下一篇:无影云桌面和服务器有什么区别?阿里云无影电脑有什么优势?