[ 
https://issues.apache.org/jira/browse/CALCITE-3318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16929094#comment-16929094
 ] 

Soma Mondal commented on CALCITE-3318:
--------------------------------------

Hi [~danny0405],

After going through the code changes for implicit cast support CALCITE-2302 I 
have an approach regarding the same.

I’m thinking about adding ImplicitCoerceRules in SqlTypeAssignmentRules based 
on [Calcite Implicit Type Cast 
Design|https://docs.google.com/spreadsheets/d/1GhleX5h5W8-kJKh7NMJ4vtoE78pwfaZRJl88ULX_MgU/edit#gid=0]
 and refer that in SqlDialect#supportImplicitCast, and also using the 
coerceRules to validate the casting.

Kindly let me know your thoughts about this approach.

 

> Preserving CAST of STRING operands in comparison operator
> ---------------------------------------------------------
>
>                 Key: CALCITE-3318
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3318
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.20.0
>            Reporter: Soma Mondal
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> We have a REL which has this information
>  select * from employee where employee_id = cast('12' as float);
> but Calcite removes the CAST from the STRING literal('12' in our case). 
>  select * from employee where employee_id = '12';
> There are dialects which needs explicit casting in the above case and we need 
> to maintain the CAST in our dialect.
> Calcite removes the cast in SqlImplementor's stripCastFromString() method.
> I'm thinking of having the dialect intercept this and decide whether or not 
> to remove the cast.
>  
> I have created a PR [https://github.com/apache/calcite/pull/1437]



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to