Skip to content

feat!: add temporal extension literals#152

Draft
wackywendell wants to merge 1 commit into
literal-structure-refactorfrom
temporal-extension-literals-v2
Draft

feat!: add temporal extension literals#152
wackywendell wants to merge 1 commit into
literal-structure-refactorfrom
temporal-extension-literals-v2

Conversation

@wackywendell

Copy link
Copy Markdown
Collaborator

Description

This PR adds first-class extension argument support for temporal typed literals, for example:

ExtensionLeaf:TemporalLiteralTest[
  created_at='2023-01-01T12:00:00':timestamp,
  watermark='2023-01-01T12:00:00.123456789':precisiontimestamptz<9>
  => value:string
]

Those arguments are represented as ExtensionValue::Literal(ExtensionLiteral) instead of a generic expression value. Extension handlers can still request them as Expr; the literal widens to a normal Substrait literal expression in that case.

Changes

  • Added ExtensionLiteral, backed by substrait::proto::expression::Literal.
  • Added temporal constructors such as date_days, time_micros, timestamp_micros, precision_time_units, precision_timestamp_units, and precision_timestamp_tz_utc.
  • Added TryFrom<Literal> for ExtensionLiteral so the supported literal-kind policy lives with ExtensionLiteral, not in parser control flow.
  • Split the grammar into typed_literal and untyped_literal so extension argument parsing can match typed literals directly.
  • Kept unsupported typed literals such as 42:i16 as expression values.
  • Added parsing and textification for precisiontime<N>, precisiontimestamp<N>, and precisiontimestamptz<N> literals, building on trunk's existing precision temporal type parser.
  • Added extension roundtrip coverage for temporal literal arguments.

API Impact

This is a breaking change for extension handlers that expected temporal typed literal arguments to arrive only as Expr. Those values now arrive as ExtensionValue::Literal, but handlers can still request Expr through ArgsExtractor.

This also adds a new public extension argument type, ExtensionLiteral.

Validation

  • cargo check
  • just fmt
  • just check
  • cargo test --doc
  • just test
  • git verify-commit a185f25e237e 9bf90c0eb687

@wackywendell wackywendell force-pushed the temporal-extension-literals-v2 branch from 9bf90c0 to 3c0fbdf Compare June 17, 2026 13:42
@wackywendell wackywendell force-pushed the literal-structure-refactor branch from a185f25 to 029332f Compare June 17, 2026 13:42
@wackywendell wackywendell force-pushed the temporal-extension-literals-v2 branch 2 times, most recently from c7ccc59 to eda989e Compare June 26, 2026 18:24
@wackywendell wackywendell force-pushed the literal-structure-refactor branch from 029332f to ccd533f Compare June 26, 2026 18:24
@wackywendell wackywendell force-pushed the literal-structure-refactor branch from ccd533f to 1a1cd7c Compare July 8, 2026 15:49
@wackywendell wackywendell force-pushed the temporal-extension-literals-v2 branch from eda989e to 0e87426 Compare July 8, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant