cloud-fan commented on code in PR #43843:
URL: https://github.com/apache/spark/pull/43843#discussion_r1400534710
##########
sql/core/src/test/resources/sql-tests/results/selectExcept.sql.out:
##########
@@ -0,0 +1,334 @@
+-- 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
+CREATE TABLE namesTbl USING CSV AS SELECT * EXCEPT (id, data) FROM tbl_view
Review Comment:
my two cents: usually we don't need to test query features with commands
like CTAS or INSERT, because we know the analyzer resolves queries inside
commands the same way as normal queries. We have so many golden files to test
many different query features, and we never test them twice using commands. I
think we should follow the tradition here.
--
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]