reata / sqllineage

SQL Lineage Analysis Tool powered by Python
MIT License
1.35k stars 241 forks source link

Qualify Clause Parsing Failure #625

Closed bishaljoshi08 closed 5 months ago

bishaljoshi08 commented 5 months ago

Issue: Qualify Clause Parsing Failure in sqllineage

The current sqllineage package is not able to parse the QUALIFY() clause.

Example

Executing the following command:

$ sqllineage -e "SELECT c2, SUM(c3) OVER (PARTITION BY c2) as r FROM t1 WHERE c3 < 4 GROUP BY c2, c3 HAVING SUM(c1) > 3 QUALIFY r IN (SELECT MIN(c1) FROM test GROUP BY c2 HAVING MIN(c1) > 3);" 

Results in the following output:

raise InvalidSyntaxException(
sqllineage.exceptions.InvalidSyntaxException: This SQL statement is unparsable, please check potential syntax error for SQL:
SELECT c2, SUM(c3) OVER (PARTITION BY c2) as r FROM t1 WHERE c3 < 4 GROUP BY c2, c3 HAVING SUM(c1) > 3 QUALIFY r IN (SELECT MIN(c1) FROM test GROUP BY c2 HAVING MIN(c1) > 3);
Line 1, Position 104: Found unparsable section: 'QUALIFY r IN (SELECT MIN(c1) FROM test G...'
maoxingda commented 5 months ago
image