Skip to content

Commit

Permalink
RexUtil and CompositeSingleOperandTypeChecker
Browse files Browse the repository at this point in the history
  • Loading branch information
snuyanzin committed Feb 2, 2024
1 parent d6e965d commit d0ef4f2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,14 @@

import static java.util.Objects.requireNonNull;

/** Utility methods concerning row-expressions. */
/**
* Default implementation of {@link org.apache.calcite.rex.RexUtil}, the class was copied over
* because of current Calcite way of inferring constants from IS NOT DISTINCT FROM clashes with
* filter push down.
*
* <p>Lines 397 ~ 399, Use Calcite 1.32.0 behavior for {@link RexUtil#gatherConstraints(Class,
* RexNode, Map, Set, RexBuilder)}.
*/
public class RexUtil {

/** Executor for a bit of constant reduction. The user can pass in another executor. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
import org.checkerframework.checker.nullness.qual.Nullable;

/**
* Allows multiple {@link org.apache.calcite.sql.type.SqlSingleOperandTypeChecker} rules to be
* combined into one rule.
* Default implementation of {@link org.apache.calcite.sql.type.CompositeOperandTypeChecker}, the
* class was copied over because of current Calcite issue CALCITE-5380.
*
* <p>Lines 73 ~ 79, 101 ~ 107
*/
public class CompositeSingleOperandTypeChecker extends CompositeOperandTypeChecker
implements SqlSingleOperandTypeChecker {
Expand Down Expand Up @@ -68,10 +70,12 @@ public boolean checkSingleOperandType(

for (SqlSingleOperandTypeChecker rule : rules) {
if (!rule.checkSingleOperandType(
// FLINK MODIFICATION BEGIN
callBinding,
node,
rule.getClass() == FamilyOperandTypeChecker.class ? 0 : iFormalOperand,
throwOnAndFailure)) {
// FLINK MODIFICATION END
typeErrorCount++;
}
}
Expand All @@ -94,11 +98,13 @@ public boolean checkSingleOperandType(
// describing in more detail what the problem was, hence doing the
// loop again.
for (SqlSingleOperandTypeChecker rule : rules) {
// FLINK MODIFICATION BEGIN
rule.checkSingleOperandType(
callBinding,
node,
rule.getClass() == FamilyOperandTypeChecker.class ? 0 : iFormalOperand,
true);
// FLINK MODIFICATION END
}

// If no exception thrown, just throw a generic validation signature
Expand Down

0 comments on commit d0ef4f2

Please sign in to comment.