Repository navigation
Conversation
JingsongLi
left a comment
There was a problem hiding this comment.
The legacy ORC compatibility case in #1513 is reproducible. All 29 ORC tests and a physical ORC fixture covering winter, summer, nulls and modern mode passed. The full table scan still loses a matching row when its manifest bounds come from the writer's time zone.
| let projected_names: Vec<String> = | ||
| scan_fields.iter().map(|f| f.name().to_string()).collect(); | ||
| // Timestamp comparisons are not pushed into ORC statistics (see | ||
| // datum_to_orc_value). The exact residual runs on normalized values. |
There was a problem hiding this comment.
[P1] Prevent manifest pruning from using a different time zone than the value decoder. Java legacy ORC statistics materialize the bounds in the writer JVM's zone. I committed an actual TIMESTAMP_INSTANT ORC file with UTC writer bounds. With the reader set to America/New_York, the direct read correctly returned 2024-01-15 07:30 for the stored 12:30Z value, but a table scan filtering for 07:30 planned zero splits. Stripe pushdown is already disabled for this column. File-level pruning also needs bounds in the reader's zone or a safe fallback for legacy ORC LTZ predicates.
There was a problem hiding this comment.
Updated in 89377c7. ORC file and key statistics treat LTZ min/max as unknown because the manifest does not identify the writer zone. Null counts and other columns remain available for pruning. The regression commits an ORC entry and a Parquet control with the same writer bounds and runs the public scan builder with a five-hour offset. It checks the surviving file and the manifest prune counter.
f7a523c to
89377c7
Compare
JingsongLi
left a comment
There was a problem hiding this comment.
On 89377c7f integrated with fbe7724c, 78 selected tests passed, including reads of actual ORC files with DST conversion and manifest pruning. A separate physical ORC test reproduced the fixed-offset JVM compatibility gap below.
| // Arrow casts can merely relabel timezone metadata. Legacy Java Paimon | ||
| // instead adds the JVM offset to the stored UTC instant's numeric value. | ||
| if let ArrowDataType::Timestamp(unit, Some(_)) = array.data_type() { | ||
| let tz: arrow_array::timezone::Tz = zone.parse().map_err(|error| Error::DataInvalid { |
There was a problem hiding this comment.
[P2] Accept Java's fixed-offset GMT timezone IDs
The option asks readers to use the Java JVM timezone. Java 17 accepts GMT+05:30, returns that exact ID, and gives an offset of 19,800,000 ms. With the same physical ORC timestamp file, Rust read the correct value for +05:30 but returned Invalid legacy ORC LTZ zone GMT+05:30 for the JVM ID. Normalize GMT+HH:mm and GMT-HH:mm to Arrow's fixed-offset spelling before parsing, and cover a non-whole-hour offset in the ORC read test.
There was a problem hiding this comment.
Fixed in 2a42ad4. The legacy ORC reader now strips Java’s GMT prefix from signed offsets before asking Arrow to parse them. The ORC read regression writes a UTC timestamp and a null, then reads the same file with GMT+05:30, GMT-03:30, and +05:30 and checks the timestamp in each case. cargo check --locked -p paimon --tests passed. Thank you for the reproducer.
89377c7 to
2a42ad4
Compare
JingsongLi
left a comment
There was a problem hiding this comment.
The JVM-zone option fixes a real read compatibility gap. On this head integrated with ebcff9f1, 77 ORC-related unit tests and 20 scan integration tests passed, including fixed-offset and manifest pruning cases. An additional physical ORC read found a historical timestamp mismatch with Java.
| source: None, | ||
| })?; | ||
| let offset = i64::from( | ||
| tz.offset_from_utc_datetime(&utc.naive_utc()) |
There was a problem hiding this comment.
[P2] Match the JVM legacy offset for historical timestamps. I read an ORC TIMESTAMP_LTZ value of 1890-01-01T00:00:00Z through an Asia/Shanghai format table. Modern mode returned the stored instant. Legacy mode added +08:05:43, but JDK 17 TimeZone.getTimeZone("Asia/Shanghai").getOffset(-2524521600000L) returns +08:00, which is the API Java Paimon's DateTimeUtils.toInternal uses. This changes the decoded value by 343 seconds. Use the JVM legacy offset rules for the supported date range and add this physical-file case to the parity tests.
There was a problem hiding this comment.
Thanks for the physical-file reproducer. d26c9e1 uses the JVM raw offset before 1900-01-01T00:00:00Z and the offset at the instant from that boundary onward. The ORC regression checks Shanghai in 1890 (+08:00), the last second before the cutoff (+08:00), and the cutoff itself (+08:05:43). It also reads the same file with legacy mode disabled and with fixed offsets. I compared the standard-offset tables in the locked chrono-tz and JDK 17 data for their 590 shared zone IDs and accounted for their different treatment of negative DST. Both the physical-file regression and the pre-1900 raw-offset regression passed in the Ubuntu unit job.
9032cff to
d26c9e1
Compare
JingsongLi
left a comment
There was a problem hiding this comment.
I reran the ORC and table-scan unit suites on d26c9e14. All 158 tests passed, including the previous Shanghai cutoff and fixed-offset cases. A separate end-to-end table read exposed a JVM time-zone ID compatibility issue.
| .filter(|suffix| suffix.starts_with(['+', '-'])) | ||
| .unwrap_or(zone); | ||
| let tz: arrow_array::timezone::Tz = | ||
| arrow_zone.parse().map_err(|error| Error::DataInvalid { |
There was a problem hiding this comment.
[P2] Accept legacy JVM short time-zone IDs. With -Duser.timezone=PST, JDK 17 returns PST from TimeZone.getDefault().getID() and applies offsets of −08:00 in January and −07:00 in July. I read a physical ORC TIMESTAMP_INSTANT file with those two timestamps through a format table. Setting orc.timestamp-ltz.legacy.time-zone=PST fails the read with Invalid legacy ORC LTZ zone PST. America/Los_Angeles reads the same rows with the expected seasonal offsets. Resolve Java’s legacy short IDs before Arrow parses the zone, and exercise PST across both seasons in the ORC regression.
There was a problem hiding this comment.
Thanks for reporting the -Duser.timezone=PST case. Fixed in 097bff0. The legacy ORC reader resolves the 28 IDs from JDK 17’s ZoneId.SHORT_IDS before looking up the offset at the stored instant. PST resolves to America/Los_Angeles; EST, MST, and HST keep their default JVM fixed offsets. The physical ORC regression now reads January and July 2024 with PST and expects −08:00 and −07:00 respectively. It also checks that EST stays at −05:00 in both seasons. The regression passed in the Ubuntu unit job on top of 8105e1e.
d26c9e1 to
097bff0
Compare
JingsongLi
left a comment
There was a problem hiding this comment.
On 097bff04 integrated with 8105e1eb, 5,251 core, scan-planning, and Java golden-table tests passed, including the JVM short-ID regressions. A separate physical ORC fixture exposed a missing row when the file has an LTZ index.
| let columns = batch | ||
| .columns() | ||
| .iter() | ||
| .map(|column| normalize_legacy_ltz(column, zone)) |
There was a problem hiding this comment.
[P1] Keep file indexes from dropping rows before LTZ normalization. I committed an ORC file storing 2024-01-15T12:30:00Z with a range-bitmap indexed under UTC. With orc.timestamp-ltz.legacy.time-zone=America/New_York, the manifest scan kept the file. Filtering for 07:30:00Z returned one row when file-index.read.enabled=false and zero rows with the default true. The data-file reader evaluates the writer's index before applying this offset, so the residual cannot recover the row. Bypass LTZ value pruning for legacy ORC indexes when the writer zone is unknown, while retaining the residual and unrelated index predicates. Please cover the default index-enabled read.
There was a problem hiding this comment.
Fixed in c295377. The data-file index skips value comparisons on legacy ORC TIMESTAMP_LTZ columns and retains the original predicate for evaluation after normalization. Null checks and independent indexed conjuncts can still prune. Modern ORC and other formats retain their existing behavior.
The regression commits a physical ORC file and range-bitmap indexes over the original UTC values. It checks the New York 07:30 match under the default index-enabled read and with indexes disabled, and checks that an indexed integer conjunct still narrows the selection. The fixture now encodes the ORC bytes directly to model an external writer; the first CI run stopped at the table writer's compression restriction before reaching the assertion.
6365538 to
c295377
Compare
JingsongLi
left a comment
There was a problem hiding this comment.
I tested c295377d merged onto d4411cf8. The 5,391 core, file-index, compaction, and Java golden-warehouse tests passed, including the previously reported range-bitmap case. I reproduced the following issues using physical ORC files committed to a filesystem-backed table.
|
|
||
| fn bound(&self, row: Option<&BinaryRow>, index: usize, data_type: &DataType) -> Option<Datum> { | ||
| // Java legacy ORC bounds use the writer JVM's zone. File metadata does not record that zone. | ||
| if self.is_orc && matches!(data_type, DataType::LocalZonedTimestamp(_)) { |
There was a problem hiding this comment.
[P2] Preserve manifest pruning for modern ORC timestamps. I committed two physical ORC files with disjoint TIMESTAMP_LTZ bounds to a table with orc.timestamp-ltz.legacy.type=false. A timestamp equality query planned and read one file on main. This head plans two and reports zero data-stat prunes. I disabled the optional file index to isolate manifest pruning. A time-range query on a modern ORC table without file indexes now has to open every candidate file. Honor the legacy mode in file and key statistics, as the file-index evaluator does, and keep the fallback for legacy files with unknown writer offsets.
There was a problem hiding this comment.
Fixed in b2834c7. The manifest reader now passes the table's legacy-mode setting into both value and key statistics, including schema-evolution and data-evolution paths. The scan regression disables file indexes, commits two ORC entries with disjoint bounds, and checks the planned filenames and pruning count in both modes. There is also a key-only assertion so value statistics cannot hide a key-stat regression.
| // Arrow casts can merely relabel timezone metadata. Legacy Java Paimon | ||
| // instead adds the JVM offset to the stored UTC instant's numeric value. | ||
| if let ArrowDataType::Timestamp(unit, Some(_)) = array.data_type() { | ||
| let arrow_zone = java_ltz_zone_id(zone); |
There was a problem hiding this comment.
[P2] Accept JVM SystemV time-zone IDs. With -Duser.timezone=SystemV/EST5, Corretto 17 exposes that exact ID through TimeZone.getDefault(). It gives a −05:00 offset for 2024-01-15T12:30:00Z. Reading a physical ORC file with the same ID fails with Invalid legacy ORC LTZ zone SystemV/EST5. The EST control reads 07:30:00. Please support the JVM IDs with their fixed offsets or recurring DST rules and cover both kinds in the ORC read tests.
There was a problem hiding this comment.
Fixed in b2834c7. All seven fixed-offset and six daylight-saving SystemV IDs now follow OpenJDK's jdk11_backward rules, including the exceptional 1974 and 1975 dates. The physical ORC test covers SystemV/EST5 and SystemV/EST5EDT in winter and summer, and a boundary test checks the second before and at the transitions.
| .get_or_init(|| java_raw_offset_seconds(arrow_zone, tz)) | ||
| } else { | ||
| i64::from( | ||
| tz.offset_from_utc_datetime(&utc.naive_utc()) |
There was a problem hiding this comment.
[P2] Apply recurring DST rules past the generated transition range. A physical ORC timestamp of 2100-07-01T12:30:00Z with America/New_York reads 07:30 here. Corretto 17's TimeZone.getOffset returns −04:00, so Java Paimon reads 08:30. The generated chrono-tz transitions stop at the end of 2099 and Rust falls back to the winter offset for this supported timestamp. Evaluate recurring transitions for the supported date range or reject dates outside the available rules explicitly.
There was a problem hiding this comment.
Fixed in b2834c7. Named zones now use Jiff with bundled TZif data, including the recurring rules after the last explicit transition. The ORC test reads winter and summer instants in 2100 and checks that America/New_York maps July 1 at 12:30 UTC to 08:30. The pre-1900 Java raw-offset behavior is still covered. All 15 upstream CI jobs passed on this revision, including the Linux, macOS and Windows unit suites.
Read legacy ORC instants with the configured JVM time zone, including Java short IDs and GMT-prefixed fixed offsets. Use the JVM raw offset before 1900 and the offset at the instant for later dates. Cover seasonal offsets, the historical cutoff, nulls, and nested timestamps. Keep legacy LTZ predicates out of raw UTC stats pruning. Keep writer-side file indexes from pruning legacy ORC LTZ values before normalization. Retain independent conjuncts and null checks, and cover the default index-enabled scan with an indexed physical ORC file. Apply legacy bounds handling only in legacy mode. Use bundled TZif rules for future timestamps and support the OpenJDK SystemV zones. Co-Authored-By: Codex <noreply@openai.com> AI-Model: gpt-6 AI-Contributed/Feature: 319/319 AI-Contributed/UT: 0/0
c295377 to
b2834c7
Compare
Purpose
Closes #1513.
Read legacy ORC timestamps with the same time-zone interpretation as Java Paimon. A fixed offset would return the wrong value across a daylight-saving transition.
Brief change log
orc.timestamp-ltz.legacy.typeand allow callers to supplyorc.timestamp-ltz.legacy.time-zone, with UTC as the default.Tests
Added coverage for pre-epoch and subsecond timestamps, nulls, winter and summer offsets in New York, and explicitly disabled legacy mode.
Local verification passed with
cargo build --locked -p paimon --libandcargo fmt --all -- --check. Test execution is left to upstream CI.API and Format
Callers can supply the legacy time zone as a table option. The ORC file encoding is unchanged.
Documentation
For legacy files, set
orc.timestamp-ltz.legacy.time-zoneto the time zone used by the Java reader, such asAmerica/New_York. Settingorc.timestamp-ltz.legacy.type=falsedisables the adjustment.