[
https://issues.apache.org/jira/browse/CALCITE-4775?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17416420#comment-17416420
]
Xurenhe commented on CALCITE-4775:
----------------------------------
[~slinkydeveloper]
You are right.
`org.apache.calcite.sql.SqlOperator#rewriteCall` really works in stage of
validate, which is one of validator config.
I agree with you that using finer grained config to control rewriting of
`SqlCall`.
> 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)