[
https://issues.apache.org/jira/browse/CALCITE-6550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17878277#comment-17878277
]
Caican Cai commented on CALCITE-6550:
-------------------------------------
[~njordan] Of course, I just haven't thought of a suitable solution yet. I once
thought that SqlLibrary should be passed into Sqlfuntions.class as a flag, but
Julian doesn't want SqlFunctions.class to pass in the SqlLibrary keyword.
If you have a suitable solution, I'd be happy to try it.
> 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)