caicancai commented on code in PR #3705:
URL: https://github.com/apache/calcite/pull/3705#discussion_r1506171264
##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorUtil.java:
##########
@@ -1326,6 +1327,34 @@ public static void adjustTypeForArrayConstructor(
}
}
+ /**
+ * When the array_append and array_prepend element does not equal the array
component type
+ * make explicit casting.
+ *
+ * @param componentType derived array component type
+ * @param opBinding description of call
+ */
+ public static void adjustTypeForArrayAppendPrependConstructor(
+ RelDataType componentType, RelDataType elementType, SqlOperatorBinding
opBinding) {
+ if (opBinding instanceof SqlCallBinding) {
+ requireNonNull(componentType, "array component type");
+ switch (elementType.getSqlTypeName().getName()) {
+ case "DOUBLE":
+ case "FLOAT":
+ case "BIGINT":
+ adjustTypeForMultisetConstructor3(
+ elementType, elementType, (SqlCallBinding) opBinding);
+ break;
+ default:
+ if (!componentType.getSqlTypeName().getName().equals("UNKNOWN")) {
Review Comment:
If it is an unknown type, no conversion is required.
--
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]