Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hive/Spark Multiple Insert Clause Parse Failure #5866

Open
2 of 3 tasks
reata opened this issue May 12, 2024 · 0 comments
Open
2 of 3 tasks

Hive/Spark Multiple Insert Clause Parse Failure #5866

reata opened this issue May 12, 2024 · 0 comments
Labels
bug Something isn't working hive Issue relating to the Apache Hive dialect

Comments

@reata
Copy link
Contributor

reata commented May 12, 2024

Search before asking

  • I searched the issues and found no similar issues.

What Happened

sqlfluff hive and sparksql dialect failed to parse below sql:

FROM tab1
INSERT INTO TABLE tab2 SELECT * FROM tab1 WHERE flag=2
INSERT INTO TABLE tab3 SELECT * FROM tab1 WHERE flag=3

Hive Language Manual: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DML#LanguageManualDML-Syntax.1

SparkSQL doesn't document this feature. However based on its antrl g4 file, it's also supported: https://github.com/apache/spark/blob/v3.5.1/sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseParser.g4#L444

Expected Behaviour

SQL to be successfully parsed.

Observed Behaviour

==== parsing violations ====
L: 1 | P: 1 | PRS | Line 1, Position 1: Found unparsable section: 'FROM tab1\nINSERT
| INTO TABLE tab2 SELECT ...'

How to reproduce

sqlfluff parse --dialect=hive test.sql
sqlfluff parse --dialect=sparksql test.sql

Dialect

hive and sparksql

Version

3.0.6

Configuration

default one

Are you willing to work on and submit a PR to address the issue?

  • Yes I am willing to submit a PR!

Code of Conduct

@reata reata added the bug Something isn't working label May 12, 2024
@github-actions github-actions bot added the hive Issue relating to the Apache Hive dialect label May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hive Issue relating to the Apache Hive dialect
Projects
None yet
Development

No branches or pull requests

1 participant