Skip to content

Commit 4eb43ec

Browse files
committed
Update basicOperators.scala
Hi all, I want to submit a Except operator in basicOperators.scala In SQL case.SQL support two table do except operator. select * from table1 except select * from table2 This operator support the substract function .Return an table with the elements from `this` that are not in `other`.
1 parent 2f6a835 commit 4eb43ec

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/basicOperators.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,18 @@ case class ExistingRdd(output: Seq[Attribute], rdd: RDD[Row]) extends LeafNode {
204204
override def execute() = rdd
205205
}
206206

207+
/**
208+
* :: DeveloperApi ::
209+
* This operator support the substract function .Return an table with the elements from `this` that are not in `other`.
210+
*/
211+
@DeveloperApi
212+
case class Except(children: Seq[SparkPlan])(@transient sc: SparkContext) extends SparkPlan {
213+
// TODO:The input children:Seq[SparkPlan] should only contain two SparkPlan
214+
override def output = children.head.output
215+
216+
override def execute() = {
217+
children(0).execute().subtract(children(1).execute())
218+
}
219+
220+
override def otherCopyArgs = sc :: Nil
221+
}

0 commit comments

Comments
 (0)