db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Manish Khettry (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-681) Eliminate the parser's rewriting of the abstract syntax tree for queries with GROUP BY and/or HAVING clauses
Date Wed, 22 Nov 2006 22:59:02 GMT
    [ http://issues.apache.org/jira/browse/DERBY-681?page=comments#action_12452071 ] 
            
Manish Khettry commented on DERBY-681:
--------------------------------------

I was looking at the query tree munging that we do in the GroupByNode and it seems that doing
something with the having clause should be possible. Basically we always put a ProjectRestrictNode
on top of a GroupByNode. It should be possible to rewrite the having clause and turn it into
a restriction of this ProjectRestrictNode. This rewriting of the query tree should be pretty
similar to DERBY-883. 

Is this what you mean by "handle the having clause in a starightforward way"? If anyone has
thought about this bug and have any ideas on this, please do share. I can work on this next--
it should help with atleast a couple of other bugs (DERBY-280 and DERBY-1624) but wanted to
check with others on the list before I start working on it.


> Eliminate the parser's rewriting of the abstract syntax tree for queries with GROUP BY
and/or HAVING clauses
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-681
>                 URL: http://issues.apache.org/jira/browse/DERBY-681
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Rick Hillegas
>
> If a query contains a GROUP BY or HAVING clause, the parser rewrites the abstract syntax
tree, putting aggregates into a subselect and treating the HAVING clause as the WHERE clause
of a fabricated outer select from the subquery. This allows the compiler to re-use some machinery
since the HAVING clause operates on the grouped result the way that the WHERE clause operates
on the from list. Unfortunately, this rewriting creates an explosion of special cases in the
compiler after parsing is done. The rewriting is not systematically handled later on in the
compiler. This gives rise to defects like bug 280. We need to eliminate this special rewriting
and handle the HAVING clause in a straightforward way. This is not a small bugfix but is a
medium sized project.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message