Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-300

Support multiple parameters in count(distinct col1, col2, ..)

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.9.0-incubating
    • Component/s: None
    • Labels:

      Description

      Currently for sql like – select count(distinct seller_id, lstg_format_name) from test_kylin_fact

      Will result –
      org.eigenbase.sql.validate.SqlValidatorException <init>
      SEVERE: org.eigenbase.sql.validate.SqlValidatorException: Invalid number of arguments to function 'COUNT'. Was expecting 1 arguments

      Could optiq support multiple parameters in count(distinct ...) ?

      ---------------- Imported from GitHub ----------------
      Url: https://github.com/julianhyde/optiq/issues/300
      Created by: liyang-gmt8
      Labels: enhancement,
      Created at: Thu Jun 12 12:00:44 CEST 2014
      State: open

        Activity

        Hide
        julianhyde Julian Hyde added a comment -

        Close issues resolved in release 0.9.0-incubating (2014-08-25).

        Show
        julianhyde Julian Hyde added a comment - Close issues resolved in release 0.9.0-incubating (2014-08-25).
        Hide
        julianhyde Julian Hyde added a comment -

        Agreed. The spelling is misleading. I'll correct shortly.

        Show
        julianhyde Julian Hyde added a comment - Agreed. The spelling is misleading. I'll correct shortly.
        Hide
        vladimirsitnikov Vladimir Sitnikov added a comment -

        Please check the spelling: notNullArgList vs nullableArgs.
        I think the local variable should be named nullableArgList or nullableArgs.

        Show
        vladimirsitnikov Vladimir Sitnikov added a comment - Please check the spelling: notNullArgList vs nullableArgs . I think the local variable should be named nullableArgList or nullableArgs .
        Hide
        julianhyde Julian Hyde added a comment -

        I believe it is correct. We eliminate the NOT NULL args because they have no chance of making the COUNT skip a row. For example, COUNT(nullable, notNullable) is equivalent to COUNT(nullable). And COUNT(notNullable) is equivalent to COUNT() (written in SQL as COUNT( * )).

        Show
        julianhyde Julian Hyde added a comment - I believe it is correct. We eliminate the NOT NULL args because they have no chance of making the COUNT skip a row. For example, COUNT(nullable, notNullable) is equivalent to COUNT(nullable) . And COUNT(notNullable) is equivalent to COUNT() (written in SQL as COUNT( * ) ).
        Hide
        vladimirsitnikov Vladimir Sitnikov added a comment - - edited
        core/src/main/java/org/eigenbase/rex/RexBuilder.java
        +      final List<Integer> notNullArgList =
        +          nullableArgs(aggCall.getArgList(), aggArgTypes);
        

        This looks odd. Are you looking for nullable or NOT null arguments?

        Show
        vladimirsitnikov Vladimir Sitnikov added a comment - - edited core/src/main/java/org/eigenbase/rex/RexBuilder.java + final List<Integer> notNullArgList = + nullableArgs(aggCall.getArgList(), aggArgTypes); This looks odd. Are you looking for nullable or NOT null arguments?
        Show
        julianhyde Julian Hyde added a comment - Fixed in https://git-wip-us.apache.org/repos/asf?p=incubator-optiq.git;a=commit;h=4f80e6424db2054a9163f2f96331d23acd7a4735 .
        Hide
        julianhyde Julian Hyde added a comment -

        I'll try to get to this in the next 2 or 3 weeks.

        Show
        julianhyde Julian Hyde added a comment - I'll try to get to this in the next 2 or 3 weeks.
        Hide
        liyang.gmt8@gmail.com liyang added a comment -

        Any estimate on when this will be resolved?

        Show
        liyang.gmt8@gmail.com liyang added a comment - Any estimate on when this will be resolved?
        Hide
        github-import GitHub Import added a comment -

        [Date: Thu Jun 12 18:48:03 CEST 2014, Author: julianhyde]

        I agree that this would be a useful feature. (I first saw it in MySQL - one of the few of MySQL's "extensions" to SQL that I actually think is useful.) And by the way it should work with or without DISTINCT.

        Show
        github-import GitHub Import added a comment - [Date: Thu Jun 12 18:48:03 CEST 2014, Author: julianhyde ] I agree that this would be a useful feature. (I first saw it in MySQL - one of the few of MySQL's "extensions" to SQL that I actually think is useful.) And by the way it should work with or without DISTINCT.

          People

          • Assignee:
            Unassigned
            Reporter:
            github-import GitHub Import
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development