-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[SPARK-52462] [SQL] Enforce type coercion before children output deduplication in Union #51172
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,24 @@ CreateViewCommand `t2`, VALUES (1.0, 1), (2.0, 4) tbl(c1, c2), false, true, Loca | |
+- LocalRelation [c1#x, c2#x] | ||
|
||
|
||
-- !query | ||
CREATE TABLE parquetTable (col1 INT, col2 INT, col3 INT, col4 INT) USING parquet | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at the changes, I don't think which built-in file format matters here, why do we test with 3 formats? shall we just test one? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could test just one (parquet for example). But wanted to cover more in case we missed some weird thing here. I guess it doesn't hurt to have more tests. |
||
-- !query analysis | ||
CreateDataSourceTableCommand `spark_catalog`.`default`.`parquetTable`, false | ||
|
||
|
||
-- !query | ||
CREATE TABLE csvTable (col1 INT, col2 INT, col3 INT, col4 INT) USING csv | ||
-- !query analysis | ||
CreateDataSourceTableCommand `spark_catalog`.`default`.`csvTable`, false | ||
|
||
|
||
-- !query | ||
CREATE TABLE jsonTable (col1 INT, col2 INT, col3 INT, col4 INT) USING json | ||
-- !query analysis | ||
CreateDataSourceTableCommand `spark_catalog`.`default`.`jsonTable`, false | ||
|
||
|
||
-- !query | ||
SELECT * | ||
FROM (SELECT * FROM t1 | ||
|
@@ -241,6 +259,63 @@ Aggregate [sum(v#x) AS sum(v)#x] | |
+- LocalRelation [v#x] | ||
|
||
|
||
-- !query | ||
SELECT col1, col2, col3, NULLIF('','') AS col4 | ||
FROM parquetTable | ||
UNION ALL | ||
SELECT col2, col2, null AS col3, col4 | ||
FROM parquetTable | ||
-- !query analysis | ||
Union false, false | ||
:- Project [col1#x, col2#x, col3#x, cast(col4#x as bigint) AS col4#xL] | ||
: +- Project [col1#x, col2#x, col3#x, nullif(, ) AS col4#x] | ||
: +- SubqueryAlias spark_catalog.default.parquettable | ||
: +- Relation spark_catalog.default.parquettable[col1#x,col2#x,col3#x,col4#x] parquet | ||
+- Project [col2#x, col2#x AS col2#x, col3#x, col4#xL] | ||
+- Project [col2#x, col2#x, cast(col3#x as int) AS col3#x, cast(col4#x as bigint) AS col4#xL] | ||
+- Project [col2#x, col2#x, null AS col3#x, col4#x] | ||
+- SubqueryAlias spark_catalog.default.parquettable | ||
+- Relation spark_catalog.default.parquettable[col1#x,col2#x,col3#x,col4#x] parquet | ||
|
||
|
||
-- !query | ||
SELECT col1, col2, col3, NULLIF('','') AS col4 | ||
FROM csvTable | ||
UNION ALL | ||
SELECT col2, col2, null AS col3, col4 | ||
FROM csvTable | ||
-- !query analysis | ||
Union false, false | ||
:- Project [col1#x, col2#x, col3#x, cast(col4#x as bigint) AS col4#xL] | ||
: +- Project [col1#x, col2#x, col3#x, nullif(, ) AS col4#x] | ||
: +- SubqueryAlias spark_catalog.default.csvtable | ||
: +- Relation spark_catalog.default.csvtable[col1#x,col2#x,col3#x,col4#x] csv | ||
+- Project [col2#x, col2#x AS col2#x, col3#x, col4#xL] | ||
+- Project [col2#x, col2#x, cast(col3#x as int) AS col3#x, cast(col4#x as bigint) AS col4#xL] | ||
+- Project [col2#x, col2#x, null AS col3#x, col4#x] | ||
+- SubqueryAlias spark_catalog.default.csvtable | ||
+- Relation spark_catalog.default.csvtable[col1#x,col2#x,col3#x,col4#x] csv | ||
|
||
|
||
-- !query | ||
SELECT col1, col2, col3, NULLIF('','') AS col4 | ||
FROM jsonTable | ||
UNION ALL | ||
SELECT col2, col2, null AS col3, col4 | ||
FROM jsonTable | ||
-- !query analysis | ||
Union false, false | ||
:- Project [col1#x, col2#x, col3#x, cast(col4#x as bigint) AS col4#xL] | ||
: +- Project [col1#x, col2#x, col3#x, nullif(, ) AS col4#x] | ||
: +- SubqueryAlias spark_catalog.default.jsontable | ||
: +- Relation spark_catalog.default.jsontable[col1#x,col2#x,col3#x,col4#x] json | ||
+- Project [col2#x, col2#x AS col2#x, col3#x, col4#xL] | ||
+- Project [col2#x, col2#x, cast(col3#x as int) AS col3#x, cast(col4#x as bigint) AS col4#xL] | ||
+- Project [col2#x, col2#x, null AS col3#x, col4#x] | ||
+- SubqueryAlias spark_catalog.default.jsontable | ||
+- Relation spark_catalog.default.jsontable[col1#x,col2#x,col3#x,col4#x] json | ||
|
||
|
||
-- !query | ||
DROP VIEW IF EXISTS t1 | ||
-- !query analysis | ||
|
@@ -275,3 +350,24 @@ DropTempViewCommand p2 | |
DROP VIEW IF EXISTS p3 | ||
-- !query analysis | ||
DropTempViewCommand p3 | ||
|
||
|
||
-- !query | ||
DROP TABLE IF EXISTS parquetTable | ||
-- !query analysis | ||
DropTable true, false | ||
+- ResolvedIdentifier V2SessionCatalog(spark_catalog), default.parquetTable | ||
|
||
|
||
-- !query | ||
DROP TABLE IF EXISTS csvTable | ||
-- !query analysis | ||
DropTable true, false | ||
+- ResolvedIdentifier V2SessionCatalog(spark_catalog), default.csvTable | ||
|
||
|
||
-- !query | ||
DROP TABLE IF EXISTS jsonTable | ||
-- !query analysis | ||
DropTable true, false | ||
+- ResolvedIdentifier V2SessionCatalog(spark_catalog), default.jsonTable |
Uh oh!
There was an error while loading. Please reload this page.