You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2019/05/28 22:08:00 UTC

[jira] [Updated] (CALCITE-3097) GROUPING SETS breaks on sets of size > 1 due to precedence issues

     [ https://issues.apache.org/jira/browse/CALCITE-3097?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Hyde updated CALCITE-3097:
---------------------------------
    Fix Version/s: 1.20.0

> GROUPING SETS breaks on sets of size > 1 due to precedence issues
> -----------------------------------------------------------------
>
>                 Key: CALCITE-3097
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3097
>             Project: Calcite
>          Issue Type: Bug
>          Components: jdbc-adapter
>            Reporter: Steven Talbot
>            Priority: Major
>             Fix For: 1.20.0
>
>
> Easiest to explain in a test. The test on current master fails, with relevant part of the parsed and unparsed query turning into something like `GROUP BY GROUPING SETS("product_class_id", "brand_name", "product_class_id")`, incorrectly flattening the sub lists of group sets into one long list.
> {code:java}
> /** Tests that GROUPING SETS parse and unparse properly, especially that they maintain proper precedence
>  * around nested lists. */
> @Test public void testGroupByGroupingSets() {
>  final String query = "select \"product_class_id\", \"brand_name\"\n"
>  + "from \"product\"\n"
>  + "group by GROUPING SETS ((\"product_class_id\", \"brand_name\"), (\"product_class_id\"))\n"
>  + "order by 2, 1";
>  final String expected = "SELECT \"product_class_id\", \"brand_name\"\n" +
>  "FROM \"foodmart\".\"product\"\n" +
>  "GROUP BY GROUPING SETS((\"product_class_id\", \"brand_name\"), (\"product_class_id\"))\n" +
>  "ORDER BY \"brand_name\", \"product_class_id\"";
>  sql(query)
>  .withPostgresql()
>  .ok(expected);
> }{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)