[查询 / Query] 补充基础标量函数:文本、类型转换、时间部件 / basic scalar functions: text, casts, temporal parts
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
Direzione di ricerca
Start by reading the query-function implementation and its Rust/wire and explain paths, then check how functions are documented in LLM_QUERY. The issue proposes several independent slices across text, conversion, and temporal functions; choose one and trace how existing functions are implemented and tested. Done means the chosen function works in queries, explain, and migration using expressions, with documentation updated.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
中文说明
环境 / Environment: unionid 0.10.0 (linux x86_64 release binary), 2026-10-01。以下带「已复现」的条目均用该二进制实际运行验证;「未实测」表示依据文档或源码推断。
现象(已复现)
derive o = lower owner # E_QUERY: unknown local function 'lower'
derive o = owner + "!" # E_TYPE: arithmetic expects int or float…
derive x = qty + price # E_TYPE: int and float (无显式转换函数)
derive x = float qty / to_text id # unknown local function
filter contains sku "b" # E_TYPE: contains expects a list or bytes, got text
现有可用函数基本只有集合/map、length、解析(*_parse)、聚合、排名。timestamp 也没有取日期/截断的函数。
影响
文本规范化(大小写、trim)、拼接、前缀/包含匹配、金额 int/float/decimal 转换、按日聚合等常见业务需求,只能全部推到应用层,且无法在库里的过滤条件中使用。
建议(每项独立小切片,均保持显式、无隐式 cast)
- text:
lower、upper、trim、concat/拼接、starts_with、ends_with、contains_text、substring。 - 转换:
int_to_float/float_to_int(mode)、to_text(标量)、int_to_decimal。 - 时间:
date_of timestamp(需要显式 offset 参数)、timestamp_trunc。 - 每个函数补 explain、Rust/wire、迁移
using表达式可用性说明,并在 LLM_QUERY 文档列出。
当前交付状态
#459 已于 2026-10-03 合并至 main 4a55aae;属于未发布的 v0.15 开发能力,正式版本交付仍待完成。已实现全部八个文本函数 lower/upper/trim/starts_with/ends_with/contains_text/concat/substring,以及 int_to_float、float_to_int、int_to_decimal、to_text,以及 date_of/timestamp_trunc。int_to_float 拒绝精度损失;float_to_int 使用七种显式字面量舍入模式并检查 i64 范围;int_to_decimal 使用静态 P/S,精确保留数值单位,溢出 E_DECIMAL_RANGE,不解释为分币。to_text 接受 primitive/命名标量并输出无源码标签的文本;复合 ADT 需显式投影/match,hex 扩张在分配前检查 16 MiB。时间函数要求固定偏移/单位字面量;trunc 在当地 Gregorian 边界向下取整再转 UTC,周从周一开始;当地/最终 UTC 超出 0001–9999 年返回 E_ARITH。
验证:十个文本、十个数值转换、五个 to_text 与七个时间投影 targeted 测试、九个 Rust macro inline 测试通过,覆盖 Unicode/预算、类型/静态模式、整数/浮点/decimal 边界、prepared、formatter/explain、wire、mutation/migration 原子回滚与 redb reopen。QUERY、内置 LLM_QUERY 和 agent 错误目录同步。b8ae409 的全部 Ubuntu CI 已通过;审查补丁 b9184d5 的 fmt/check/strict clippy、完整 cargo test 与 macro inline 已通过,内置文档经真实 CLI 验证;CodeRabbit 两条评论已修复(E_TEXT_RANGE 表与 nominal 时间目标);b9184d5 的全部 Ubuntu CI 已通过,两条修复得到 CodeRabbit 回复确认;已由 #459 合并至 main 4a55aae;完整发布验收仍待完成。补丁修复 decimal/temporal 表达式在空表和 migration 的目标类型漏检,以及 Unicode 大小写输出超限,新增嵌套 ADT → Option 时间投影 → v2/Rust 往返。
- 文本切片:#459 review/CI 与 main 合并已完成;八个函数的工程验收已验证。
- 显式转换:四个转换的精度/范围/舍入/文本表示工程验收、review 与 #459 合并完成;禁止隐式 cast。
- 时间部件:date_of / timestamp_trunc 的单位/偏移/范围工程验收、CI、review 与 #459 合并完成;无隐式本地时间。
- 整体用户验收:覆盖 explain、Rust/wire、migration using、预算/错误及内置 LLM 文档;发布后再关闭完整阶段。
English Description
Historical report and impact
The original reproduction used the unionid 0.10.0 Linux x86_64 release binary on 2026-10-01. Lowercase calls were unknown local functions, text + failed numeric arithmetic typing, mixed int/float arithmetic had no explicit conversion, and contains on text was rejected because it supported lists/bytes. Text normalization, concatenation/matching, numeric conversion and temporal parts therefore had to live in applications. This records the historical report rather than a current-release reproduction.
Scope and current delivery
Add explicit text functions, numeric/scalar conversions and date_of/timestamp_trunc with explicit offsets, without implicit casts or hidden local time. Every function needs explain, Rust/wire, migration using and bundled LLM documentation.
PR #459 merged into main at 4a55aae on 2026-10-03 and implements all eight text functions (lower/upper/trim/starts_with/ends_with/contains_text/concat/substring) and int_to_float/float_to_int/int_to_decimal/to_text and date_of/timestamp_trunc. Int-to-float rejects precision loss; float-to-int uses seven literal rounding modes and checks i64 bounds; int-to-decimal fixes P/S at binding, preserves numeric units exactly and returns E_DECIMAL_RANGE on overflow, never interpreting integers as minor currency units. To_text formats primitive/named scalars without source tags, rejects compound ADTs unless projected/matched, and checks hex expansion against 16 MiB before allocation. Temporal functions require literal fixed offsets/units, floor to local Gregorian boundaries then return UTC, start weeks on Monday and return E_ARITH for local/final UTC ranges outside years 0001–9999. These remain unreleased v0.15 development capabilities, with formal release acceptance still pending.
Ten text, ten numeric-cast, five to_text and seven temporal-projection targeted tests and nine macro-inline tests pass, covering Unicode/budgets, static typing/modes, numeric boundaries, prepared queries, formatter/explain, wire contracts, durable mutation/migration rollback and reopen. QUERY/bundled LLM_QUERY/agent vocabulary are synchronized. All Ubuntu CI jobs for b8ae409 pass. Review fix b9184d5 passes fmt/check/strict clippy, the complete cargo test suite and macro-inline tests; bundled docs were verified through the real CLI. Both CodeRabbit findings are fixed (E_TEXT_RANGE documentation and nominal temporal targets); all Ubuntu CI for b9184d5 passes and CodeRabbit confirms both fixes; the implementation is merged at 4a55aae, while formal release acceptance remains open. The patch fixes decimal/temporal contextual result checks on empty tables/migrations and Unicode case expansion limits, and adds a nested ADT → optional temporal projection → v2/Rust round-trip journey.
- Text slice: #459 review/CI and main merge complete; engineering acceptance covers all eight functions.
- Explicit conversions: precision/range/rounding/text-representation engineering acceptance, review and #459 merge complete, without implicit casts.
- Temporal parts: unit/offset/range engineering acceptance, CI, review and #459 merge complete, without hidden local time.
- Complete user acceptance: verify explain, Rust/wire, migration, budgets/errors and bundled LLM docs; close only after full delivery and release.
- Lingua principale
- Rust
- Stelle
- 3
- Fork
- 0
- Merge medio
- 31m
- PR unite (30g)
- 65
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di worktools/unionid
-
documentation enhancement priority/P2
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
worktools/unionid#443 · 6 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement priority/P2 quality
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
worktools/unionid#441 · 11 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[设计 / Design] 存储格式矩阵每个特性成对膨胀,应解耦 journal 开关与功能能力 / storage-format matrix grows in pairs per featureApertadesign enhancement priority/P1
Difficoltà 5/5 Più di una settimana Idoneità per principianti 28/100
worktools/unionid#439 · 10 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
design enhancement priority/P1
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
worktools/unionid#438 · 18 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di worktools/unionid
Issue simili
-
`mise doctor` Shows Not Installed Lazy Tools as ProblemsForse già presa @jdx l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
nn::linear: weight initialization depends on `bias` because the bias is created before the weightForse già presa @monfortema l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
LaurentMazare/tch-rs#1067 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
astral-sh/astral-codec#234 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100