Spark RDD 笛卡尔积

Spark RDD 笛卡尔积

val left  = sc.parallelize(List(1,2,3))
val right  = sc.parallelize(List(3,4,5,6))
val out = left union right //返回所有元素新的RDD //{1,2,3,3,3,4,5,6}
val insterstions = left intersection right //返回RDD的交集 {3}
val cartesian = left cartesian right //返回两个RDD的笛卡尔积 3*4

你可能感兴趣的:(Spark RDD 笛卡尔积)