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)
}
}
相关文章
- 11-07SAP QM启用了Physical Sample Management后检验批有哪些特殊地方?
- 11-07unity, 立即生效动画:Animation.sample()
- 11-07Google单元测试框架gtest之官方sample笔记2--类型参数测试
- 11-07例子:Bluetooth app to device sample
- 11-07【Meta learning】Learning to learn: Meta-Critic Networks for sample efficient learning
- 11-07dshow,Sample Grabber 从摄像头采集
- 11-07OpenCascade -- MFC Sample 的学习[1]
- 11-07解决cuvid中的sample编译和链接问题
- 11-07错误信息:ids for this class must be manually assigned before calling save(): sample.db.Completedsample
- 11-07pandas.DataFrame.sample随机抽样