Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0.0
    • 3.0.0
    • SQL
    • None

    Description

      An aggregate expression represents the application of an aggregate function across the rows selected by a query. An aggregate function reduces multiple inputs to a single output value, such as the sum or average of the inputs. The syntax of an aggregate expression is one of the following:

      aggregate_name (expression [ , ... ] [ order_by_clause ] ) [ FILTER ( WHERE filter_clause ) ]
      aggregate_name (ALL expression [ , ... ] [ order_by_clause ] ) [ FILTER ( WHERE filter_clause ) ]
      aggregate_name (DISTINCT expression [ , ... ] [ order_by_clause ] ) [ FILTER ( WHERE filter_clause ) ]
      aggregate_name ( * ) [ FILTER ( WHERE filter_clause ) ]
      aggregate_name ( [ expression [ , ... ] ] ) WITHIN GROUP ( order_by_clause ) [ FILTER ( WHERE filter_clause ) ]

      https://www.postgresql.org/docs/current/sql-expressions.html#SYNTAX-AGGREGATES

       

      I find this feature is also an ANSI SQL standard. 

      <aggregate function> ::=
      COUNT <left paren> <asterisk> <right paren> [ <filter clause> ]
      | <general set function> [ <filter clause> ]
      | <binary set function> [ <filter clause> ]
      | <ordered set function> [ <filter clause> ]
      | <array aggregate function> [ <filter clause> ]
      | <row pattern count function> [ <filter clause> ]

      Attachments

        Issue Links

          Activity

            smilegator Xiao Li added a comment -
            smilegator Xiao Li added a comment - cc beliefer
            smilegator Xiao Li added a comment - There is a blog to describe this feature too.  https://blog.jooq.org/2014/12/30/the-awesome-postgresql-9-4-sql2003-filter-clause-for-aggregate-functions/
            beliefer Jiaan Geng added a comment -

            smilegator Thanks for your cc. I will take a look!

            beliefer Jiaan Geng added a comment - smilegator  Thanks for your cc. I will take a look!
            beliefer Jiaan Geng added a comment -

            I'm working.

            beliefer Jiaan Geng added a comment - I'm working.
            cloud_fan Wenchen Fan added a comment -

            Issue resolved by pull request 26656
            https://github.com/apache/spark/pull/26656

            cloud_fan Wenchen Fan added a comment - Issue resolved by pull request 26656 https://github.com/apache/spark/pull/26656

            People

              beliefer Jiaan Geng
              yumwang Yuming Wang
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: