Skip to content

Add syntax to support version/timestamp range travel in Trino  #17079

@agnes-xinyi-lu

Description

@agnes-xinyi-lu

Currently Trino does not support version/timestamp range travel. In previous issue #6988 there was already a design doc and discussion about the syntax we could use to support time travel(including the range).
This thread is to propose adding syntax for the FromTo expression:

SELECT * FROM <Database>.<Table>
FOR <RangeType> FROM <RangeUnit> TO <RangeUnit>
WHERE <Predicate>`

Which should yield all the rows with a start time after the FROM version, and an end time before or equal to the TO version, according to SQL Standard.

Since QueryPeriod is already well implemented in place, the change will only require us to add the syntax in SqlBase.g4 and adjust a few places in the parser to check the existence of startVersion.

Iceberg has added support for changelog scan, which supports querying changelog in a range with the end version included. We wanted syntax to be ready to support it in Trino.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions