GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add support for Hive dialect GROUPING SETS. by qzchenwl · Pull Request #1539 · JSQLParser/JSqlParser

Conversation

@qzchenwl

@qzchenwl qzchenwl commented May 19, 2022

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@qzchenwl
Add support for Hive GROUPING SETS dialect `GROUP BY a, b, c GROUPING…
db46fa3
… SETS ((a, b), (a, c))`
@qzchenwl
qzchenwl force-pushed the master branch from 7d162dd to db46fa3 Compare May 19, 2022 13:10
wumpz
wumpz requested changes May 19, 2022
View reviewed changes
Comment thread src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt
<K_GROUP> <K_BY>
( LOOKAHEAD(2) (
"(" ")" { groupBy.withUsingBrackets(true); }
(

@wumpz wumpz May 19, 2022

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/test/java/net/sf/jsqlparser/statement/select/HiveTest.java Outdated
+ " Sometable\n"
+ "GROUP BY C1, C2, C3 GROUPING SETS ((C1, C2), (C1, C2, C3), ())";

statement = CCJSqlParserUtil.parse(sql);

@wumpz wumpz May 19, 2022

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@wumpz

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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@qzchenwl

qzchenwl commented May 20, 2022

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, ( ) ).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

wumpz commented Jun 8, 2022

Copy link
Copy Markdown
Member

Could you change the test method, like I requested?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@qzchenwl
Simplify HiveTest::testGroupByGroupingSets.
6e40662
@qzchenwl

qzchenwl commented Jun 23, 2022

Copy link
Copy Markdown
Contributor Author

Could you change the test method, like I requested?

The test method is changed now.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@qzchenwl
Merge branch 'JSQLParser:master' into master
85aa098
@wumpz
wumpz merged commit 03c58de into JSQLParser:master Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@wumpz wumpz Awaiting requested review from wumpz

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@qzchenwl @wumpz @manticore-projects
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.