Skip to content

Commit aceab91

Browse files
committed
add unit test in WholeStageCodegenSuite
1 parent d50ca8e commit aceab91

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

sql/core/src/test/scala/org/apache/spark/sql/execution/WholeStageCodegenSuite.scala

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ class WholeStageCodegenSuite extends SparkPlanTest with SharedSQLContext {
3535
checkThatPlansAgree(
3636
sqlContext.range(100),
3737
(p: SparkPlan) =>
38-
WholeStageCodegen(Filter('a === 1, InputAdapter(p)), Seq()),
39-
(p: SparkPlan) => Filter('a === 1, p),
38+
WholeStageCodegen(Filter('a == 1, InputAdapter(p)), Seq()),
39+
(p: SparkPlan) => Filter('a == 1, p),
4040
sortAnswers = false
4141
)
4242
}
@@ -69,4 +69,13 @@ class WholeStageCodegenSuite extends SparkPlanTest with SharedSQLContext {
6969
p.asInstanceOf[WholeStageCodegen].plan.isInstanceOf[BroadcastHashJoin]).isDefined)
7070
assert(df.collect() === Array(Row(1, 1, "1"), Row(1, 1, "1"), Row(2, 2, "2")))
7171
}
72+
73+
test("Sort should be included in WholeStageCodegen") {
74+
val df = sqlContext.range(3, 0, -1).sort(col("id"))
75+
val plan = df.queryExecution.executedPlan
76+
assert(plan.find(p =>
77+
p.isInstanceOf[WholeStageCodegen] &&
78+
p.asInstanceOf[WholeStageCodegen].plan.isInstanceOf[Sort]).isDefined)
79+
assert(df.collect() === Array(Row(1), Row(2), Row(3)))
80+
}
7281
}

0 commit comments

Comments
 (0)