Repository navigation
Conversation
|
Run Gluten Clickhouse CI on x86 |
|
🔄 Delta Spark UT started by @felipepessoto (~2.5 h). View run |
|
Run Gluten Clickhouse CI on x86 |
2 similar comments
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
1 similar comment
|
Run Gluten Clickhouse CI on x86 |
There was a problem hiding this comment.
🟡 Changes recommended
A newly added Velox round-trip test uses millisecond-precision timestamps despite declaring microsecond precision, weakening coverage for the intended NTZ precision behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Enables native handling of TIMESTAMP_NTZ (Spark) / TIMESTAMP_UTC (Velox) in aggregation and related Delta statistics collection paths for the Velox backend, reducing Spark fallbacks and unblocking Delta stats plans previously rejected due to NTZ types.
Changes:
- Extend the
TimestampNTZfallback validator to allow aggregates, shuffles, and direct NTZ projections needed by Delta stats plans. - Accept
TimestampNTZTypein aggregation buffer type checks and preserve a distinct native signature token (tsntz) plus SubstraitPrecisionTimestampencoding. - Add native regression coverage (Spark UT + Velox C++ tests) and remove now-fixed Delta data-skipping cases from the known-failure baseline.
File summaries
| File | Description |
|---|---|
| gluten-ut/spark41/src/test/scala/org/apache/spark/sql/GlutenTimestampNtzAggregateSuite.scala | Adds Spark 4.1 regression coverage for NTZ min/max aggregation and a projection fallback case. |
| gluten-ut/spark41/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala | Enables the new Spark 4.1 UT suite in Velox test settings. |
| gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/validator/Validators.scala | Broadens NTZ fallback validation to permit additional plan nodes/expressions used by native stats aggregation. |
| gluten-substrait/src/main/scala/org/apache/gluten/expression/ConverterUtils.scala | Maps Spark TimestampNTZType to Substrait timestamp NTZ type node and uses tsntz in signature naming. |
| gluten-substrait/src/main/scala/org/apache/gluten/execution/HashAggregateExecBaseTransformer.scala | Allows TimestampNTZType in supported aggregation buffer type checks. |
| cpp/velox/tests/VeloxToSubstraitTypeTest.cc | Adds a type-conversion test for TIMESTAMP_UTC -> Substrait PrecisionTimestamp. |
| cpp/velox/tests/VeloxSubstraitSignatureTest.cc | Adds tsntz signature coverage for TIMESTAMP_UTC mapping in both directions. |
| cpp/velox/tests/VeloxSubstraitRoundTripTest.cc | Adds a min/max aggregation round-trip test over TIMESTAMP_UTC. |
| cpp/velox/substrait/VeloxToSubstraitType.cc | Encodes TIMESTAMP_UTC as Substrait precision_timestamp(6). |
| cpp/velox/substrait/VeloxSubstraitSignature.cc | Maps TIMESTAMP_UTC to/from the tsntz signature token. |
| backends-velox/src-delta40/test/scala/org/apache/spark/sql/delta/GlutenDeltaStatsSuite.scala | Adds Delta 4.0 stats regression coverage including nested NTZ columns. |
| backends-velox/src-delta33/test/scala/org/apache/spark/sql/delta/GlutenDeltaStatsSuite.scala | Adds Delta 3.3 stats regression coverage including nested NTZ columns. |
| .github/workflows/util/delta-spark-ut/known-failures.txt | Removes Delta data-skipping known failures resolved by native NTZ stats aggregation support. |
Review details
- Files reviewed: 13/13 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@Mariamalmesfer @rui-mo I think you two have worked on other timestamp_ntz PRs. Could you take a look, please? |
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Suppressed comments (1)
gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/validator/Validators.scala:1
- The previous implementation used
dataType.typeName == "timestamp_ntz", which is resilient across Spark versions/shims. Switching to a directTimestampNTZTypereference introduces a compile-time dependency that can break builds for Spark variants whereTimestampNTZTypeis absent or shaded differently. If this module is cross-built across multiple Spark versions, consider keeping a version-tolerant check (e.g., matchTimestampNTZTypewhen available and fall back totypeName), ideally via a shim utility.
/*
|
Run Gluten Clickhouse CI on x86 |
There was a problem hiding this comment.
🟢 Approval recommended
The changes are cohesive and well-covered by targeted Spark + native regression tests, and the updated validator/signature/type mappings are consistent across JVM and C++ paths.
Review details
- Files reviewed: 13/13 changed files
- Comments generated: 0 new
- Review effort level: Lite
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
Review effort: Lite
Findings: 2
Open (7)
toSubstraitTypeunconditionally setsPrecisionTimestampnullability toNULLABLEfor… · New Nullability is being hard-coded toNULLABILITY_NULLABLEforTIMESTAMP_UTC. This can… This test validates precision and type equivalence but doesn’t assert nullability behavior. Add… · New This assertion is brittle because it requires everyBaseAggregateExecin the executed plan to… This introduces a JVM-global, mutable observer that can be accessed from multiple task threads.…scala.collection.JavaConverters._is deprecated on Scala versions that provide… · New The Delta 3.3 and Delta 4.0 versions ofGlutenDeltaStatsSuiteappear to be identical in this PR.…
| if (type->equivalent(*velox::TIMESTAMP_UTC())) { | ||
| auto substraitPrecisionTimestamp = | ||
| google::protobuf::Arena::CreateMessage<::substrait::Type_PrecisionTimestamp>(&arena); | ||
| substraitPrecisionTimestamp->set_precision(6); | ||
| substraitPrecisionTimestamp->set_nullability(::substrait::Type_Nullability_NULLABILITY_NULLABLE); | ||
| substraitType->set_allocated_precision_timestamp(substraitPrecisionTimestamp); | ||
| return *substraitType; | ||
| } |
There was a problem hiding this comment.
This converter currently accepts only (arena, type) , with no nullability argument. The parser does not retain nullability in the Velox type, and existing conversion branches—including ordinary TIMESTAMP —also emit NULLABLE . Local probes confirmed that required inputs become nullable for both timestamp types, so this behavior is not introduced by the NTZ branch. @rui-mo, should we open a separate issue to track preserving schema nullability end to end, since this is existing converter-wide behavior?
|
Run Gluten Clickhouse CI on x86 |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Observe the task-local statistics plan in tests and require native aggregate offload in both Delta variants. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add grouped min/max coverage with TIMESTAMP_NTZ keys and values. Check exact per-key results and require every aggregate stage to use native execution with an NTZ grouping key. Clarify that disabling TimestampNTZ validation permits supported scans, aggregates, shuffles and projections while other validation rules still apply. Regenerate the public configuration reference. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Describe the high-level fallback behavior of enableTimestampNtzValidation without enumerating the evolving set of supported operators and expressions. Keep the other-validation caveat and regenerate the public configuration reference. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Allow IsNotNull alongside IsNull using the existing NTZ projection allowlist pattern. Add coverage for both null predicates and a compound projection, checking results and native execution when validation is disabled while preserving Spark fallback when it is enabled. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
8f6587c to
92e2698
Compare
|
Run Gluten Clickhouse CI on x86 |
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The cross-language type, signature, aggregation, and Delta changes require final human review.
Review effort: Lite
Findings: 1
Resolved since last review (6)
Nullability is being hard-coded toNULLABILITY_NULLABLEforTIMESTAMP_UTC. This can… This test validates precision and type equivalence but doesn’t assert nullability behavior. Add… This assertion is brittle because it requires everyBaseAggregateExecin the executed plan to… This introduces a JVM-global, mutable observer that can be accessed from multiple task threads.…scala.collection.JavaConverters._is deprecated on Scala versions that provide… The Delta 3.3 and Delta 4.0 versions ofGlutenDeltaStatsSuiteappear to be identical in this PR.…
…ng MERGE's parents on Spark, 42 already gone on main The delta_spark_ut run on 45bd4ad reports zero regressions and these now-passing entries: - 40 ImplicitMergeCastingSuite "MERGE overflow in WHEN MATCHED THEN UPDATE" cases. With only the guard, Spark's write projection raised SparkArithmeticException [CAST_OVERFLOW] as expected, but the RowToVeloxColumnar feeding the native filter above it wrapped that in a GlutenException, so the tests saw the wrong exception type. Keeping the filter and column drop on Spark removes the transition and the original exception propagates. - 42 DataSkippingDeltaV1* TIMESTAMP_NTZ cases, which apache#12967 fixed and removed from the baseline on main after this branch was cut; CI tests the merge with main, so they only show against this branch's copy of the file. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Preserve NTZ logical types and microsecond values across JVM, Substrait and Velox literal conversion. Distinguish timestamp from timestamp_tz, retain complete types for null literals, and handle scalar vector-backed constants without a virtual-table container. Connect the existing JVM NTZ literal node to the literal factory and nested type handling. Include the NTZ type mapping required by independent literal and Values round trips, with dedicated native and Spark 4.1 regression coverage. Follow-up to apache#12967 (comment) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Spark `to_json` currently applies the session timezone to `TIMESTAMP_UTC` (`TIMESTAMP_NTZ`) values and appends an offset. For example, in an `America/Los_Angeles` session:
```sql
SELECT to_json(named_struct('ts', TIMESTAMP_NTZ '2024-01-01 00:00:00.123456'));
```
```text
Before: {"ts":"2023-12-31T16:00:00.123-08:00"}
After: {"ts":"2024-01-01T00:00:00.123"}
```
Use timezone-free formatting for NTZ values, including values nested in collections. Ordinary timestamp formatting and timestamp map-key encoding are unchanged.
This follows [Spark's NTZ JSON formatting](https://github.com/apache/spark/blob/v4.1.1/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JacksonGenerator.scala#L147-L156) and addresses serializer behavior exposed while reviewing apache/gluten#12967.
Generated-by: GitHub Copilot CLI 1.0.83
Differential Revision: D125968265
Pull Request resolved: #19199
Preserve NTZ logical types and microsecond values across JVM, Substrait and Velox literal conversion. Distinguish timestamp from timestamp_tz, retain complete types for null literals, and handle scalar vector-backed constants without a virtual-table container. Connect the existing JVM NTZ literal node to the literal factory and nested type handling. Include the NTZ type mapping required by independent literal and Values round trips, with dedicated native and Spark 4.1 regression coverage. Follow-up to apache#12967 (comment) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>



What changes are proposed in this pull request?
Enable native
min/maxaggregation for SparkTIMESTAMP_NTZin the Velox backend, including the task-localSortAggregateExecused to collect Delta write statistics.The implementation reuses Velox's existing Spark timestamp min/max kernels rather than introducing new aggregate kernels.
TIMESTAMP_NTZremains represented by the distinct VeloxTIMESTAMP_UTClogical type, with microsecond precision (Velox implementation, Spark registration).TimestampNTZTypein aggregate buffer/result and grouping type checks, and allow aggregate, shuffle, and the projection expressions needed by Delta statistics through the coarse NTZ fallback validator. Existing native function validation remains in place.tsntzas the internal function-signature token. The previousts_ntztoken collides with_, which the native signature parser uses to separate argument types (parser).TIMESTAMP_UTCas SubstraitPrecisionTimestampwith precision6during type round-tripping.This addresses the NTZ aggregation failure encountered by the Delta statistics tracker in #12538. It does not implement a general fallback for arbitrary unsupported statistics plans or claim support for every NTZ expression. DATE/TIMESTAMP_NTZ cast support is handled separately in #12966.
Related #11622
How was this patch tested?
6, and preservation of microsecond values using Spark min/max.GlutenTimestampNtzAggregateSuiteon Spark 4.1 checks native SQL min/max execution and microsecond results, plus Spark fallback for NTZ JSON serialization in a non-UTC session timezone.GlutenDeltaStatsSuiteon Spark 3.5/Delta 3.3 and Spark 4.1/Delta 4.x checks writes and read-back of top-level and nested NTZ columns, with exact JSON-path assertions for their min/max statistics.DateFunctionsValidateSuitecoverage exercises NTZ scalar functions after the signature-token change.Was this patch authored or co-authored using generative AI tooling?
Generated-by: GitHub Copilot CLI 1.0.83