RussellSpitzer commented on code in PR #11419:
URL: https://github.com/apache/iceberg/pull/11419#discussion_r1828008335
##########
spark/v3.3/spark/src/test/java/org/apache/iceberg/spark/source/TestDataFrameWriterV2.java:
##########
@@ -226,4 +229,100 @@ public void testWriteWithCaseSensitiveOption() throws
NoSuchTableException, Pars
fields = Spark3Util.loadIcebergTable(sparkSession,
tableName).schema().asStruct().fields();
Assert.assertEquals(4, fields.size());
}
+
+ @Test
+ public void testMergeSchemaIgnoreDowncast() throws Exception {
+ //// test long to int ignore case
+ sql(
+ "ALTER TABLE %s SET TBLPROPERTIES ('%s'='true')",
+ tableName, TableProperties.SPARK_WRITE_ACCEPT_ANY_SCHEMA);
+
+ Dataset<Row> bigintDF =
+ jsonToDF(
+ "id bigint, data string",
+ "{ \"id\": 1, \"data\": \"a\" }",
+ "{ \"id\": 2, \"data\": \"b\" }");
+
+ bigintDF.writeTo(tableName).append();
+
+ assertEquals(
Review Comment:
I'm slightly worried this will be true regardless of the types. I think ...
haven't tested this, that 1L and 1 will pass AssertEquals in our rows.
Probably we should also assert on schema
--
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]