Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix test failure
  • Loading branch information
sunchao committed Aug 28, 2020
commit cc661984f3ccbf59bbabb91c7d92b17524ab74d3
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,14 @@ class BooleanSimplificationSuite extends PlanTest with ExpressionEvalHelper with

test("Complementation Laws - null handling") {
checkCondition('e && !'e,
testRelationWithData.where(If('e.isNull, Literal.create(null, BooleanType), false)).analyze)
testRelationWithData.where(And(Literal(null, BooleanType), 'e.isNull)).analyze)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although I think it is better to test BooleanSimplification like original, but BooleanSimplificationSuite's optimizer mixes SimplifyConditionals and BooleanSimplification.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. What is the recommended way for adding test suite for optimizers? should each test suite only use the corresponding optimizer rule, or it's OK to also add those relevant ones?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually we only test corresponding rule in each test suite. But some suites use multiple rules like this one. For this one, although we can still only test BooleanSimplification if we add another optimizer, but seems too much. Maybe currently it's good enough. Maybe add a comment.

checkCondition(!'e && 'e,
testRelationWithData.where(If('e.isNull, Literal.create(null, BooleanType), false)).analyze)
testRelationWithData.where(And(Literal(null, BooleanType), 'e.isNull)).analyze)

checkCondition('e || !'e,
testRelationWithData.where(If('e.isNull, Literal.create(null, BooleanType), true)).analyze)
testRelationWithData.where(Or('e.isNotNull, Literal(null, BooleanType))).analyze)
checkCondition(!'e || 'e,
testRelationWithData.where(If('e.isNull, Literal.create(null, BooleanType), true)).analyze)
testRelationWithData.where(Or('e.isNotNull, Literal(null, BooleanType))).analyze)
}

test("Complementation Laws - negative case") {
Expand Down