[ 
https://issues.apache.org/jira/browse/DERBY-3002?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12714542#action_12714542
 ] 

Knut Anders Hatlen commented on DERBY-3002:
-------------------------------------------

I think the results in your examples without rollup are correct. At least I see 
the same same results when I try the statements in PostgreSQL. When you have 
GROUP BY and no rows in the table, there are no groups, so the result should be 
empty.

The wiki page says that a rollup query is semantically equivalent to a union 
where the last subquery in the union has no group by. I think this means that 
this query

  SELECT a, count(*) FROM T GROUP BY ROLLUP(a)

should be equivalent to

  SELECT a, COUNT(*) FROM T GROUP BY (a)
    UNION
  SELECT NULL, COUNT(*) FROM T

Since SELECT NULL, COUNT(*) FROM T always returns one row, the union query 
should always return at least one row.

> Add support for GROUP BY ROLLUP
> -------------------------------
>
>                 Key: DERBY-3002
>                 URL: https://issues.apache.org/jira/browse/DERBY-3002
>             Project: Derby
>          Issue Type: New Feature
>          Components: SQL
>    Affects Versions: 10.4.1.3
>            Reporter: Bryan Pendleton
>            Assignee: Bryan Pendleton
>            Priority: Minor
>         Attachments: fixWhiteSpace.diff, IncludesASimpleTest.diff, 
> prototypeChangeNoTests.diff, rollupNullability.diff, useLookahead.diff
>
>
> Provide an implementation of the ROLLUP form of multi-dimensional grouping 
> according to the SQL standard.
> See http://wiki.apache.org/db-derby/OLAPRollupLists for some more detailed 
> information about this aspect of the SQL standard.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to