You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "riemenschneider (via GitHub)" <gi...@apache.org> on 2025/07/29 15:58:30 UTC
[I] UpdateSchema.caseSensitive(false) does not prevent adding multiple column having the same case-insensitive name [iceberg]
riemenschneider opened a new issue, #13696:
URL: https://github.com/apache/iceberg/issues/13696
### Apache Iceberg version
1.9.2 (latest release)
### Query engine
None
### Please describe the bug 🐞
When creating an `UpdateSchema` and configuring case-insensitive comparison of column names, as well as adding multiple columns that differ only in the case of their names, the schema update will not fail as expected.
```
table.updateSchema()
.caseSensitive(false)
.addColumn("column", Types.IntegerType.get())
.addColumn("COLUMN", Types.IntegerType.get())
.commit();
```
The issue originates from the final validation step when committing the `UpdateSchema`, which ignores the case sensitivity setting.
### Willingness to contribute
- [ ] I can contribute a fix for this bug independently
- [x] I would be willing to contribute a fix for this bug with guidance from the Iceberg community
- [ ] I cannot contribute a fix for this bug at this time
--
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: issues-unsubscribe@iceberg.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Setting UpdateSchema.caseSensitive(false) does not prevent multiple columns with the same case-insensitive name being added [iceberg]
Posted by "amogh-jahagirdar (via GitHub)" <gi...@apache.org>.
amogh-jahagirdar closed issue #13696: Setting UpdateSchema.caseSensitive(false) does not prevent multiple columns with the same case-insensitive name being added
URL: https://github.com/apache/iceberg/issues/13696
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] UpdateSchema.caseSensitive(false) does not prevent adding multiple column having the same case-insensitive name [iceberg]
Posted by "riemenschneider (via GitHub)" <gi...@apache.org>.
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] UpdateSchema.caseSensitive(false) does not prevent adding multiple column having the same case-insensitive name [iceberg]
Posted by "RussellSpitzer (via GitHub)" <gi...@apache.org>.
RussellSpitzer commented on issue #13696:
URL: https://github.com/apache/iceberg/issues/13696#issuecomment-3133170940
This definitely looks like it's worth fixing!
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Setting UpdateSchema.caseSensitive(false) does not prevent multiple columns with the same case-insensitive name being added [iceberg]
Posted by "riemenschneider (via GitHub)" <gi...@apache.org>.
riemenschneider commented on issue #13696:
URL: https://github.com/apache/iceberg/issues/13696#issuecomment-3133196792
Replacing https://github.com/apache/iceberg/blob/83da920b3abcb1206559034362e08127b6954dea/core/src/main/java/org/apache/iceberg/SchemaUpdate.java#L570 by
```
Map<String, Integer> nameToId = caseSensitive ? TypeUtil.indexByName(struct) : TypeUtil.indexByLowerCaseName(struct);
```
might already solve that issue.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org