Skip to content

Commit 4cd4fad

Browse files
committed
enhance test
1 parent 73f84c0 commit 4cd4fad

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisSuite.scala

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,17 @@ class AnalysisSuite extends AnalysisTest {
121121
}
122122

123123
test("SPARK-9634: cleanup unnecessary Aliases in LogicalPlan") {
124-
var plan = testRelation.select((('a + 1).as("a+1") + 2).as("col"))
125-
var expected = testRelation.select(('a + 1 + 2).as("col")).analyze
124+
val a = testRelation.output.head
125+
var plan = testRelation.select(((a + 1).as("a+1") + 2).as("col"))
126+
var expected = testRelation.select((a + 1 + 2).as("col"))
126127
checkAnalysis(plan, expected)
127128

128-
plan = testRelation.groupBy('a.as("a1").as("a2"))((sum('a).as("sum_a") + 1).as("col"))
129-
expected = testRelation.groupBy('a)((sum('a) + 1).as("col")).analyze
129+
plan = testRelation.groupBy(a.as("a1").as("a2"))((min(a).as("min_a") + 1).as("col"))
130+
expected = testRelation.groupBy(a)((min(a) + 1).as("col"))
130131
checkAnalysis(plan, expected)
131132

132133
// CreateStruct is a special case that we should not trim Alias for it.
133-
plan = testRelation.select(CreateStruct(Seq('a, ('a + 1).as("a+1"))).as("col"))
134-
checkAnalysis(plan, plan.analyze)
134+
plan = testRelation.select(CreateStruct(Seq(a, (a + 1).as("a+1"))).as("col"))
135+
checkAnalysis(plan, plan)
135136
}
136137
}

0 commit comments

Comments
 (0)