Skip to content

Commit

Permalink
Bring back IS DISTINCT FROM join pushdown testing
Browse files Browse the repository at this point in the history
  • Loading branch information
losipiuk committed May 14, 2024
1 parent d892919 commit e029973
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1213,12 +1213,11 @@ public void testJoinPushdown()
.setSystemProperty("enable_dynamic_filtering", "false")
.build();

String notDistinctOperator = "IS NOT DISTINCT FROM";
List<String> nonEqualities = Stream.concat(
Stream.of(JoinCondition.Operator.values())
.filter(operator -> operator != JoinCondition.Operator.EQUAL && operator != JoinCondition.Operator.IDENTICAL)
.map(JoinCondition.Operator::getValue),
Stream.of(notDistinctOperator))
Stream.of("IS DISTINCT FROM", "IS NOT DISTINCT FROM"))
.collect(toImmutableList());

// basic case
Expand Down Expand Up @@ -1410,7 +1409,7 @@ protected void assertConditionallyOrderedPushedDown(

protected boolean expectJoinPushdown(String operator)
{
if ("IS NOT DISTINCT FROM".equals(operator)) {
if ("IS DISTINCT FROM".equals(operator)) {
return hasBehavior(SUPPORTS_JOIN_PUSHDOWN_WITH_DISTINCT_FROM);
}
return switch (toJoinConditionOperator(operator)) {
Expand All @@ -1427,7 +1426,7 @@ protected boolean expectJoinPushdownOnInequalityOperator(JoinOperator joinOperat

private boolean expectVarcharJoinPushdown(String operator)
{
if ("IS NOT DISTINCT FROM".equals(operator)) {
if ("IS DISTINCT FROM".equals(operator)) {
return hasBehavior(SUPPORTS_JOIN_PUSHDOWN_WITH_DISTINCT_FROM) && hasBehavior(SUPPORTS_JOIN_PUSHDOWN_WITH_VARCHAR_EQUALITY);
}
return switch (toJoinConditionOperator(operator)) {
Expand All @@ -1439,6 +1438,9 @@ private boolean expectVarcharJoinPushdown(String operator)

private JoinCondition.Operator toJoinConditionOperator(String operator)
{
if (operator.equals("IS NOT DISTINCT FROM")) {
return JoinCondition.Operator.IDENTICAL;
}
return Stream.of(JoinCondition.Operator.values())
.filter(joinOperator -> joinOperator.getValue().equals(operator))
.collect(toOptional())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,12 +601,11 @@ public void testStringJoinPushdownWithCollate()
.setCatalogSessionProperty("postgresql", "enable_string_pushdown_with_collate", "true")
.build();

String notDistinctOperator = "IS NOT DISTINCT FROM";
List<String> nonEqualities = Stream.concat(
Stream.of(JoinCondition.Operator.values())
.filter(operator -> operator != JoinCondition.Operator.EQUAL && operator != JoinCondition.Operator.IDENTICAL)
.map(JoinCondition.Operator::getValue),
Stream.of(notDistinctOperator))
Stream.of("IS DISTINCT FROM", "IS NOT DISTINCT FROM"))
.collect(toImmutableList());

try (TestTable nationLowercaseTable = new TestTable(
Expand Down

0 comments on commit e029973

Please sign in to comment.