chucheng92 commented on code in PR #3705:
URL: https://github.com/apache/calcite/pull/3705#discussion_r1507357141
##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -6538,6 +6586,54 @@ void checkRegexpExtract(SqlOperatorFixture f0,
FunctionAlias functionAlias) {
"INTEGER is not comparable to BOOLEAN", false);
}
+ /** Test case for
+ * <a href="https://github.com/apache/calcite/pull/3705">[CALCITE-5976]
+ * Use explicit casting if inserted element type in
ArrayPrepend/ArrayAppend/ArrayInsert
+ * does not equal derived component type)</a>. */
+ @Test void testArrayPrependFuncByCast() {
Review Comment:
put it into the `testArrayPrependFunc`
##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -6810,6 +6904,31 @@ void checkRegexpExtract(SqlOperatorFixture f0,
FunctionAlias functionAlias) {
"(INTEGER NOT NULL, CHAR(1) NOT NULL) MAP NOT NULL ARRAY NOT NULL");
}
+ /** Test case for
+ * <a href="https://github.com/apache/calcite/pull/3705">[CALCITE-5976]
+ * Use explicit casting if inserted element type in
ArrayPrepend/ArrayAppend/ArrayInsert
+ * does not equal derived component type)</a>. */
+ @Test void testArrayInsertFuncByCast() {
Review Comment:
same problem.
##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorUtil.java:
##########
@@ -1375,6 +1376,14 @@ private static void adjustTypeForMultisetConstructor(
} else {
elementType = oddType;
}
+ if (call.getOperator().getName().equals("ARRAY_INSERT") && i == 1) {
Review Comment:
do not hard-code here.
--
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]