Dwrite commented on code in PR #5232:
URL: https://github.com/apache/calcite/pull/5232#discussion_r3934389105
##########
core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java:
##########
@@ -872,8 +872,11 @@ static SqlOperatorTable operatorTableFor(SqlLibrary
library) {
@Test void testConcatFails() {
wholeExpr("'a'||x'ff'")
.fails("(?s).*Cannot apply '\\|\\|' to arguments of type "
- + "'<CHAR.1.> \\|\\| <BINARY.1.>'.*Supported form.s.: "
- + "'<STRING> \\|\\| <STRING>.*'");
+ + "'<CHAR\\(1\\)> \\|\\| <BINARY\\(1\\)>'.*"
+ + "Supported form\\(s\\): "
+ + "'<CHARACTER> \\|\\| <CHARACTER>'\\s*"
+ + "'<BINARY> \\|\\| <BINARY>'\\s*"
+ + "'<EQUIVALENT_TYPE> \\|\\| <EQUIVALENT_TYPE>'.*");
Review Comment:
That <EQUIVALENT_TYPE> is the default placeholder from
SameOperandTypeChecker#getTypeName(). It shows up because ||'s checker
(STRING_SAME_SAME_OR_ARRAY_SAME_SAME) is an OR of two branches —
STRING_SAME_SAME (fixed in this PR) and and(SAME_SAME, family(ARRAY, ARRAY))
(untouched). That second branch has the same underlying issue:
CompositeOperandTypeChecker#getAllowedSignatures for AND compositions only
surfaces the first sub-rule's signature, so it shows SAME_SAME's generic
<EQUIVALENT_TYPE> placeholder instead of the more informative <ARRAY>.
I scoped this PR to the STRING-family checkers only, but I'm happy to extend
it and clean up the array branch as well, so || gets a fully accurate message
end to end. Let me know and I'll include it.
--
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]