Median aggregation overflows for large finite middle values
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 68/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- data
调研方向
从 packages/table-core/src/features/row-aggregation/aggregationFns.ts 中的中位数计算以及 issue 描述的针对性 Vitest 回归测试入手。检查计算如何处理较大的有限值对,以及次正规数、零、NaN 和无穷大输入。溢出情况返回有限中位数,且列出的对照情况保持现有行为,即为完成。
由索引模型根据 Issue 内容生成。
描述
TanStack Table version
@tanstack/table-core 9.3.1, main at c14e0221b1e656c7bb35e7b3d4cdf188719a3599.
Framework/Library version
Framework-independent aggregation API; reproduced with Node 24.19.0.
Describe the bug and the steps to reproduce it
The even-length median adds the two middle values before dividing by two. That intermediate addition can overflow even when the median is finite and representable.
For example, the median of [Number.MAX_VALUE, Number.MAX_VALUE] is Number.MAX_VALUE, but the current implementation returns Infinity. The negative equivalent returns -Infinity. Unequal large finite pairs have the same issue.
The fix should also preserve tiny/subnormal results: always dividing both operands first would turn the median of [Number.MIN_VALUE, Number.MIN_VALUE] into zero. The existing zero, NaN and infinity behavior should remain unchanged.
Your Minimal, Reproducible Example
Run this with Node 24 from a checkout; this source module only has type imports and needs no framework setup:
import { aggregationFn_median } from './packages/table-core/src/features/row-aggregation/aggregationFns.ts'
const context = values => ({
rows: values.map(value => ({ value })),
getValue: row => row.value,
})
console.log(aggregationFn_median.aggregate(context([
Number.MAX_VALUE,
Number.MAX_VALUE,
]))) // Infinity; expected Number.MAX_VALUE
Source of the current median calculation.
Four focused Vitest overflow regressions fail on main, while six controls pass (opposite signs, subnormal values, ordinary numbers, signed zero and non-finite inputs).
Do you intend to try to help solve this bug with your own PR?
Yes. I am preparing a small fallback for intermediate overflow and will complete the repository's required checks before opening a PR.
- 主要语言
- TypeScript
- 星标
- 28.5k
- 派生
- 3.6k
- 平均合并
- 18 小时 5 分钟
- 30 天内合并 PR
- 12
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TanStack/table 的其他 Issue
-
Column resize does not end if mouseup is missed (screenshot, switching tabs)可能已有人在做 @lx3133584 今天认领。 未关闭
难度 3/5 1-2 天 新手友好度 35/100
维护者通常 1 天内回复
-
svelte-table: controlled expanded and pagination state resets straight after every change可能已有人在做 @NickSpag 于 15 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 25/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 38/100
TanStack/table#6601 · 5 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
Cast required to access custom options when defining a custom plugin/feature可能已有人在做 @sorena-paydar 于 45 天前认领。 未关闭
难度 5/5 一周以上 新手友好度 35/100
维护者通常 1 天内回复
-
`aggregatedCell` not typed against bound `cellComponents` in `createAppColumnHelper`可能已有人在做 @cpruijsen 于 56 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 78/100
维护者通常 1 天内回复
相似的 Issue
-
Add: ESP 2 RO未关闭approved check:passed streams:add
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
ipaas: Configure form shows "Deploy to apply." and "Overrides selected Link" when they don't apply未关闭
难度 2/5 1-3 小时 新手友好度 67/100
wso2/integration-control-plane#1118 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
UTDNebula/utd-notebook#311 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
binding:python bug
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复