This is an automated email from the ASF dual-hosted git repository. lzljs3620320 pushed a commit to branch release-0.6 in repository https://gitbox.apache.org/repos/asf/incubator-paimon.git
commit b6789b490d37fc92ae0e9e4d4ad5694cdbc53f42 Author: shidayang <[email protected]> AuthorDate: Mon Dec 11 10:16:14 2023 +0800 [doc]Add doc for Trino time travel query (#2467) --- docs/content/engines/trino.md | 22 +++++++++++++++++++++- docs/content/how-to/querying-tables.md | 12 ++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/docs/content/engines/trino.md b/docs/content/engines/trino.md index 1a94a090a..053157c19 100644 --- a/docs/content/engines/trino.md +++ b/docs/content/engines/trino.md @@ -179,12 +179,32 @@ SELECT * FROM paimon.test_db.orders ``` ## Query with Time Traveling +{{< tabs "time-travel-example" >}} +{{< tab "version >=368" >}} + +```sql +-- read the snapshot from specified timestamp +SELECT * FROM t FOR TIMESTAMP AS OF TIMESTAMP '2023-01-01 00:00:00 Asia/Shanghai'; + +-- read the snapshot with id 1L (use snapshot id as version) +SELECT * FROM t FOR VERSION AS OF 1; ``` + +{{< /tab >}} + +{{< tab "version < 368" >}} + +```sql +-- read the snapshot from specified timestamp with a long value in unix milliseconds SET SESSION paimon.scan_timestamp_millis=1679486589444; -SELECT * FROM paimon.test_db.orders; +SELECT * FROM t; ``` +{{< /tab >}} + +{{< /tabs >}} + ## Trino to Paimon type mapping This section lists all supported type conversion between Trino and Paimon. diff --git a/docs/content/how-to/querying-tables.md b/docs/content/how-to/querying-tables.md index 0c852192b..8fa906431 100644 --- a/docs/content/how-to/querying-tables.md +++ b/docs/content/how-to/querying-tables.md @@ -127,6 +127,18 @@ SELECT * FROM t; {{< /tab >}} +{{< tab "Trino 368+" >}} + +```sql +-- read the snapshot from specified timestamp +SELECT * FROM t FOR TIMESTAMP AS OF TIMESTAMP '2023-01-01 00:00:00 Asia/Shanghai'; + +-- read the snapshot with id 1L (use snapshot id as version) +SELECT * FROM t FOR VERSION AS OF 1; +``` + +{{< /tab >}} + {{< tab "Hive" >}} Hive requires adding the following configuration parameters to the hive-site.xml file:
