You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "yuemeng (JIRA)" <ji...@apache.org> on 2017/06/08 13:09:18 UTC

[jira] [Commented] (CALCITE-1833) SqlAggFunction need new constructor to set paramTypes not be null for support multiple parameters for udaf

    [ https://issues.apache.org/jira/browse/CALCITE-1833?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16042666#comment-16042666 ] 

yuemeng commented on CALCITE-1833:
----------------------------------


 private static Iterator<SqlOperator> filterRoutinesByParameterType(
      SqlSyntax syntax,
      final Iterator<SqlOperator> routines,
      final List<RelDataType> argTypes, final List<String> argNames) {
    if (syntax != SqlSyntax.FUNCTION) {
      return routines;
    }

    //noinspection unchecked
    return (Iterator) Iterators.filter(
        Iterators.filter(routines, SqlFunction.class),
        new PredicateImpl<SqlFunction>() {
          public boolean test(SqlFunction function) {
            List<RelDataType> paramTypes = function.getParamTypes();
            if (paramTypes == null) {
              // no parameter information for builtins; keep for now
              return true;
            }
becasue of function is SqlUserDefinedAggFunction instance ,the result of  function.getParamTypes() will always null,so it filters noting by filterRoutinesByParameterType function

> SqlAggFunction need new constructor to set paramTypes not be null for support multiple parameters for udaf
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-1833
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1833
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.12.0
>            Reporter: yuemeng
>            Assignee: Julian Hyde
>            Priority: Blocker
>
> If we implement a function which is subclass of AggregateFunction,that function will be transform to SqlUserDefinedAggFunction in CalciteCatalogReader.
> all parametesTypes information contain by that funcion ,But that function only as an instance in SqlUserDefinedAggFunction .when construct the SqlUserDefinedAggFunction  instance will set paramTypes to null for super class sqlFunction indirectly.
> The problem is:
> we will  get SqlUserDefinedAggFunction paramTypes to sql validatefilte,but it will be filter nothing 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)