JingsongLi commented on code in PR #9347:
URL: https://github.com/apache/paimon/pull/9347#discussion_r3888247857
##########
paimon-core/src/main/java/org/apache/paimon/schema/SchemaManager.java:
##########
@@ -337,6 +351,16 @@ public static TableSchema generateTableSchema(
if (!unchanged &&
CoreOptions.TYPE.key().equals(setOption.key())) {
throw new UnsupportedOperationException("Change 'type' is
not supported yet.");
}
+ // reject even without snapshots: field ids are assigned once
at creation,
+ // so changing the value later only makes the option lie about
the schema
+ // (restating the effective value, e.g. an explicit default,
stays allowed)
+ if
(CoreOptions.FIELD_ID_ONE_BASED.key().equals(setOption.key())
+ && Boolean.parseBoolean(oldValue) !=
Boolean.parseBoolean(newValue)) {
Review Comment:
[P2] Parse the option value strictly before comparing it
`Boolean.parseBoolean` treats every string except `"true"` as `false`, so on
a default zero-based table before its first snapshot, setting
`field-id.one-based` to an invalid value is accepted and persisted as if it
were the effective default. The normal option reader rejects that value, and
after a snapshot the immutable-option check prevents correcting it. Please
parse the old and new values through the `ConfigOption<Boolean>` conversion (or
another strict parser) and reject invalid values before the semantic comparison.
--
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]