SQLite: day intervals on an expression of unknown type drop the time
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 65/100
Línea de trabajo
Start by running the reproducer: sqlglot.transpile("SELECT ts + INTERVAL 1 DAY FROM t", read="duckdb", write="sqlite") and trace it into the SQLite dialect's interval generator, where day/week/month/year units choose DATE() while hour/minute/second use DATETIME(). Compare that path with the annotated-schema handling for DATE and TIMESTAMP columns. Add a regression case to the SQLite transpilation tests for unknown-type timestamp intervals; done means the output either keeps the time or reports the case as unsupported without changing known DATE/TIMESTAMP behavior.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
For an interval added to an expression of unknown type, the SQLite generator picks DATE() for day, week, month and year units, which drops the time of a value that holds a timestamp:
import sqlglot
sqlglot.transpile("SELECT ts + INTERVAL 1 DAY FROM t", read="duckdb", write="sqlite")
# ["SELECT DATE(ts, '1 DAY') FROM t"]
With t.ts holding '2024-01-15 23:30:00', SQLite returns '2024-01-16', while DuckDB (with ts TIMESTAMP) returns 2024-01-16 23:30:00. Hour, minute and second units already use DATETIME(), which keeps the time.
Without type information the generator can't tell date text from timestamp text, so either choice is wrong for one of them. It may be safer to flag the unknown-type case as unsupported, unless the caller annotates types with a schema, in which case DATE and TIMESTAMP columns are already handled correctly.
I found this while running BenchBox benchmarks on SQLite. The issue was drafted with Claude.
- Lenguaje dominante
- Python
- Estrellas
- 9.8k
- Forks
- 1.4k
- Merge medio
- 10 h 52 min
- PR fusionados (30 d)
- 303
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de tobymao/sqlglot
-
DuckDB generator: WITHIN GROUP percentile with a CAST fraction produces unbalanced parenthesesAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día
Todos los issues de tobymao/sqlglot
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
py-econometrics/pyfixest#2072 ·
Los mantenedores suelen responder en 1 día
-
~planning docs
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Kromatic-Innovation/athenaeum#3084 ·
Los mantenedores suelen responder en 1 día
-
Bosch Room Thermostat II number entities offer -500 to 3000 °C setpoint limits and a -32768 to 32767 °C outdoor temperaturePosiblemente ocupada @zigpy-review-bot la tomó hoy. Abiertobot: code audit
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
zigpy/zha-device-handlers#5769 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 Medio día Aptitud para principiantes 80/100
R0Y00/Xbox2Windows#254 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Kludex/python-multipart#375 ·
Los mantenedores suelen responder en 1 día