riemenschneider commented on issue #13696:
URL: https://github.com/apache/iceberg/issues/13696#issuecomment-3133150695

   The following test can be used to reproduce the issue.
   ```
   import java.io.IOException;
   import java.util.Map;
   
   import org.apache.iceberg.Schema;
   import org.apache.iceberg.Table;
   import org.apache.iceberg.UpdateSchema;
   import org.apache.iceberg.catalog.Namespace;
   import org.apache.iceberg.catalog.TableIdentifier;
   import org.apache.iceberg.inmemory.InMemoryCatalog;
   import org.apache.iceberg.types.Types;
   import org.junit.Assert;
   import org.junit.jupiter.params.ParameterizedTest;
   import org.junit.jupiter.params.provider.CsvSource;
   
   class UpdateSchemaCaseSensitivityTest {
   
       @ParameterizedTest
       @CsvSource(
               value = {
                       "true,  true,  true",
                       "false, true,  true",
                       "true,  false, false",
                       "false, false, false"
               }
       )
       void test(boolean addOneColumnPerSchemaUpdate, boolean caseSensitive, 
boolean expectSuccess) throws IOException{
           try (InMemoryCatalog catalog = new InMemoryCatalog()) {
               catalog.initialize("catalog", Map.of());
               Namespace namespace = Namespace.of("namespace");
               catalog.createNamespace(namespace);
               Table table = catalog.createTable(TableIdentifier.of(namespace, 
"table"), new Schema());
               UpdateSchema updateSchema = table.updateSchema()
                       .caseSensitive(caseSensitive)
                       .addColumn("column", Types.IntegerType.get());
               if (addOneColumnPerSchemaUpdate) {
                   updateSchema.commit();
                   updateSchema = table.updateSchema()
                           .caseSensitive(caseSensitive);
               }
               try {
                   updateSchema.addColumn("COLUMN", Types.IntegerType.get());
                   if (!expectSuccess) {
                       Assert.fail("Expected failure due to case sensitivity, 
but succeeded.");
                   }
               } catch (IllegalArgumentException e) {
                   if (expectSuccess) {
                       throw e; // Unexpected failure
                   }
                   // Expected failure due to case sensitivity
               }
               updateSchema.commit();
           }
       }
   
   }
   ```


-- 
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]

Reply via email to