Support for lateral view explode clause
See original GitHub issuegetting error when trying to get the tables for sql below,
sql = """
WITH uisd_filter_table as (
select
session_id,
srch_id,
srch_ci,
srch_co,
srch_los,
srch_sort_type,
impr_list
from
uisd
where
datem <= date_sub(date_add(current_date(), 92), 7 * 52)
and lower(srch_sort_type) in ('expertpicks', 'recommended')
and srch_ci <= date_sub(date_add(current_date(), 92), 7 * 52)
and srch_co >= date_sub(date_add(current_date(), 1), 7 * 52)
)
select
DISTINCT session_id,
srch_id,
srch_ci,
srch_co,
srch_los,
srch_sort_type,
l.impr_property_id as expe_property_id,
l.impr_position_across_pages
from
uisd_filter_table lateral view explode(impr_list) table as l
"""
How to reproduce the error:
p = Parser(sql)
print(p.tables)
Error:
Traceback (most recent call last):
File "/Users/asalam/vscode/new/source_analyser/utils.py", line 152, in <module>
print(p.tables)
File "/Users/asalam/Library/Python/3.8/lib/python/site-packages/sql_metadata/parser.py", line 398, in tables
with_names = self.with_names
File "/Users/asalam/Library/Python/3.8/lib/python/site-packages/sql_metadata/parser.py", line 544, in with_names
if token.next_token.normalized in WITH_ENDING_KEYWORDS:
AttributeError: 'NoneType' object has no attribute 'normalized'
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
LATERAL VIEW Clause - Spark 3.3.1 Documentation
The LATERAL VIEW clause is used in conjunction with generator functions such as EXPLODE , which will generate a virtual table containing one...
Read more >Hive Lateral View Explode with where clause - what runs first
I am trying to understand if WHERE clause runs after or before with LATERAL VIEW EXPLODE in hive. For example if I have...
Read more >LATERAL VIEW clause | Databricks on AWS
Used in conjunction with generator functions such as EXPLODE , which generates a virtual table containing one or more rows. LATERAL VIEW ......
Read more >Hive Explode / Lateral View clarification - Cloudera Community
A lateral view first applies the UDTF to each row of base table and then joins resulting output rows to the input rows...
Read more >LATERAL VIEW clause - Azure Databricks - Microsoft Learn
Used in conjunction with generator functions such as EXPLODE , which generates a virtual table containing one or more rows. LATERAL VIEW ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@abecus The original bug was resolved but the tables still will return wrong data as the lateral view explode is not yet supported. Therefore I changed the name and label of this issue.
Tricky one. Then comes the question if we should for instance support PIVOT as well?
Let’s deal with this one in a separate PR / GitHub discussions thread.