apache / apache/datafusion-sqlparser-rs
Time travel support
- 主要语言
- Rust
- 星标
- 3.5k
- 派生
- 772
- 平均合并
- 4 天 9 小时
- 30 天内合并 PR
- 17
描述
Several databases and data lakes support time travel which allows historical versions of a table to be queried. Regrettably, syntax and capabilities do not seem to be terribly consistent across the various implementations.
## Querying Historical Times
This option lets a database be queried as it existed at a certain point in time. (*Question:* Is this "last version prior to the given time"? or is it an error if no snapshot exists with that exact time?)
### [Databricks](https://docs.databricks.com/gcp/en/delta/history#delta-time-travel-syntax)
```
SELECT * FROM people10m TIMESTAMP AS OF '2018-10-18T22:15:12.013Z';
```
### [Snowflake](https://docs.snowflake.com/en/sql-reference/constructs/at-before)
```
SELECT * FROM my_table AT(TIMESTAMP => 'Wed, 26 Jun 2024 09:20:00 -0700'::TIMESTAMP_LTZ);
```
### [Cockroach](https://www.cockroachlabs.com/blog/time-travel-queries-select-witty_subtitle-the_future/)
```
SELECT * FROM t AS OF SYSTEM TIME '2016-06-15 12:45:00'
```
### [DuckLake](https://ducklake.select/docs/stable/duckdb/usage/time_travel.html)
```
SELECT * FROM tbl AT (TIMESTAMP => now() - INTERVAL '1 week');
```
## Querying Specific versions
This options lets a specific "version" of a database to be queried. What exactly this means seems to depend on the database implementation in question.
### Databricks
```
SELECT * FROM people10m VERSION AS OF 123;
```
### Snowflake
Note: unclear if this is the same thing (specific versions) or different
```
SELECT * FROM my_table BEFORE(STATEMENT => '8e5d0ca9-005e-44e6-b858-a8f5b37c5726');
```
### Cockroach
Unsupported
### DuckLake
```
SELECT * FROM tbl AT (VERSION => 3);
```
贡献指南
这个仓库没有索引到贡献指南
调研方向
issue 中未确定任何仓库文件、测试或入口点。首先比较 Databricks、Snowflake、Cockroach 和 DuckLake 的语法,并确定历史时间查询和版本查询应共享语义,还是保留为特定方言的语义。完成项应包括对受支持语法和行为范围达成一致。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- rust, sql
- 领域
- compilers
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100