Fallible constructor for nested_case_when

未关闭 适合新手
#11,425 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@ump45nose 已经在做这个了。

开始于 2026年11月15日。

  • #11479 来自 @ump45nose —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust
领域
data

调研方向

构造函数是 vortex-array/src/expr/exprs.rs 中的 nested_case_when,它会对空的 when_then_pairs 进行断言,并在配对数量溢出 u32 时 panic。请阅读同一文件中现有的 bound_* 构造函数,复制其可失败的模式。添加返回 VortexResult<Expression> 的 try_nested_case_when,让 nested_case_when 通过 vortex_expect 调用它,然后为空输入和溢出情况添加测试。当两个非法输入都返回错误且现有调用方仍能通过时即完成。

由索引模型根据 Issue 内容生成。

描述

nested_case_when (vortex-array/src/expr/exprs.rs) panics on input a caller may not control:

  • no WHEN/THEN pairs: assert!(!when_then_pairs.is_empty(), ...);
  • more pairs than fit in u32: vortex_panic!("nested_case_when has too many when/then pairs").

Callers that build a CASE from user or query input (for example a list of branches translated from SQL) have to repeat both checks before calling it, or wrap it to turn the panics into errors.

Proposal: add try_nested_case_when(when_then_pairs, else_value) -> VortexResult<Expression> that returns an error in both cases, and have nested_case_when call it and vortex_expect the result, as the bound_* constructors already do.

主要语言
Rust
星标
3.2k
派生
239
平均合并
1 天 4 小时
30 天内合并 PR
684

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

vortex-data/vortex 的其他 Issue

查看 vortex-data/vortex 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。