Skip to content
Prev Previous commit
Improve test coverage
  • Loading branch information
wangyum committed Feb 12, 2020
commit 4b14b3f619af56babc981e729f43e165369cad01
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,17 @@ class InferFiltersFromConstraintsSuite extends PlanTest {
Some("right.b".attr === "left.a".attr.cast(LongType))).foreach { condition =>
testConstraintsAfterJoin(originalLeft, originalRight, left, right, Inner, condition)
Copy link
Member

@maropu maropu Feb 12, 2020

Choose a reason for hiding this comment

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

In terms of test coverage, its better to test both cases (left/right-side casts)? I have the same comment in the test below.

}
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's also test cast(int) here. The key is: we should test both left side cast and right side cast, as @maropu said.

"left.a".attr.cast(LongType) === "right.b".attr and "right.b".attr === "left.a".attr.cast(LongType) only test left side cast (join left side, not EqualTo left side).


Seq(Some("left.a".attr === "right.b".attr.cast(IntegerType)),
Some("right.b".attr.cast(IntegerType) === "left.a".attr)).foreach { condition =>
testConstraintsAfterJoin(
originalLeft,
originalRight,
testRelation1.where(IsNotNull('a)).subquery('left),
right,
Inner,
condition)
}
}

test("Constraints shouldn't be inferred from cast equality constraint(filter lower data type)") {
Expand Down