Francesco Guardiani created CALCITE-5017:
--------------------------------------------

             Summary: SqlTypeUtil#canCastFrom is hard to extend for downstream 
projects
                 Key: CALCITE-5017
                 URL: https://issues.apache.org/jira/browse/CALCITE-5017
             Project: Calcite
          Issue Type: Wish
            Reporter: Francesco Guardiani


Hi all,
In Flink SQL we're extending the matrix of supported casting pairs beyond what 
Calcite provides and we hit a roadblock when dealing with 
{{SqlTypeUtil#canCastFrom}}. Note that we also have a couple of types more than 
what Calcite provides

The problem of this function is:

* It's hardcoded for structured types, so we can't essentially change anything 
about those
* The {{SqlTypeMappingRule}} is not flexible enough, as it doesn't allow 
matching types with parameters, but just type name pairs.

As a workaround, we're overriding `SqlCastFunction` in our classpath, invoking 
our custom cast checking logic: 
https://github.com/apache/flink/pull/18524/files#diff-8c1c5cdfd4ee1de9d54fd39db308ab1d7fa9fddb2db1e36cdd1c9b0b8fc90f4bR161
 

It would be nice if somehow this function can be extended with some custom 
predicates.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to