ClickHouse: DAY_OF_WEEK is read as DayOfWeek, so every call is written back as toDayOfWeek(t, 3)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 68/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
調査の方向性
Start by tracing how the ClickHouse parser maps DAY_OF_WEEK and how DayOfWeek stores its arguments; compare that path with the correctly round-tripping DAYOFWEEK spelling. Run the reproductions in the issue and inspect the related ClickHouse parsing and generation tests. Done when calls with no mode and with modes 1, 2, or 3 round-trip with their documented results preserved.
索引モデルが issue の本文から書いたものです。
説明
ClickHouse documents DAY_OF_WEEK as an alias of toDayOfWeek, like dayOfWeek and DAYOFWEEK. SQLGlot reads DAY_OF_WEEK as DayOfWeek (Sunday = 1) instead, so every call, with or without a mode, is written back as mode 3:
import sqlglot
for sql in ["SELECT DAY_OF_WEEK(t)", "SELECT DAY_OF_WEEK(t, 1)", "SELECT DAY_OF_WEEK(t, 2)"]:
print(sqlglot.transpile(sql, read="clickhouse", write="clickhouse")[0])
# SELECT toDayOfWeek(t, 3)
# SELECT toDayOfWeek(t, 3)
# SELECT toDayOfWeek(t, 3)
The other spellings round-trip correctly:
sqlglot.transpile("SELECT DAYOFWEEK(t)", read="clickhouse", write="clickhouse")
# ['SELECT toDayOfWeek(t)']
sqlglot.transpile("SELECT DAYOFWEEK(t, 2)", read="clickhouse", write="clickhouse")
# ['SELECT toDayOfWeek(t, 2)']
Expected: DAY_OF_WEEK(t) reads like toDayOfWeek(t) (mode 0, Monday = 1 … Sunday = 7), and DAY_OF_WEEK(t, mode) keeps its mode. The mode changes the numbering: 0 Monday = 1 … 7, 1 Monday = 0 … 6, 2 Sunday = 0 … 6, 3 Sunday = 1 … 7. So the rewrite to mode 3 changes the result of DAY_OF_WEEK(t) on every day of the week.
DayOfWeek holds this and zero_based, so a two-argument call passes the arity check and the mode is dropped silently.
Docs: https://clickhouse.com/docs/reference/functions/regular-functions/date-time-functions (toDayOfWeek: "Aliases: DAYOFWEEK, DAY_OF_WEEK", and its mode table).
Checked on 30.37.0. I used an LLM (Claude) to help narrow this down and write it up.
- 主要言語
- Python
- スター
- 9.8k
- フォーク
- 1.5k
- 平均マージ
- 10時間 54分
- マージ済み PR(30日)
- 310
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
tobymao/sqlglot のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
ClickHouse: quantile is read as the exact Quantile, though ClickHouse's quantile is approximateオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
Oracle: qualify quotes USER, UID, ORA_ROWSCN and CONNECT_BY_ISLEAF/ISCYCLE as if they were columns対応中かも @georgesittas が今日担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
tobymao/sqlglot#9468 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
INTERVAL '1 day ago' loses "ago" and becomes a positive interval対応中かも @treysp が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
tobymao/sqlglot の issue をすべて見る
似ている issue
-
Make the "%" unit spacing the same in the web and in A10対応中かも @kragent66-glitch が今日担当しました。 オープンbug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
maiychrus25/OpenTea-DX-OS#226 · コメント 1 件 ·
-
ci severity: low
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
TMHSDigital/Spackle#205 ·
メンテナーはふだん 1 日以内に返信
-
pkg:lgm type:chore upstream-gaussx
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
jejjohnson/pyrox#610 ·
メンテナーはふだん 1 日以内に返信
-
changelog investigate
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
ramnes/notion-sdk-py#523 ·
-
feature-request
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
open-telemetry/opentelemetry-python#5994 ·
メンテナーはふだん 2 日以内に返信