Repository navigation
[GLUTEN-12538][VL] Support native TIMESTAMP_NTZ Delta writes - #13512
felipepessoto wants to merge 3 commits into
Conversation
|
Run Gluten Clickhouse CI on x86 |
There was a problem hiding this comment.
🔵 Needs a closer look
Shared Arrow and Parquet changes affect non-Delta consumers and depend on pinned Velox behavior unavailable in this checkout, requiring human review of broader native integration and regression validation.
No open issues 🎉
What changed in this PR
Enables native Velox Delta writes for TIMESTAMP_NTZ, including nested and mixed timestamp schemas. Statistics fallback and NTZ literal preservation remain separate work.
Changes:
- Preserve NTZ semantics across Arrow and Parquet schemas, prepare null-struct payloads safely, and retain microsecond precision when generating partition IDs.
- Remove Delta 4’s blanket NTZ rejection while retaining existing writer gates, and allow field-access projections through mixed NTZ structs.
- Add native and Spark regression coverage and document supported behavior and remaining limitations.
| File | Description |
|---|---|
gluten-ut/spark35/src-delta/test/scala/org/apache/spark/sql/execution/datasources/GlutenDeltaTimestampNtzWriteSuite.scala |
Tests native writer provenance, schemas, values, statistics, and partitions against Spark writes. |
gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/validator/Validators.scala |
Allows field access and null predicates through mixed NTZ structs. |
gluten-arrow/src/main/scala/org/apache/spark/sql/utils/SparkArrowUtil.scala |
Preserves NTZ logical-type metadata in Arrow fields. |
docs/backends/velox/get-started/VeloxDelta.md |
Documents native NTZ writing, gates, and remaining limitations. |
cpp/velox/utils/VeloxWriterUtils.h |
Declares schema, input-preparation, and partition-key helpers. |
cpp/velox/utils/VeloxWriterUtils.cc |
Implements NTZ schema reconstruction, null-struct preparation, and microsecond partition keys. |
cpp/velox/tests/VeloxWriterUtilsTest.cc |
Tests schema semantics, timestamp precision, and non-mutating input preparation. |
cpp/velox/tests/CMakeLists.txt |
Registers the writer utility tests. |
cpp/velox/operators/writer/VeloxParquetDataSource.cc |
Applies the schema and input-preparation helpers when writing Parquet. |
cpp/velox/jni/VeloxJniWrapper.cc |
Uses exact timestamp microseconds for partition ID generation. |
backends-velox/src-delta4/test/scala/org/apache/gluten/execution/VeloxDelta4WriteSuite.scala |
Checks native NTZ writes and explicit validation fallback. |
backends-velox/src-delta4/test/scala/org/apache/gluten/delta/GlutenDeltaNativeWriteGateSuite.scala |
Tests nested NTZ eligibility and retained encoding and validation gates. |
backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaNativeWriteGate.scala |
Removes the blanket NTZ writer rejection. |
Review effort: Balanced
8c51593 to
db9060c
Compare
|
Run Gluten Clickhouse CI on x86 |
db9060c to
101864c
Compare
|
Run Gluten Clickhouse CI on x86 |
101864c to
07cba69
Compare
|
Run Gluten Clickhouse CI on x86 |
07cba69 to
16d256d
Compare
|
Run Gluten Clickhouse CI on x86 |
1 similar comment
|
Run Gluten Clickhouse CI on x86 |
864bbeb to
b235a83
Compare
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
8d001b1 to
e98a1f3
Compare
|
Run Gluten Clickhouse CI on x86 |
e98a1f3 to
758c7f4
Compare
|
Run Gluten Clickhouse CI on x86 |
Preserve NTZ schemas through Arrow and native Parquet writing, prepare null nested values safely at the writer boundary, and group timestamp partitions at microsecond precision. Keep ordinary timestamp semantics and existing fallback gates, with native and independent Spark regression coverage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Move the Arrow-specific schema regression out of the shared Delta suite so ClickHouse test compilation does not require gluten-arrow. Preserve the metadata, round-trip, and native writer assertions without adding backend dependencies. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…writes Keep physical nested field names intact and read shuffle key types directly from the Spark C schema before Arrow loses map-key metadata. Mark corrected-calendar Parquet footers without rewriting data pages. Validate NTZ projections per expression branch so a supported null predicate cannot exempt its siblings. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
758c7f4 to
ff96f33
Compare
|
Run Gluten Clickhouse CI on x86 |
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
ff96f335479906882d087e030ea5dc3532427316↓ The x86 Spark 4.1 MERGE test is red. Running one task at a time reproduced the same wrapped NOT NULL exception twice on the PR and twice on unmodified
main.What changes are proposed in this pull request?
Relates to #11622 and #12538.
Velox writes Delta
TIMESTAMP_NTZcolumns as Parquet microseconds withisAdjustedToUTC=false, including nested fields. OrdinaryTIMESTAMPcolumns in the same file retainisAdjustedToUTC=true. This changes data-file writing, not Delta’s statistics fallback (#13510).Merge order: I’ll keep this PR in draft until #13756 (Arrow timestamp tagging) and #13757 (NTZ operator validation) merge. Then I’ll rebase, drop the shared changes they cover, and keep only what the Delta writer still needs, including its regression tests.
How was this patch tested?
All 36 focused Arrow, write-gate, and validator checks passed on the rebased sources, including nested NTZ fields alongside strings and binary data with either Arrow offset width. Earlier Spark 3.5 and 4.1 runs verified native Parquet footers and compared rows, partition paths, and file statistics against vanilla Spark. Regressions cover shuffled NTZ map keys, nested field names, calendar rebasing, and null checks that must not enable unsupported expressions.
Was this patch authored or co-authored using generative AI tooling?
Generated-by: GitHub Copilot (GPT-6 Astra and GPT-6.2 Astra)