BigQuery `JSON_KEYS` transpiles to `J_S_O_N_KEYS_AT_DEPTH` in DuckDB (missing generator transform)
维护者通常 4 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 55/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
调研方向
Start by reading sqlglot/dialects/duckdb.py and the BigQuery parsing path that produces exp.JSONKeysAtDepth; then look for nearby generator transforms and their tests. Check how the project handles unsupported arguments during transpilation. Done means the one-argument form emits DuckDB's json_keys(x), with an explicit, tested behavior for the depth argument.
由索引模型根据 Issue 内容生成。
描述
JSON_KEYS is parsed into exp.JSONKeysAtDepth by the BigQuery dialect, but the DuckDB generator has no transform registered for that expression. As a result, transpiling to DuckDB falls back to the class-name snake_case output, which is not a valid DuckDB function.
Version
sqlglot==28.10.1, also reproduces against main (30.4.3) per source inspection of sqlglot/dialects/duckdb.py.
Reproduction
from sqlglot import parse_one
print(parse_one("SELECT JSON_KEYS(x) FROM t", dialect="bigquery").sql(dialect="duckdb"))
# SELECT J_S_O_N_KEYS_AT_DEPTH(x) FROM t
print(parse_one("SELECT JSON_KEYS(x, 2) FROM t", dialect="bigquery").sql(dialect="duckdb"))
# SELECT J_S_O_N_KEYS_AT_DEPTH(x, 2) FROM t
Executing the output against DuckDB fails:
duckdb.CatalogException: Scalar Function with name j_s_o_n_keys_at_depth does not exist!
Did you mean "json_keys"?
Expected
JSON_KEYS(x) should transpile to DuckDB's json_keys(x).
The two-argument form is where the question lies: BigQuery's JSON_KEYS(json_expr, max_depth) takes an optional depth, while DuckDB's json_keys has no depth parameter. Dropping max_depth silently would be lossy; raising on the DuckDB side is another option. Guidance on the preferred direction would be welcome.
References
- BigQuery
JSON_KEYS: https://cloud.google.com/bigquery/docs/reference/standard-sql/json_functions#json_keys - DuckDB
json_keys: https://duckdb.org/docs/stable/data/json/json_functions.html
- 主要语言
- Python
- 星标
- 3.3k
- 派生
- 471
- 平均合并
- 6 天 7 小时
- 30 天内合并 PR
- 35
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
SQLMesh/sqlmesh 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 4 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 4 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
SQLMesh/sqlmesh#6008 · 1 条评论 ·
维护者通常 4 天内回复
-
VSCode Extension: SQLMesh LSP crashes on startup: ImportError: cannot import name 'WorkspaceDiagnosticRefreshRequest' with lsprotocol 2025.x可能已有人在做 @boomesh11 于 15 天前认领。 未关闭Bug
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 4 天内回复
-
Improvement
难度 1/5 1 小时以内 新手友好度 85/100
SQLMesh/sqlmesh#5696 · 6 条评论 ·
维护者通常 4 天内回复
相似的 Issue
-
accepted
难度 2/5 1-3 小时 新手友好度 67/100
future-agi/future-agi#5274 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
GenericMappingTools/pygmt#5014 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 66/100
w3c/feedvalidator#204 ·
-
[BUG][Low–Medium] founder_numbers.py silently reads a SAFE discount or pool target given as a fraction (0.2) as 0.2%可能已有人在做 @sumitkhond111-del 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 72/100
bmad-code-org/BMAD-METHOD#3358 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
open-mmlab/mmcv#3352 ·