Comments (3)
This is yet another moment when I feel amazed that it's allowed to write SQL like this.
To summarize, c2, c3 and c4 can come from src_tbl1 and src_tbl2
select
c1,
(select c2 || c3 || c4 from src_tbl1) as c2
------------^^^
from
src_tbl2
;
Again, tried a few open source SQL database:
dialect | version | src_tbl1 returns multiple rows | src_tbl1 returns 1 row |
---|---|---|---|
mysql | 8.2.0 | ERROR 1242 (21000): Subquery returns more than 1 row | yes |
postgres | 16.1 | ERROR: more than one row returned by a subquery used as an expression | yes |
hive | 3.1.3 | CalciteSubquerySemanticException [Error 10249]: Unsupported SubQuery Expression Currently SubQuery expressions are only allowed as Where and Having Clause predicates (state=42000,code=10249) | same error |
sparksql | 3.5.0 | [UNSUPPORTED_SUBQUERY_EXPRESSION_CATEGORY.MUST_AGGREGATE_CORRELATED_SCALAR_SUBQUERY] Unsupported subquery expression: Correlated scalar subqueries must be aggregated to return at most one row. | same error |
trino | 435 | Given correlated subquery is not supported | same error |
When src_tbl1 returns multiple rows, this SQL won't be executable. Hive/Spark/Trino disallow this syntax at parsing phase. MySQL/Postgres postpone throwing exception until execution and would allow if the subquery returns 1 row at execution time.
Generally speaking, I think it's a very narrow use case. And it requires a lot of change to sqllineage (we might need to introduce the concept of lexical scope, like Python doing variable lookup from local -> enclosed -> global -> built-in). That's error-prune and not adding too much value.
from sqllineage.
Our SQL does not have this kind of syntax. I just found this syntax when looking at the underlying sqlfluff, so I brought it up. Can be processed or not.
from sqllineage.
OK. We'll keep it open and take it as low priority then.
from sqllineage.
Related Issues (20)
- 请教下当列级血缘和表级血缘在一张图中时是如何处理的? HOT 12
- Tsql -UPDATE set analyz error HOT 1
- Support Hive/SparkSQL Multi Table Insert Syntax HOT 1
- Column level lineage not drawn properly when metadata is provided HOT 1
- [hive] not support insert into table(field1,fleld2.field3) HOT 3
- when I use merge into ,it reports this error HOT 1
- [hive-dialect] order by and union all together it throw error HOT 1
- [hive-dialect]date/time keyword as fieldName with no `` throw error HOT 1
- [hive-dialect] dbName . tableName can not work failed HOT 3
- [hive-dialect] row_number() over (distribute by fund_account sort by bus_date desc) as sort_id ; not support HOT 1
- Will the informix database be supported in the future? HOT 1
- Subquery Partial Wildcard expansion breaks the column lineage path HOT 3
- Greenplum LATERAL Subquery doesn't work HOT 2
- False negative for Scalar Subquery used in Function HOT 2
- "function lineage" HOT 1
- question about column-level lineage: column in group by clause HOT 1
- “SELECT *” can not map real table name, but alias name.
- Installing from source without `npm` HOT 1
- `SQLAlchemy` optional dependency HOT 3
- Qualify Clause Parsing Failure HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqllineage.