rexminnis opened a new pull request, #2486:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2486

   Stacked on #2485; only the last commit is new here, and I will rebase once 
that one lands.
   
   Trino spells time travel on Iceberg and Delta tables with a leading `FOR`:
   
   ```sql
   SELECT * FROM t FOR TIMESTAMP AS OF TIMESTAMP '2026-01-01 00:00:00 UTC'
   SELECT * FROM t FOR VERSION AS OF 8954597067493422955
   SELECT * FROM t FOR VERSION AS OF 'my-branch'
   ```
   
   https://trino.io/docs/current/connector/iceberg.html#time-travel-queries
   
   The parser already accepts the Databricks forms without `FOR` behind 
`supports_table_versioning`. This adds `TableVersion::ForTimestampAsOf` and 
`TableVersion::ForVersionAsOf` with their own `Display`, behind a new 
`Dialect::supports_for_table_version` hook that `TrinoDialect` opts into, so a 
statement round-trips in the spelling its engine accepts. `VERSION AS OF` keeps 
its numeric-only argument; the `FOR` form takes an expression because Iceberg 
accepts a branch or tag name there. Databricks keeps rejecting the `FOR` forms, 
as its existing test asserts.
   
   One pre-existing issue noticed on the way, left for a separate change: an 
alias after a version clause parses, but the canonical form prints the alias 
first (`t AS a FOR VERSION AS OF 1`), which no engine accepts.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to