perf: use extend when buffering partition row indices in the native shuffle writer
维护者通常 2 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 重构
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- rust, spark
调研方向
需要替换的循环位于 native/shuffle/src/partitioners/multi_partition.rs 中的 MultiPartitionShuffleRepartitioner::buffer_partitioned_batch_may_spill,其中一次 reserve 调用之后紧跟着逐行的 push 调用。请先阅读该函数,然后使用 cargo bench --bench shuffle_writer 构建基准测试,并在编辑前保存一个基线。完成的标准是:循环被替换为对相同元组的 extend,基准测试已与基线进行比较,并且即使结果处于噪声范围内也要报告结果。
由索引模型根据 Issue 内容生成。
描述
What is the problem the feature request solves?
MultiPartitionShuffleRepartitioner::buffer_partitioned_batch_may_spill in native/shuffle/src/partitioners/multi_partition.rs pushes the row indices of each partition one at a time after reserve:
indices.reserve(row_indices.len());
for row_idx in row_indices {
indices.push((buffered_partition_idx, *row_idx));
}
Vec::push re-checks capacity on every iteration. indices.extend(row_indices.iter().map(|&r| (buffered_partition_idx, r))) gets the trusted-length specialization and writes the tuples in one pass.
Describe the potential solution
Replace the loop with extend. Run cargo bench --bench shuffle_writer before and after (save a baseline with --save-baseline before); the change is small, so report the result either way and drop it if it is within noise.
Additional context
Micro item from #5002, carried into #5905. Good first issue.
- 主要语言
- Scala
- 星标
- 1.3k
- 派生
- 398
- 平均合并
- 2 天 22 小时
- 30 天内合并 PR
- 414
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/datafusion-comet 的其他 Issue
-
requires-triage
难度 2/5 1-3 小时 新手友好度 82/100
apache/datafusion-comet#7176 ·
维护者通常 2 天内回复
-
enhancement
难度 1/5 1-3 小时 新手友好度 83/100
apache/datafusion-comet#7101 ·
维护者通常 2 天内回复
-
Native hashing of NullType and ANSI interval values fails with "Unsupported data type in hasher"可能已有人在做 @ump45nose 于 8 天前认领。 未关闭area:expressions area:shuffle bug priority:high
难度 2/5 1-3 小时 新手友好度 62/100
apache/datafusion-comet#7063 ·
维护者通常 2 天内回复
-
requires-triage
难度 2/5 1-3 小时 新手友好度 68/100
apache/datafusion-comet#7001 ·
维护者通常 2 天内回复
-
Deduplicate spark_ceil and spark_floor and port floor's decimal boundary tests to ceil可能重新可做 @med9110 于 10 天前认领,目前没有进行中的 PR。 未关闭area:expressions enhancement help wanted requires-triage rust tech debt
难度 2/5 半天 新手友好度 68/100
apache/datafusion-comet#6974 · 1 条评论 ·
维护者通常 2 天内回复
查看 apache/datafusion-comet 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
scalacenter/scaladex#1834 ·
-
PlatformSpecific.hasGreenThreads incorrectly returns false for JDK updates and non-GA versions可能已有人在做 @hearnadam 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
zio/zio#11303 · 1 个 reaction · 已指派 2 人 ·
维护者通常 1 天内回复
-
Disabled tools can still be called by the agent可能已有人在做 @shaynhornik 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 79/100
apache/texera#9122 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
apache/pekko-persistence-jdbc#646 ·
维护者通常 1 天内回复