szehon-ho commented on code in PR #15028:
URL: https://github.com/apache/iceberg/pull/15028#discussion_r2700324115
##########
spark/v4.1/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestMergeSchemaEvolution.java:
##########
@@ -185,6 +186,46 @@ public void testMergeWithSchemaEvolutionNestedStruct() {
sql("SELECT id, s FROM %s ORDER BY id", selectTarget()));
}
+ @TestTemplate
+ public void testMergeWithSchemaEvolutionNestedStructSourceHasFewerFields() {
+ assumeThat(branch).as("Schema evolution does not work for branches
currently").isNull();
+
+ createAndInitTable(
+ "id INT, s STRUCT<c1:INT,c2:STRING,c3:INT>",
+ "{ \"id\": 1, \"s\": { \"c1\": 100, \"c2\": \"aa\", \"c3\": 1000 } }\n"
+ + "{ \"id\": 2, \"s\": { \"c1\": 200, \"c2\": \"bb\", \"c3\": 2000
} }");
+
+ createOrReplaceView(
+ "source",
+ "id INT, s STRUCT<c1:INT,c2:STRING>",
+ "{ \"id\": 1, \"s\": { \"c1\": 10, \"c2\": \"a\" } }\n"
+ + "{ \"id\": 3, \"s\": { \"c1\": 30, \"c2\": \"c\" } }");
+
+ // Rows should have null for missing c3 nested field from source
+ ImmutableList<Object[]> expectedRows =
Review Comment:
i see, thanks for checking. well, i did it all this way in this file, and
we both agree, so id say let's just do it?
##########
spark/v4.1/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestMergeSchemaEvolution.java:
##########
@@ -185,6 +186,46 @@ public void testMergeWithSchemaEvolutionNestedStruct() {
sql("SELECT id, s FROM %s ORDER BY id", selectTarget()));
}
+ @TestTemplate
+ public void testMergeWithSchemaEvolutionNestedStructSourceHasFewerFields() {
+ assumeThat(branch).as("Schema evolution does not work for branches
currently").isNull();
+
+ createAndInitTable(
+ "id INT, s STRUCT<c1:INT,c2:STRING,c3:INT>",
+ "{ \"id\": 1, \"s\": { \"c1\": 100, \"c2\": \"aa\", \"c3\": 1000 } }\n"
+ + "{ \"id\": 2, \"s\": { \"c1\": 200, \"c2\": \"bb\", \"c3\": 2000
} }");
+
+ createOrReplaceView(
+ "source",
+ "id INT, s STRUCT<c1:INT,c2:STRING>",
+ "{ \"id\": 1, \"s\": { \"c1\": 10, \"c2\": \"a\" } }\n"
+ + "{ \"id\": 3, \"s\": { \"c1\": 30, \"c2\": \"c\" } }");
+
+ // Rows should have null for missing c3 nested field from source
+ ImmutableList<Object[]> expectedRows =
Review Comment:
i see, thanks for checking. well, i did it all this way in the other tests
in this file, and we both agree, so id say let's just do it?
--
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]