mihaibudiu commented on code in PR #5187:
URL: https://github.com/apache/calcite/pull/5187#discussion_r3800677218
##########
core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java:
##########
@@ -1043,6 +1025,43 @@ void testDyadicCollateOperator() {
.fails("Parameters must be of the same type");
}
+ /** Test case for <a
href="https://issues.apache.org/jira/browse/CALCITE-7724">
Review Comment:
this comment is too long; please do not submit useless comments, they will
take time from reviewers not and forever when they will be read
##########
core/src/main/java/org/apache/calcite/sql/SqlUtil.java:
##########
@@ -558,9 +519,16 @@ public static SqlLiteral
concatenateLiterals(List<SqlLiteral> lits) {
private static Iterator<SqlOperator> filterOperatorRoutinesByKind(
Iterator<SqlOperator> routines, final SqlKind sqlKind) {
+ // Map both sides through getFunctionKind() so a candidate can still match
a call
Review Comment:
this comment could be shorter
##########
core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java:
##########
@@ -1043,6 +1025,43 @@ void testDyadicCollateOperator() {
.fails("Parameters must be of the same type");
}
+ /** Test case for <a
href="https://issues.apache.org/jira/browse/CALCITE-7724">
+ * [CALCITE-7724] SqlUtil#lookupSubjectRoutines rejects a valid operator
when two
+ * operator-table entries resolve to the same operator and that operator's
+ * {@link SqlKind} is remapped by {@link SqlKind#getFunctionKind()}</a>.
+ *
+ * <p>{@link SqlUtil#lookupSubjectRoutines} only reaches its "fourth pass"
+ * ({@code filterOperatorRoutinesByKind}) once at least two candidate
operators survive
+ * the earlier passes - which happens whenever an operator table (or a chain
of them)
+ * contains more than one entry for the same operator name, arity and
category, e.g.
+ * because it is registered in two different operator tables that get
chained together.
+ * That pass compares {@code candidate.getKind().getFunctionKind()} (mapped)
against the
+ * call's already-bound, unmapped {@code SqlKind} - for any {@link SqlKind}
that
+ * {@code getFunctionKind()} maps to something else (such as {@link
SqlKind#POSITION} or
+ * the now-dedicated {@link SqlKind#CHAR_LENGTH}, both mapped to
+ * {@link SqlKind#OTHER_FUNCTION}), this comparison fails even when the
candidate is the
+ * operator the call is already bound to - eliminating every candidate and
causing a
+ * spurious "No match found for function signature" validation error for an
otherwise
+ * perfectly valid call. */
+ @Test void testFunctionKindMismatchWithDuplicateOperatorTableEntry() {
+ // Chaining the standard operator table with itself is a minimal way to
force two
Review Comment:
Enough to say that each function will appear twice
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]