SQLite: day intervals on an expression of unknown type drop the time
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 65/100
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 9.8k
- フォーク
- 1.4k
- 平均マージ
- 10時間 52分
- マージ済み PR(30日)
- 303
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
tobymao/sqlglot のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
tobymao/sqlglot の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
py-econometrics/pyfixest#2072 ·
メンテナーはふだん 1 日以内に返信
-
~planning docs
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
Kromatic-Innovation/athenaeum#3084 ·
メンテナーはふだん 1 日以内に返信
-
Bosch Room Thermostat II number entities offer -500 to 3000 °C setpoint limits and a -32768 to 32767 °C outdoor temperature対応中かも @zigpy-review-bot が今日担当しました。 オープンbot: code audit
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
zigpy/zha-device-handlers#5769 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 80/100
R0Y00/Xbox2Windows#254 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
Kludex/python-multipart#375 ·
メンテナーはふだん 1 日以内に返信