[Mondrian] Parenthesized queries in UNION

damien hostin damien.hostin at axege.com
Tue Dec 4 08:08:13 EST 2012


I had the same issue with postgresql when I ran the regression tests 
last week. This commit should also fix postgresql union queries.

Damien Hostin

Le 04/12/2012 13:45, Tiago Ferreira a écrit :
> I put the parenthesis because MySQL wasn't accepting the order by in 
> the first select. It was far from a good solution but seemed slightly 
> better than before and allowed to test for more issues on multiple 
> measure groups.
>
> Meanwhile I made it output only one order by for the whole union as 
> you suggest. Before it was not just generating an order by for each 
> select, but the last one would have two, both by column name and by 
> ordinal. Now it only does the ordinal order for unions
>
> It's one of the commits in the last pull request I made:
>
> https://github.com/webdetails/mondrian/commit/e37cc17f6a112da3639e5591c5a7de193c368766
>
> From what I tested it runs ok in MySQL, Hypersonic and Oracle.
>
> On 4 December 2012 07:04, Julian Hyde <jhyde at pentaho.com 
> <mailto:jhyde at pentaho.com>> wrote:
>
>     By the way, this was the commit:
>     https://github.com/pentaho/mondrian/commit/8837434cc059a0023da25288abfe5e9ec21f38fc.
>
>     Julian
>
>     On Dec 3, 2012, at 10:44 PM, Julian Hyde <jhyde at pentaho.com
>     <mailto:jhyde at pentaho.com>> wrote:
>
>     > Tiago,
>     >
>     > What was the error that made you make the following change, and
>     on what database?
>     >
>     > Before your change, the code used to generate
>     >
>     > SELECT ... ORDER BY UNION SELECT ... ORDER BY
>     >
>     > and after your change generates
>     >
>     > (SELECT ... ORDER BY) UNION (SELECT ... ORDER BY)
>     >
>     > ORDER BY inside a subquery is illegal per the SQL standard (and
>     as it happens makes MongoDB's parser barf), so I wonder if that
>     was the real problem you were facing. I am fixing it to generate
>     >
>     >  (SELECT ...) UNION (SELECT ...) ORDER BY
>     >
>     > and, since simpler is better, I wonder if I could go one step
>     further and generate
>     >
>     >  SELECT ... UNION SELECT ... ORDER BY
>     >
>     > To help me decide, it would help to know why you added the
>     parentheses in the first place.
>     >
>     > Julian
>     > _______________________________________________
>     > Mondrian mailing list
>     > Mondrian at pentaho.org <mailto:Mondrian at pentaho.org>
>     > http://lists.pentaho.org/mailman/listinfo/mondrian
>
>
>
>
> -- 
> Tiago G.F.
>
>
>
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20121204/b05f6bc4/attachment-0001.html 


More information about the Mondrian mailing list