[
https://issues.apache.org/jira/browse/CALCITE-4255?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17195148#comment-17195148
]
Julian Hyde commented on CALCITE-4255:
--------------------------------------
Since the SQL standard does not allow overloaded UDFs, it's not clear to me
what should happen in the corner cases. I'd like to see a specification for how
this would work - i.e. some overloaded UDFs and their use in SQL statements,
perhaps called with arguments of inexact type - before people start submitting
code changes.
When I introduced SqlOperandMetadata in CALCITE-2082 I realized how different
UDFs are to built-in functions.
And yes, it probably is a duplicate.
> Add vararg UDFs support in org.apache.calcite.schema.ScalarFunction
> -------------------------------------------------------------------
>
> Key: CALCITE-4255
> URL: https://issues.apache.org/jira/browse/CALCITE-4255
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Affects Versions: 1.25.0
> Reporter: jamie12221
> Priority: Minor
>
> It looks like vararg does not to be supported.
> It uses the exact number of arguments to find the function.
> {code:java}
> org.apache.calcite.sql.SqlUtil#lookupSubjectRoutines
> public static Iterator<SqlOperator> lookupSubjectRoutines(
> SqlOperatorTable opTab,
> SqlIdentifier funcName,
> List<RelDataType> argTypes,
> List<String> argNames,
> SqlSyntax sqlSyntax,
> SqlKind sqlKind,
> SqlFunctionCategory category,
> SqlNameMatcher nameMatcher,
> boolean coerce) {
> // start with all routines matching by name
> Iterator<SqlOperator> routines =
> lookupSubjectRoutinesByName(opTab, funcName, sqlSyntax, category,
> nameMatcher);
> // first pass: eliminate routines which don't accept the given
> // number of arguments
> routines = filterRoutinesByParameterCount(routines, argTypes);
> // NOTE: according to SQL99, procedures are NOT overloaded on type,
> // only on number of arguments.
> if (category == SqlFunctionCategory.USER_DEFINED_PROCEDURE) {
> return routines;
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)