apache / apache/datafusion-sqlparser-rs
Time travel support
- Lenguaje dominante
- Rust
- Estrellas
- 3.5k
- Forks
- 772
- Merge medio
- 4 d 9 h
- PR fusionados (30 d)
- 17
Descripción
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);
```
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
En el issue no se identifican archivos del repositorio, pruebas ni puntos de entrada. Empieza comparando la sintaxis de Databricks, Snowflake, Cockroach y DuckLake y resuelve si las consultas de tiempo histórico y de versiones deben compartir semántica o seguir siendo específicas del dialecto. La finalización debe incluir un alcance acordado para la sintaxis y el comportamiento compatibles.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- rust, sql
- Área
- compilers
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 25/100