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

Francesco Guardiani commented on CALCITE-4775:
----------------------------------------------

As far as I see in calcite 1.26.0, the flag SqlValidator.Config.callRewrite() 
I'm referring to is accessed only in 
SqlValidatorImpl#performUnconditionalRewrites. When I try to parse a SELECT 
COALESCE(...), after the validation the query becomes SELECT CASE WHEN... 

Perhaps are you referring to another function call rewrite somewhere else?

> Fine grained tuning of call rewrite behaviour 
> ----------------------------------------------
>
>                 Key: CALCITE-4775
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4775
>             Project: Calcite
>          Issue Type: New Feature
>    Affects Versions: 1.26.0
>         Environment: Calcite 1.26
>            Reporter: Francesco Guardiani
>            Priority: Trivial
>
> In a Flink SQL PR [https://github.com/apache/flink/pull/17256] I've tried to 
> disable the call rewrite feature of Calcite parser to disable the rewrite of 
> COALESCE. The problem with this is that it creates a regression in other 
> components, since we rely on call rewrite for other sql features.
> Would it be possible to modify the sql call rewrite feature to pick (or 
> alternatively disable) which sql operator should be rewritten?
> For example, the SqlValidator.Config could take as parameter a list of 
> excludeCallRewrite
> SqlOperator classes, which can be checked later by the SqlValidatorImpl to 
> enable or disable a rewrite of a specific class:
> {code:java}
> SqlValidator.Config.DEFAULT
>      .withCallRewrite(true)
>      .withExcludedCallRewrite(SqlCoalesceFunction.class)
> {code}
> And then in SqlValidatorImpl:
> {code:java}
> if (config.callRewrite() && 
> !config.isCallRewriteExcluded(call.getOperator().getClass())) {
>     node = call.getOperator().rewriteCall(this, call);
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to