Local seed path containing a single quote breaks the DuckDB query
维护者通常 1 天内回复
还没有人认领这个 Issue。
- #1109 来自 @xubenqiang —— 已关闭,未合并
评估
调研方向
阅读 packages/data-designer-engine/src/data_designer/engine/resources/seed_reader.py,重点关注 get_seed_dataset_size、get_column_names 和 build_dataset_read_query 的两个分支。首先检查每个方法如何构造 DuckDB SQL 字面量,并查找现有的 seed reader 测试。如果本地 seed 路径包含单引号时,列名、行数和数据集读取都能正常工作,则任务完成;运行相关测试,并为该路径补充测试覆盖。
由索引模型根据 Issue 内容生成。
描述
Priority Level
Low (Cosmetic / Minor)
Describe the bug
A local seed file whose path contains a single quote can't be read. SeedReader puts the dataset URI into DuckDB SQL as a quoted string literal without escaping it, so a ' anywhere in the path ends the literal early and DuckDB fails with a parser error. It happens with a directory like o'brien/ or anything under a home directory with an apostrophe in the user name.
The literal is built in four places in packages/data-designer-engine/src/data_designer/engine/resources/seed_reader.py on current main (4bb221eb). Those are get_seed_dataset_size (line 301), get_column_names (line 352) and both branches of build_dataset_read_query (lines 381 and 386), all in the form
f"SELECT COUNT(*) FROM '{self.get_dataset_uri()}'"
Steps/Code to reproduce bug
import os
import pandas as pd
import data_designer.config as dd
from data_designer.interface import DataDesigner
os.makedirs("o'brien", exist_ok=True)
pd.DataFrame({"name": ["a", "b"]}).to_parquet("o'brien/seed.parquet")
builder = dd.DataDesignerConfigBuilder()
builder.with_seed_dataset(dd.LocalFileSeedSource(path="o'brien/seed.parquet"))
builder.add_column(dd.ExpressionColumnConfig(name="greeting", expr="hi {{ name }}"))
result = DataDesigner(artifact_path="./artifacts").preview(builder, num_records=2)
print(result.dataset)
On main at 4bb221eb with Python 3.14 and duckdb 1.5.0 this gives (path shortened)
data_designer.interface.errors.DataDesignerGenerationError: 🛑 Error generating preview dataset: Parser Error: syntax error at or near "/"
LINE 1: ...o'brien/seed.parquet'
^
The same script with the directory renamed to obrien works.
Expected behavior
The seed should load the same as from any other path.
Agent Diagnostic / Prior Investigation
Calling LocalFileSeedReader directly shows both get_column_names() and get_seed_dataset_size() failing with the same ParserException, so it's not specific to preview. In DuckDB a ' inside a string literal is written as '', and with the path escaped that way SELECT COUNT(*) FROM '...o''brien/seed.parquet' and the DESCRIBE query both work. The other readers aren't affected in practice. DataFrameSeedReader and the filesystem readers use the fixed table name df, and HuggingFaceSeedReader builds hf:// paths from repo ids. I searched issues and PRs for quote, apostrophe, seed path and get_dataset_uri and didn't find this reported.
Additional context
The fix I'd suggest is a small helper in SeedReader that doubles single quotes when building the SQL literal, used in those four spots. get_dataset_uri() itself should keep returning the raw path, since get_storage_plan also uses it with Path and glob. Happy to send a PR with tests once it's triaged.
Checklist
- I reproduced this issue or provided a minimal example
- I searched the docs/issues myself, or had my agent do so
- If I used an agent, I included its diagnostics above
- 主要语言
- Python
- 星标
- 2.4k
- 派生
- 241
- 平均合并
- 1 天 1 小时
- 30 天内合并 PR
- 86
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NVIDIA-NeMo/DataDesigner 的其他 Issue
-
enhancement triaged
难度 2/5 1-3 小时 新手友好度 72/100
NVIDIA-NeMo/DataDesigner#1110 · 1 条评论 ·
维护者通常 1 天内回复
-
Code validation repeats the first result for subsequent target columns可能已有人在做 @edjson 于 2 天前认领。 未关闭bug triaged
难度 2/5 1-3 小时 新手友好度 77/100
NVIDIA-NeMo/DataDesigner#1092 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
enforce \from future import annotations` via ruff FA102 rule`可能已有人在做 @chethanuk 于 50 天前认领。 未关闭task
难度 2/5 1-3 小时 新手友好度 82/100
NVIDIA-NeMo/DataDesigner#760 ·
维护者通常 1 天内回复
-
Support image columns and media collection in multi-shard Slurm runs可能已有人在做 @nabinchha 于 1 天前认领。 未关闭enhancement
NVIDIA-NeMo/DataDesigner#1114 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Support plugin and custom columns in multi-shard Slurm runs可能已有人在做 @nabinchha 于 1 天前认领。 未关闭enhancement
NVIDIA-NeMo/DataDesigner#1113 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 NVIDIA-NeMo/DataDesigner 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
pydantic/pydantic-ai#12091 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
CSS enhancement good first issue
难度 2/5 1-3 小时 新手友好度 70/100
pychess/pychess-variants#2448 ·
维护者通常 1 天内回复
-
Bump locked PyTensor so Apple clang 21 does not pass -ld64可能已有人在做 @drbenvincent 今天认领。 未关闭bug dev ops
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 2 天内回复
-
ai_p2 bug comp-datalake
难度 2/5 1-3 小时 新手友好度 85/100
ClickHouse/ClickHouse#128306 · 1 条评论 ·
维护者通常 1 天内回复