[
https://issues.apache.org/jira/browse/CALCITE-6550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17878247#comment-17878247
]
Norman Jordan commented on CALCITE-6550:
----------------------------------------
[~caicancai] I see that you have a way of handling different dialects for the
LOG function. You use a class to do the LOG evaluation. You are passing in the
library to the class, so it can choose the right behaviour.
Are you suggesting simplifying this so that you could use a method rather than
a class?
> Improve SQL function overloading
> --------------------------------
>
> Key: CALCITE-6550
> URL: https://issues.apache.org/jira/browse/CALCITE-6550
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: Norman Jordan
> Assignee: Norman Jordan
> Priority: Minor
>
> All SQL functions across all SQL libraries as well as the standard functions
> are used as keys in a Map (in the class {*}RexImpTable{*}). The hashcode and
> equals methods currently only look at the name, kind and class.
> [https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/SqlOperator.java#L424]
> [https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/SqlOperator.java#L439]
> This causes a few problems:
> * Some functions may have the same name and kind but different sets of
> parameters
> * Two different SQL libraries may have functions with the same name and kind
> (and even parameters) but have different implementations.
> The current work around is to create new anonymous classes when needed to
> avoid collisions in the Map. Here is an example.
> https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java#L578
> The hashcode and equals methods should consider more information, such as the
> parameters as well as some way to differentiate similar functions in
> different libraries.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)