cloud-fan commented on code in PR #43843:
URL: https://github.com/apache/spark/pull/43843#discussion_r1402259902
##########
sql/core/src/test/resources/sql-tests/results/selectExcept.sql.out:
##########
@@ -0,0 +1,333 @@
+-- Automatically generated by SQLQueryTestSuite
+-- !query
+CREATE TEMPORARY VIEW tbl_view AS SELECT * FROM VALUES
+ (10, "name1", named_struct("f1", 1, "s2", named_struct("f2", 101, "f3",
"a"))),
+ (20, "name2", named_struct("f1", 2, "s2", named_struct("f2", 202, "f3",
"b"))),
+ (30, "name3", named_struct("f1", 3, "s2", named_struct("f2", 303, "f3",
"c"))),
+ (40, "name4", named_struct("f1", 4, "s2", named_struct("f2", 404, "f3",
"d"))),
+ (50, "name5", named_struct("f1", 5, "s2", named_struct("f2", 505, "f3",
"e"))),
+ (60, "name6", named_struct("f1", 6, "s2", named_struct("f2", 606, "f3",
"f"))),
+ (70, "name7", named_struct("f1", 7, "s2", named_struct("f2", 707, "f3",
"g")))
+AS tbl_view(id, name, data)
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE TABLE ids (id INT) USING CSV
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+SELECT * FROM tbl_view
+-- !query schema
+struct<id:int,name:string,data:struct<f1:int,s2:struct<f2:int,f3:string>>>
+-- !query output
+10 name1 {"f1":1,"s2":{"f2":101,"f3":"a"}}
+20 name2 {"f1":2,"s2":{"f2":202,"f3":"b"}}
+30 name3 {"f1":3,"s2":{"f2":303,"f3":"c"}}
+40 name4 {"f1":4,"s2":{"f2":404,"f3":"d"}}
+50 name5 {"f1":5,"s2":{"f2":505,"f3":"e"}}
+60 name6 {"f1":6,"s2":{"f2":606,"f3":"f"}}
+70 name7 {"f1":7,"s2":{"f2":707,"f3":"g"}}
+
+
+-- !query
+SELECT * EXCEPT (id) FROM tbl_view
+-- !query schema
+struct<name:string,data:struct<f1:int,s2:struct<f2:int,f3:string>>>
+-- !query output
+name1 {"f1":1,"s2":{"f2":101,"f3":"a"}}
+name2 {"f1":2,"s2":{"f2":202,"f3":"b"}}
+name3 {"f1":3,"s2":{"f2":303,"f3":"c"}}
+name4 {"f1":4,"s2":{"f2":404,"f3":"d"}}
+name5 {"f1":5,"s2":{"f2":505,"f3":"e"}}
+name6 {"f1":6,"s2":{"f2":606,"f3":"f"}}
+name7 {"f1":7,"s2":{"f2":707,"f3":"g"}}
+
+
+-- !query
+SELECT * EXCEPT (name) FROM tbl_view
+-- !query schema
+struct<id:int,data:struct<f1:int,s2:struct<f2:int,f3:string>>>
+-- !query output
+10 {"f1":1,"s2":{"f2":101,"f3":"a"}}
+20 {"f1":2,"s2":{"f2":202,"f3":"b"}}
+30 {"f1":3,"s2":{"f2":303,"f3":"c"}}
+40 {"f1":4,"s2":{"f2":404,"f3":"d"}}
+50 {"f1":5,"s2":{"f2":505,"f3":"e"}}
+60 {"f1":6,"s2":{"f2":606,"f3":"f"}}
+70 {"f1":7,"s2":{"f2":707,"f3":"g"}}
+
+
+-- !query
+SELECT * EXCEPT (data) FROM tbl_view
+-- !query schema
+struct<id:int,name:string>
+-- !query output
+10 name1
+20 name2
+30 name3
+40 name4
+50 name5
+60 name6
+70 name7
+
+
+-- !query
+SELECT * EXCEPT (data.f1) FROM tbl_view
+-- !query schema
+struct<id:int,name:string,data:struct<s2:struct<f2:int,f3:string>>>
+-- !query output
+10 name1 {"s2":{"f2":101,"f3":"a"}}
+20 name2 {"s2":{"f2":202,"f3":"b"}}
+30 name3 {"s2":{"f2":303,"f3":"c"}}
+40 name4 {"s2":{"f2":404,"f3":"d"}}
+50 name5 {"s2":{"f2":505,"f3":"e"}}
+60 name6 {"s2":{"f2":606,"f3":"f"}}
+70 name7 {"s2":{"f2":707,"f3":"g"}}
+
+
+-- !query
+SELECT * EXCEPT (data.s2) FROM tbl_view
+-- !query schema
+struct<id:int,name:string,data:struct<f1:int>>
+-- !query output
+10 name1 {"f1":1}
+20 name2 {"f1":2}
+30 name3 {"f1":3}
+40 name4 {"f1":4}
+50 name5 {"f1":5}
+60 name6 {"f1":6}
+70 name7 {"f1":7}
+
+
+-- !query
+SELECT * EXCEPT (data.s2.f2) FROM tbl_view
+-- !query schema
+struct<id:int,name:string,data:struct<f1:int,s2:struct<f3:string>>>
+-- !query output
+10 name1 {"f1":1,"s2":{"f3":"a"}}
+20 name2 {"f1":2,"s2":{"f3":"b"}}
+30 name3 {"f1":3,"s2":{"f3":"c"}}
+40 name4 {"f1":4,"s2":{"f3":"d"}}
+50 name5 {"f1":5,"s2":{"f3":"e"}}
+60 name6 {"f1":6,"s2":{"f3":"f"}}
+70 name7 {"f1":7,"s2":{"f3":"g"}}
+
+
+-- !query
+SELECT * EXCEPT (id, name, data) FROM tbl_view
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+SELECT * EXCEPT (`a-b-c`) FROM (SELECT 1 a_b_c, 2 `a-b-c`)
+-- !query schema
+struct<a_b_c:int>
+-- !query output
+1
+
+
+-- !query
+SELECT tbl_view.* EXCEPT (name) FROM tbl_view
+-- !query schema
+struct<id:int,data:struct<f1:int,s2:struct<f2:int,f3:string>>>
+-- !query output
+10 {"f1":1,"s2":{"f2":101,"f3":"a"}}
+20 {"f1":2,"s2":{"f2":202,"f3":"b"}}
+30 {"f1":3,"s2":{"f2":303,"f3":"c"}}
+40 {"f1":4,"s2":{"f2":404,"f3":"d"}}
+50 {"f1":5,"s2":{"f2":505,"f3":"e"}}
+60 {"f1":6,"s2":{"f2":606,"f3":"f"}}
+70 {"f1":7,"s2":{"f2":707,"f3":"g"}}
+
+
+-- !query
+INSERT INTO ids
+SELECT * EXCEPT (name, data) FROM tbl_view
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+SELECT * FROM ids
+-- !query schema
+struct<id:int>
+-- !query output
+10
+20
+30
+40
+50
+60
+70
+
+
+-- !query
+SELECT * EXCEPT (ids.id) FROM ids
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+SELECT data.* EXCEPT (s2) FROM tbl_view
+-- !query schema
+struct<f1:int>
+-- !query output
+1
+2
+3
+4
+5
+6
+7
+
+
+-- !query
+SELECT data.* EXCEPT (s2.f2) FROM tbl_view
+-- !query schema
+struct<f1:int,s2:struct<f3:string>>
+-- !query output
+1 {"f3":"a"}
+2 {"f3":"b"}
+3 {"f3":"c"}
+4 {"f3":"d"}
+5 {"f3":"e"}
+6 {"f3":"f"}
+7 {"f3":"g"}
+
+
+-- !query
+SELECT data.s2.* EXCEPT (f2) FROM tbl_view
+-- !query schema
+struct<f3:string>
+-- !query output
+a
+b
+c
+d
+e
+f
+g
+
+
+-- !query
+SELECT * EXCEPT name FROM tbl_view
+-- !query schema
+struct<>
+-- !query output
+org.apache.spark.sql.catalyst.parser.ParseException
+{
+ "errorClass" : "PARSE_SYNTAX_ERROR",
+ "sqlState" : "42601",
+ "messageParameters" : {
+ "error" : "'name'",
+ "hint" : ""
+ }
+}
+
+
+-- !query
+SELECT * EXCEPT() name FROM tbl_view
+-- !query schema
+struct<>
+-- !query output
+org.apache.spark.sql.catalyst.parser.ParseException
+{
+ "errorClass" : "PARSE_SYNTAX_ERROR",
+ "sqlState" : "42601",
+ "messageParameters" : {
+ "error" : "')'",
+ "hint" : ""
+ }
+}
+
+
+-- !query
+SELECT * EXCEPT(invalid_column) FROM tbl_view
+-- !query schema
+struct<>
+-- !query output
+org.apache.spark.sql.AnalysisException
+{
+ "errorClass" : "UNRESOLVED_COLUMN.WITH_SUGGESTION",
+ "sqlState" : "42703",
+ "messageParameters" : {
+ "objectName" : "`invalid_column`",
+ "proposal" : "`id`, `name`, `data`"
+ },
+ "queryContext" : [ {
+ "objectType" : "",
+ "objectName" : "",
+ "startIndex" : 8,
+ "stopIndex" : 31,
+ "fragment" : "* EXCEPT(invalid_column)"
+ } ]
+}
+
+
+-- !query
+SELECT * EXCEPT(id, invalid_column) FROM tbl_view
+-- !query schema
+struct<>
+-- !query output
+org.apache.spark.sql.AnalysisException
+{
+ "errorClass" : "UNRESOLVED_COLUMN.WITH_SUGGESTION",
+ "sqlState" : "42703",
+ "messageParameters" : {
+ "objectName" : "`invalid_column`",
+ "proposal" : "`id`, `name`, `data`"
+ },
+ "queryContext" : [ {
+ "objectType" : "",
+ "objectName" : "",
+ "startIndex" : 8,
+ "stopIndex" : 35,
+ "fragment" : "* EXCEPT(id, invalid_column)"
+ } ]
+}
+
+
+-- !query
+SELECT * EXCEPT(id, id) FROM tbl_view
+-- !query schema
+struct<>
+-- !query output
+org.apache.spark.sql.AnalysisException
+{
+ "errorClass" : "EXCEPT_OVERLAPPING_COLUMNS",
+ "sqlState" : "42702",
+ "messageParameters" : {
+ "columns" : "id, id"
+ },
+ "queryContext" : [ {
+ "objectType" : "",
+ "objectName" : "",
+ "startIndex" : 8,
+ "stopIndex" : 23,
+ "fragment" : "* EXCEPT(id, id)"
+ } ]
+}
+
+
+-- !query
+SELECT * EXCEPT(data.s2, data.s2.f2) FROM tbl_view
+-- !query schema
+struct<>
+-- !query output
+java.util.NoSuchElementException
Review Comment:
oh, this seems indicate a bug.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]