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
Spark3: Support for LATERAL VIEW
clause
#2687
Merged
tunetheweb
merged 19 commits into
sqlfluff:main
from
R7L208:r7l208/spark3-lateral-view-clause
Feb 18, 2022
Merged
Changes from 16 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
42c656f
allow named argument to accept an iterable
R7L208 6db8772
updated to allow for LATERAL VIEW
R7L208 881e499
black
R7L208 c0eac1b
Merge branch 'main' into r7l208/spark3-lateral-view-clause
R7L208 73bf8e1
use OneOf instead of list for exclude
R7L208 977c544
Merge remote-tracking branch 'origin/r7l208/spark3-lateral-view-claus…
R7L208 d16f0be
use get_segment to define get_eventual_alias
R7L208 74a343d
remove unused imports
R7L208 2521c22
PR feedback
R7L208 cf8c1a7
black
R7L208 8e9aec8
Update src/sqlfluff/dialects/dialect_spark3.py
R7L208 4c394cc
remove AnyNumberOf AliasExpressionSegments
R7L208 493c3f8
Merge remote-tracking branch 'origin/r7l208/spark3-lateral-view-claus…
R7L208 4060c8c
black
R7L208 5a4f2ae
remove two invalid test cases and update LateralViewClauseSegment
R7L208 bf59a5a
refresh yml
R7L208 df79c58
updates to LateralViewClauseSegment
R7L208 6244857
excldue spark3 from L026 by default
R7L208 52d8fc9
black
R7L208 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
40 changes: 40 additions & 0 deletions
40
test/fixtures/dialects/spark3/select_from_lateral_view.sql
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
SELECT | ||
id, | ||
name, | ||
age, | ||
class, | ||
address, | ||
c_age, | ||
d_age | ||
FROM person | ||
LATERAL VIEW EXPLODE(ARRAY(30, 60)) tbl_name AS c_age | ||
LATERAL VIEW EXPLODE(ARRAY(40, 80)) AS d_age; | ||
|
||
SELECT | ||
c_age, | ||
COUNT(*) AS record_count | ||
FROM person | ||
LATERAL VIEW EXPLODE(ARRAY(30, 60)) AS c_age | ||
LATERAL VIEW EXPLODE(ARRAY(40, 80)) AS d_age | ||
GROUP BY c_age; | ||
|
||
SELECT | ||
id, | ||
name, | ||
age, | ||
class, | ||
address, | ||
c_age, | ||
d_age | ||
FROM person | ||
LATERAL VIEW EXPLODE(ARRAY()) tbl_name AS c_age; | ||
|
||
SELECT | ||
id, | ||
name, | ||
age, | ||
class, | ||
address, | ||
c_age | ||
FROM person | ||
LATERAL VIEW OUTER EXPLODE(ARRAY()) tbl_name AS c_age; |
Oops, something went wrong.
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.
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.
My read of the above link is this should be:
Is that so? And if so should we add a test case for multiple aliases?
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.
Sorry, not firing on all cylinders today.
Should be correct. I forgot to remove the optional clause. I'll add a case for multiple column aliases