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

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

Hi Bryan,

fixWhiteSpace.diff looks like a fine first increment. I only have some minor 
comments:

a) There are still some whitespace issues (too much indentation) in some of the 
files. Looking at the patch with "expand -t4 fixWhiteSpace.diff | less" should 
make them easy to spot.

b) I haven't checked what the standard says, so my expectation may be wrong, 
but I'd expect a different result from a query like this (using the RU table 
from the test case in OLAPTest):

ij> select a, count(*) from ru where 1<>1 group by rollup(a);
A          |2          
-----------------------

0 rows selected

My expectation is that this query should return one row: {null, 0}.

c) I think the lookahead needs to check for getToken(1).kind == ROLLUP in 
addition to the check for getToken(2). The current lookahead breaks some 
statements.

Without patch:

ij> select count(*) from ru group by mod(a,b);
1          
-----------
3          
2          

2 rows selected

With patch:

ij> select count(*) from ru group by mod(a,b);
ERROR 42X01: Syntax error: Encountered "mod" at line 1, column 34.

d) The result set meta-data gets the nullability for the GROUP BY columns 
wrong. For example, in the query below, the meta-data says that all the columns 
are non-nullable, but the result does contain nulls:

ij> select 1,2,3,count(d) from ru group by rollup(1,2,3);
1          |2          |3          |4          
-----------------------------------------------
1          |2          |3          |5          
1          |2          |NULL       |5          
1          |NULL       |NULL       |5          
NULL       |NULL       |NULL       |5          

4 rows selected

> 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, 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