Skip to content

Commit 3c5f3da

Browse files
committed
Fix
1 parent ca2a224 commit 3c5f3da

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/ReplaceNullWithFalseInPredicateSuite.scala

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import org.apache.spark.sql.AnalysisException
2121
import org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute
2222
import org.apache.spark.sql.catalyst.dsl.expressions._
2323
import org.apache.spark.sql.catalyst.dsl.plans._
24-
import org.apache.spark.sql.catalyst.expressions.{And, ArrayExists, ArrayFilter, ArrayTransform, CaseWhen, EqualTo, Expression, GreaterThan, If, LambdaFunction, LessThanOrEqual, Literal, MapFilter, NamedExpression, Or, UnresolvedNamedLambdaVariable}
24+
import org.apache.spark.sql.catalyst.expressions.{And, ArrayExists, ArrayFilter, ArrayTransform, CaseWhen, EqualTo, Expression, GreaterThan, If, LambdaFunction, LessThanOrEqual, Literal, MapFilter, NamedExpression, Not, Or, UnresolvedNamedLambdaVariable}
2525
import org.apache.spark.sql.catalyst.expressions.Literal.{FalseLiteral, TrueLiteral}
2626
import org.apache.spark.sql.catalyst.plans.{Inner, PlanTest}
2727
import org.apache.spark.sql.catalyst.plans.logical.{DeleteFromTable, LocalRelation, LogicalPlan, UpdateTable}
@@ -225,10 +225,7 @@ class ReplaceNullWithFalseInPredicateSuite extends PlanTest {
225225
FalseLiteral)
226226
val expectedCond = If(
227227
UnresolvedAttribute("i") > Literal(10),
228-
If(
229-
UnresolvedAttribute("i") === Literal(15),
230-
FalseLiteral,
231-
TrueLiteral),
228+
Not(UnresolvedAttribute("i") === Literal(15)),
232229
FalseLiteral)
233230
testFilter(originalCond = condition, expectedCond = expectedCond)
234231
testJoin(originalCond = condition, expectedCond = expectedCond)
@@ -246,14 +243,10 @@ class ReplaceNullWithFalseInPredicateSuite extends PlanTest {
246243
FalseLiteral)
247244
val branches = Seq((UnresolvedAttribute("i") > Literal(10)) -> branchValue)
248245
val condition = CaseWhen(branches)
249-
250-
val expectedCond = CaseWhen(Seq((UnresolvedAttribute("i") > Literal(10)) -> If(
246+
val expectedCond = CaseWhen(Seq((UnresolvedAttribute("i") > Literal(10)) ->
251247
CaseWhen(
252248
Seq((UnresolvedAttribute("i") > Literal(20)) -> TrueLiteral),
253-
FalseLiteral),
254-
TrueLiteral,
255-
FalseLiteral)))
256-
249+
FalseLiteral)))
257250
testFilter(originalCond = condition, expectedCond = expectedCond)
258251
testJoin(originalCond = condition, expectedCond = expectedCond)
259252
testDelete(originalCond = condition, expectedCond = expectedCond)
@@ -268,13 +261,7 @@ class ReplaceNullWithFalseInPredicateSuite extends PlanTest {
268261
Literal(3)),
269262
TrueLiteral,
270263
FalseLiteral)
271-
val expectedCond = If(
272-
If(
273-
UnresolvedAttribute("i") === Literal(15),
274-
FalseLiteral,
275-
TrueLiteral),
276-
TrueLiteral,
277-
FalseLiteral)
264+
val expectedCond = Not(UnresolvedAttribute("i") === Literal(15))
278265
testFilter(originalCond = condition, expectedCond = expectedCond)
279266
testJoin(originalCond = condition, expectedCond = expectedCond)
280267
testDelete(originalCond = condition, expectedCond = expectedCond)

0 commit comments

Comments
 (0)