apache / apache/datafusion-sqlparser-rs

Time travel support

Đang mở
#2,006 1 bình luận 2 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rust
Star
3.5k
Fork
772
Merge trung bình
4 ngày 9 giờ
Pull request đã merge (30 ngày)
17

Mô tả

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);
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Issue không xác định tệp repository, bài kiểm thử hoặc entry point nào. Hãy bắt đầu bằng cách so sánh cú pháp của Databricks, Snowflake, Cockroach và DuckLake, đồng thời xác định liệu các truy vấn theo thời điểm lịch sử và truy vấn phiên bản có nên dùng chung ngữ nghĩa hay vẫn giữ đặc thù theo dialect. Phần hoàn tất cần bao gồm phạm vi đã thống nhất cho cú pháp và hành vi được hỗ trợ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
rust, sql
Lĩnh vực
compilers
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.