RussellSpitzer commented on code in PR #7380:
URL: https://github.com/apache/iceberg/pull/7380#discussion_r1174035778
##########
spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestSetWriteDistributionAndOrdering.java:
##########
@@ -64,6 +67,28 @@ public void testSetWriteOrderByColumn() {
Assert.assertEquals("Should have expected order", expected,
table.sortOrder());
}
+ @Test
+ public void testSetWriteOrderWithCaseSensitiveColumnNames() {
+ sql(
+ "CREATE TABLE %s (Id bigint NOT NULL, Category string, ts timestamp,
data string) USING iceberg",
+ tableName);
+ Table table = validationCatalog.loadTable(tableIdent);
+ Assert.assertTrue("Table should start unsorted",
table.sortOrder().isUnsorted());
+ sql("SET %s=true", SQLConf.CASE_SENSITIVE().key());
+ Assertions.assertThatThrownBy(
+ () -> {
+ sql("ALTER TABLE %s WRITE ORDERED BY category, id", tableName);
+ })
+ .isInstanceOf(ValidationException.class);
+
+ sql("SET %s=false", SQLConf.CASE_SENSITIVE().key());
+ Assertions.assertThatNoException()
+ .isThrownBy(
+ () -> {
+ sql("ALTER TABLE %s WRITE ORDERED BY category, id", tableName);
+ });
Review Comment:
I would prefer we just run the Alter and then check that the sortOrder is
correctly set. Personally, I'm generally not a fan of "did this not throw an
exception" tests.
--
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]