You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "voonhous (via GitHub)" <gi...@apache.org> on 2026/03/05 13:32:41 UTC
[I] Flesh out schema evolution support for variant. [hudi]
voonhous opened a new issue, #18285:
URL: https://github.com/apache/hudi/issues/18285
### Task Description
**What needs to be done:**
https://github.com/apache/hudi/pull/17833/changes#r2874744476
**Why this task is needed:**
### Task Type
Code improvement/refactoring
### Related Issues
**Parent feature issue:** (if applicable )
**Related issues:**
NOTE: Use `Relationships` button to add parent/blocking issues after issue is created.
--
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: commits-unsubscribe@hudi.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Flesh out schema evolution support for variant [hudi]
Posted by "voonhous (via GitHub)" <gi...@apache.org>.
voonhous commented on issue #18285:
URL: https://github.com/apache/hudi/issues/18285#issuecomment-5869224297
Schema evolution beside a variant column with `spark.sql.variant.pushVariantIntoScan` on (Spark 4.1+, master): where it stands and what is left, following the `addMissingFields` thread (https://github.com/apache/hudi/pull/19783#discussion_r3888224040).
Covered on master:
- [x] Column add beside a top-level variant, pushdown on and off, COW and MOR, followed by compaction and clustering (`TestVariantShreddingMixedLayouts` section G; `TestVariantDataType` "schema evolves").
- [x] Implicit type widening of a sibling under a nested variant projection, COW (#19783: the `addMissingFields` arm and "Implicit widening of a sibling keeps the nested variant projection").
- [x] Schema-on-read plus the projection struct fails fast, including the inline compaction, clustering and CDC routes (`validateNoShreddedVariants`, pinned in "Schema-on-read reads of shredded variant files fail fast").
Open:
- [ ] Implicit sibling widening on MOR with log files (native parquet and avro blocks), pushdown on. The #19783 leg is COW only, and the MOR merge is where its bug lived.
- [ ] The same widening with a top-level variant beside the widened column. The #19783 leg uses a nested-only table.
- [ ] Explicit `ALTER TABLE ... ALTER COLUMN n TYPE bigint` on a sibling without schema-on-read (`AlterHoodieTableChangeColumnCommand`, then the same implicit read path), COW and MOR.
- [ ] Add a second VARIANT column by DDL without schema-on-read, then `variant_get` on it across old and new files, pushdown on, COW and MOR.
- [ ] Rename under schema-on-read with pushdown on: pin the loud failure. Today it dies in Spark codegen rather than through the guard. Real support is this ticket, and the DDL itself is blocked by #19766 under default configs.
Not needed:
- Drop and reposition of the variant column are schema-on-read only and belong to this ticket's own list above.
- Type promotion of the variant column itself: no format defines one, Spark's `UpCastRule` refuses it, and Hudi's compatibility checker refuses it. See the scope comment above.
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Flesh out schema evolution support for variant [hudi]
Posted by "voonhous (via GitHub)" <gi...@apache.org>.
voonhous commented on issue #18285:
URL: https://github.com/apache/hudi/issues/18285#issuecomment-5931902019
The issues under this ticket split by schema path. Schema-on-read items are not backported to branch-1.2.x; schema-on-write bugs are.
| Issue / item | Path | What it is | branch-1.2.x |
|:--|:--|:--|:--|
| #20135 | schema-on-write | A variant column added by `ADD COLUMNS` (v1 route) cannot be read from pre-DDL files with `pushVariantIntoScan` on | ported: #20184 |
| #20139 | schema-on-read | `count(*)` on a variant table fails once an internal schema is committed | not backported |
| #18551 | schema-on-read | Negative sentinel field ids for VARIANT and BLOB in `InternalSchemaConverter` | not backported |
| #20141, schema-on-read part | schema-on-read | What blocks renaming a variant column (DDL, guard, codegen cast, catalog type) | not backported |
| #20141, schema-on-write part | schema-on-write | No rename primitive: Spark refuses the DDL, a DataFrame write is drop plus add; its one read failure was #20135 | nothing to port |
| #20140 | neither | The file format writes its batch decision into the session conf; not evolution-specific | separate decision |
| Checklist items 1-3 | schema-on-write | Test-only pins (sibling widening on MOR and at top level, `ALTER COLUMN TYPE` refusal) | not needed |
| Checklist item 4 | schema-on-write | Same as #20135 | ported: #20184 |
| Checklist item 5 | schema-on-read | Test-only pin of the rename failure | not backported |
The four operations in the scope comment above (add, drop, rename, reposition under `hoodie.schema.on.read.enable`) are all schema-on-read.
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Flesh out schema evolution support for variant [hudi]
Posted by "voonhous (via GitHub)" <gi...@apache.org>.
voonhous commented on issue #18285:
URL: https://github.com/apache/hudi/issues/18285#issuecomment-5869219005
Scope update after checking what the other formats and Spark allow.
Type promotion is out of scope for a VARIANT column. No format defines a promotion to or from variant: Iceberg v3's promotion table lists unknown, int, date, float and decimal only; Delta's `typeWidening` covers integer, float, date and decimal widening; Paimon's cast matrix gives VARIANT only the identity rule, which is what its `ALTER TABLE ... MODIFY` gates on. Spark refuses it before any catalog sees it: `UpCastRule.canUpCast` has `case (VariantType, _) => false` and no arm accepts a variant target. Hudi refuses it on both of its paths as well: `HoodieSchemaCompatibility` treats VARIANT against any other type as a mismatch (the `ALTER COLUMN TYPE` path without schema-on-read), and `SchemaChangeUtils.isTypeUpdateAllow` throws on nested types, which is how the internal schema models a variant.
Evolution inside the value is what the type is for and needs no DDL. Different shredding schemas across files are a reader reconstruction concern and already work without schema-on-read.
So the operations this ticket covers, all under `hoodie.schema.on.read.enable`, are:
- [ ] add a VARIANT column to an existing table (top-level, and nested in a struct)
- [ ] drop a VARIANT column
- [ ] rename a VARIANT column
- [ ] reposition a VARIANT column
Each on COW and on MOR with log files, `spark.sql.variant.pushVariantIntoScan` on and off, with a shredded file in the mix.
Current state on master and what blocks the above:
- `ParquetSchemaEvolutionUtils.validateNoShreddedVariants` fails fast on any schema-on-read read that carries the PushVariantIntoScan projection struct or meets a shredded file; its message points here. Rename is not fronted by it (the footer lookup is by query name) and dies in Spark codegen instead.
- `SparkInternalSchemaConverter.constructSparkSchemaFromInternalSchema` has no VARIANT arm, so the first schema-on-read DDL rewrites the catalog column to `struct<metadata, value>` and plain reads fail afterwards. This is the first fix.
- Under schema-on-read the merged request materializes the variant as `{metadata, value}` while the plan expects `VariantType` or the projection struct. The internal-schema pipeline has to pass the variant column through as one atomic unit (prune, merge, type-change info, filter rebuild), replacing the guard's rewrite arm.
- `FileGroupRecordBuffer.composeEvolvedSchemaTransformer` ordering, see the section above.
- #19766: rename and drop fail for every column type under default configs since #13595. The rename and drop halves cannot be exercised until that is fixed or the tests set `hoodie.datasource.write.schema.allow.auto.evolution.column.drop=true`.
No test on master adds, drops, renames or repositions a VARIANT column through DDL. The existing evolution legs add a string sibling only.
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org