yihua opened a new issue, #1093:
URL: https://github.com/apache/hudi-rs/issues/1093

   ### Is there an existing issue for this?
   
   - [x] I have searched the existing issues
   
   ### Description of the bug
   
   A snapshot read with `as_of_timestamp` lists the file slices as of that 
instant but reads and merges them with the latest table schema. 
`Table::finish_reader` sets `data_schema_for_read()` on every reader, which 
always resolves the latest commit's schema. Java resolves the schema at the 
query instant instead (`TableSchemaResolver.getTableSchema(timestamp)`: the 
last completed commit at or before the instant), so a time-travel read across a 
schema change returns different results:
   
   - a column dropped after the instant cannot be read (observed, steps below);
   - by the same path, a column added after the instant should come back 
null-filled instead of being absent, and a type promoted after the instant 
widened (not yet checked).
   
   This blocks native time-travel reads in apache/hudi#20170, which keeps them 
on the JVM until hudi-rs resolves the schema at the query instant.
   
   ### Steps To Reproduce
   
   1. Spark upserts a MOR table with a column `extra`, then upserts an update 
that lands in a log file (instant T).
   2. A later upsert drops `extra` 
(`hoodie.datasource.write.schema.allow.auto.evolution.column.drop=true`).
   3. Read the table as of T selecting `extra`. Spark returns the logged 
values; reading the same file slices through hudi-rs's 
`create_file_group_reader_with_options` with `as_of_timestamp = T` fails 
(surfaced by the Comet native scan as `failed to read Hudi file slice`).
   
   ### Expected behavior
   
   A time-travel read uses the schema of the last completed commit at or before 
the query instant, falling back as Java does (create schema, then a data file's 
schema) when that commit records none. Incremental reads keep the latest 
schema, as in Java.
   


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

Reply via email to