Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,11 @@ Untyped scalar extension literals such as `2` or `'path'` are represented as
scalar `ExtensionValue` variants and render without expression type suffixes,
even in verbose output. The same values can still be requested as `Expr` through
`ArgsExtractor`, which widens them to default non-nullable Substrait literal
expressions. Typed literals, field references, function calls, and casts are
represented as expression values.
expressions. Temporal typed literals such as `'2024-01-01':date` or
`'2024-01-01T12:34:56.123456':precisiontimestamp<6>` are represented as
`ExtensionLiteral` values and can also be requested as `Expr`. Other typed
literals, field references, function calls, and casts are represented as
expression values.

`ExtensionProtoConvert` converts between extension arguments and Substrait
protobuf values in either direction, such as output columns and relation
Expand Down
19 changes: 12 additions & 7 deletions GRAMMAR.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,11 @@ A literal can be an integer, float, boolean, string, or null. Literals may inclu
- **`null`**` := "null"`
- Examples: `null:i64?`, `null:string?`, `null:date?`
- A type annotation is required for `null`
- **`typed_literal`**` := string ":" type`
- String literals with type annotations for non-primitive types
- Examples: `'2023-01-01':date`, `'2023-12-25T14:30:45.123':timestamp`
- **typed literal syntax**` := (float / integer / boolean / string / "null") ":" type`
- Literals with explicit type annotations, including string literals for non-primitive types
- Examples: `'2023-01-01':date`, `'2023-12-25T14:30:45.123':timestamp`, `'2023-12-25T14:30:45.123456789':precisiontimestamp<9>`

All basic literal types (`integer`, `float`, `boolean`, and `string`) are supported, plus `date`, `time`, `timestamp`, and typed null literals. Other Substrait literal types (e.g., `interval_year`, `decimal`, `uuid`) are not yet implemented.
All basic literal types (`integer`, `float`, `boolean`, `string`, and typed `null`) are supported, plus `date`, `time`, `timestamp`, `precisiontime<N>`, `precisiontimestamp<N>`, and `precisiontimestamptz<N>` typed literals. Other Substrait literal types (e.g., `interval_year`, `decimal`, `uuid`) are not yet implemented.

## Types

Expand Down Expand Up @@ -309,6 +309,9 @@ Root[result]
### Compound Types

Compound types follow the same syntax as standard Substrait parameterized types.
Precision temporal types use one integer parameter for precision:
`precisiontime<N>`, `precisiontimestamp<N>`, and `precisiontimestamptz<N>`,
where `N` is between `0` and `12`.

#### Examples

Expand Down Expand Up @@ -959,9 +962,11 @@ Untyped scalar extension arguments such as `2`, `2.4`, `true`, and `'path'`
are treated as extension scalar values and render without expression type
suffixes, even in verbose output. They can still be consumed by extension
handlers as expressions, in which case they widen to default non-nullable
Substrait literal expressions. Typed literals such as `2:i16` or
`'2024-01-01':date`, field references, function calls, and casts are expression
values.
Substrait literal expressions. Temporal typed literals such as
`'2024-01-01':date` and
`'2024-01-01T12:34:56.123456':precisiontimestamp<6>` are extension literal
values and can also widen to expression values. Other typed literals such as
`2:i16`, field references, function calls, and casts are expression values.

#### Examples

Expand Down
Loading