Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-8989

Support aggregations in HAVING clause

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Not A Problem
    • Affects Version/s: 1.4.0
    • Fix Version/s: None
    • Component/s: SQL
    • Labels:

      Description

      It seems like query of the type

      SELECT keys, id, value FROM table GROUP BY keys HAVING max(value) = value

      Are not working or supported (I selected issue type enhancement under the assumption it's the latter). The use case is very natural, for each group find the record attaining the maximum for a certain row-dependent expression, and return any selection of fields from that row together with the grouping keys. I know how to work around this with a join, but it's a considerably more involved query and therefore I thought worth asking if this is my misunderstanding, a shortcoming in the implementation of HAVING, a nice-to-have but not really on the road map or "that's crazy what kind of rotten database would accept this nonsense?" (by the way, I think PostgresSQL does; not sure how many other DBs do)

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              piccolbo Antonio Piccolboni
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: