Skip to content

[GLUTEN-12538][CORE] Preserve TIMESTAMP_NTZ literals - #13041

Draft
felipepessoto wants to merge 3 commits into
apache:mainfrom
felipepessoto:gluten-12538-timestamp-ntz-literals
Draft

felipepessoto wants to merge 3 commits into
apache:mainfrom
felipepessoto:gluten-12538-timestamp-ntz-literals

Conversation

@felipepessoto

@felipepessoto felipepessoto commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

What changes are proposed in this pull request?

Preserve TIMESTAMP_NTZ literal types and values through the JVM/Substrait/Velox conversion paths. NTZ values use Substrait's timestamp literal field, while regular timestamps continue to use timestamp_tz.

The patch carries logical types into reverse literal conversion and handles scalar vector-backed constants without treating them as virtual-table output. Logical-type-aware null encoding is limited to timestamps and timestamp arrays; other null types keep their previous encoding. It also connects the existing JVM NTZ literal node to scalar, collection, and struct literal construction.

This is a separate follow-up to the literal-conversion review comment on #12967. It is based on main and includes the NTZ type mapping needed by its own literal and Values round trips. It does not include the aggregation validator, shuffle, or Delta statistics changes from that PR.

Related to #12538.

How was this patch tested?

Native conversion regressions check serialized literal fields, logical types, and exact microsecond values for scalar constants, vector-backed constants, typed nulls, Values plans, and array literals. Both regular timestamps and NTZ values are covered, including pre-epoch values. DATE scalar and array regressions protect the existing encoding, including comparisons of arrays with different leading-null positions.

The dedicated Spark 4.1 GlutenTimestampNtzLiteralSuite checks JVM scalar/array/struct literal serialization and a non-foldable timestampadd expression with native-plan assertions. Using a row-dependent expression prevents Spark constant folding from hiding the native literal path.

Existing related native conversion cases, formatting, and license-header checks were also run.

Was this patch authored or co-authored using generative AI tooling?

Generated-by: GitHub Copilot CLI 1.0.83

@github-actions github-actions Bot added CORE works for Gluten Core VELOX labels Sep 16, 2026
@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

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 <[email protected]>
@felipepessoto
felipepessoto force-pushed the gluten-12538-timestamp-ntz-literals branch from a518473 to a18c8f2 Compare September 16, 2026 23:58
@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

Restore the original physical-kind encoding for non-timestamp nulls so DATE array operands remain compatible regardless of null position. Preserve full logical types for timestamp nulls and timestamp arrays, including nested arrays.

Add DATE literal encoding and array round-trip regressions alongside timestamp-array null coverage.

Co-authored-by: Copilot <[email protected]>
@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

Reject expression-internal TIMESTAMP_NTZ on backends without NTZ support, including nested literals whose surrounding schemas hide the type. Preserve existing Velox behavior and cover backend capabilities, nested literal types, and native timezone independence.

Co-authored-by: Copilot <[email protected]>
@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CORE works for Gluten Core VELOX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant