You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "jamie12221 (Jira)" <ji...@apache.org> on 2020/09/13 01:58:00 UTC

[jira] [Created] (CALCITE-4255) Add vararg UDFs support in org.apache.calcite.schema.ScalarFunction

jamie12221 created CALCITE-4255:
-----------------------------------

             Summary: 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


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)