FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add support for Hive dialect GROUPING SETS. by qzchenwl · Pull Request #1539 · JSQLParser/JSqlParser · GitHub

Add support for Hive dialect GROUPING SETS. - #1539

Merged
wumpz merged 3 commits into
JSQLParser:masterfrom
qzchenwl:master
Jul 6, 2022
Merged

Add support for Hive dialect GROUPING SETS.#1539
wumpz merged 3 commits into
JSQLParser:masterfrom
qzchenwl:master

Conversation

Copy link
Copy Markdown
Contributor

Hive dialect requires all columns appear in GROUPING SETS clause to be in GROUP BY clause.

SELECT a, b, SUM( c ) FROM tab1 GROUP BY a, b GROUPING SETS ( (a, b), a, b, ( ) )

<K_GROUP> <K_BY>
( LOOKAHEAD(2) (
"(" ")" { groupBy.withUsingBrackets(true); }
(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Could you more compress this production? There are three nearly identical copies of this inserted block.

+ " Sometable\n"
+ "GROUP BY C1, C2, C3 GROUPING SETS ((C1, C2), (C1, C2, C3), ())";

statement = CCJSqlParserUtil.parse(sql);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This hole parsing process is done using assertSqlCanBeParsedAndDeparsed. So you could skip it.

wumpz commented May 19, 2022

Copy link
Copy Markdown
Member

I still do not get the difference to our current grouping sets variant. Could you explain more specific what you want to achieve?

Copy link
Copy Markdown
Contributor Author

JsqlParser could not parse SELECT a, b, SUM( c ) FROM tab1 GROUP BY a, b GROUPING SETS ( (a, b), a, b, ( ) ), it's a legal Hive statement.

It's an equivalent of Presto's SELECT a, b, SUM( c ) FROM tab1 GROUP BY GROUPING SETS ( (a, b), a, b, ( ) ).

qzchenwl requested a review from wumpz May 23, 2022 06:18

wumpz commented Jun 8, 2022

Copy link
Copy Markdown
Member

Could you change the test method, like I requested?

Copy link
Copy Markdown
Contributor Author

Could you change the test method, like I requested?

The test method is changed now.

wumpz merged commit 03c58de into JSQLParser:master Jul 6, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL