yihua opened a new issue, #20824:
URL: https://github.com/apache/hudi/issues/20824
With `hoodie.schema.on.read.enable=true` and the default write configs,
`ALTER TABLE ... RENAME COLUMN` and `ALTER TABLE ... DROP COLUMN` fail on any
Hudi table:
```sql
set hoodie.schema.on.read.enable=true;
create table t (id int, name string, ts long) using hudi tblproperties
(primaryKey = 'id', orderingFields = 'ts');
insert into t values (1, 'a1', 1000);
alter table t add columns (extra string);
alter table t rename column extra to renamed;
-- MissingSchemaFieldException: Schema validation failed due to missing
field. Fields missing from incoming schema: {extra}
```
The statement is not applied, so the table keeps the old column name and
later writes that use the new name fail or misalign.
`AlterTableCommand.commitWithSchema` calls `HoodieTable#validateSchema()`
(added to refuse type changes of secondary index columns), which also checks
the new schema against the latest committed table schema by field name and
refuses any missing field unless
`hoodie.datasource.write.schema.allow.auto.evolution.column.drop` is true. A
rename or drop always leaves the old name out. The existing rename and drop
tests pass only because they set that config.
Proposal: from ALTER TABLE, run only the secondary index check, and have it
refuse a rename or drop of an indexed column explicitly; the statement already
validates the change against the internal 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]