dssysolyatin commented on code in PR #2819:
URL: https://github.com/apache/calcite/pull/2819#discussion_r1001563447


##########
core/src/main/java/org/apache/calcite/sql/validate/implicit/AbstractTypeCoercion.java:
##########
@@ -721,4 +738,31 @@ boolean canImplicitTypeCast(List<RelDataType> types, 
List<SqlTypeFamily> familie
     }
     return null;
   }
+
+  /**
+   * Coerce STRING type to ARRAY type.
+   */
+  protected Boolean coerceStringToArray(
+      SqlCall call,
+      SqlNode operand,
+      int index,
+      RelDataType fromType,
+      RelDataType targetType) {
+    if (validator.config().conformance().allowCoercionStringToArray()
+        && SqlTypeUtil.isString(fromType)
+        && SqlTypeUtil.isArray(targetType)
+        && operand instanceof SqlCharStringLiteral
+    ) {
+      try {
+        SqlNode arrayValue = SqlParserUtil.parseArrayLiteral(
+            ((SqlCharStringLiteral) operand).getValueAs(String.class));
+        call.setOperand(index, arrayValue);
+        updateInferredType(arrayValue, targetType);
+      } catch (Throwable e) {
+        return false;

Review Comment:
   I managed to replace throwable by SqlParseException



-- 
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: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to