Skip to content

test: consolidate executor, aggregate, parquet and vector coverage - #29648

Merged
XuPeng-SH merged 13 commits into
mainfrom
codex/quality-29249-post29638-20261006
Oct 6, 2026
Merged

XuPeng-SH merged 13 commits into
mainfrom
codex/quality-29249-post29638-20261006

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Refs #29249. This is an incremental delivery of the systemic cleanup; it does not close the broader issue.

What this PR does / why we need it:

Consolidate related test classes at their existing ownership boundaries rather than deleting coverage or adding another test framework:

  • Reuse compatible executor fixtures, remove duplicated setup and forwarding, and retain distinct planner/index and operator behavior checks.
  • Consolidate aggregate cardinality, offset, decimal, finite-range and allocation-denial coverage. Check independent values, types, NULLs and cleanup after partial failures.
  • Consolidate Parquet scalar mapping into a shared lightweight fixture while preserving all 111 original mappings and 12 helper behaviors. Keep dictionary encoding, precision, temporal, error identity and vector ownership assertions.
  • Consolidate array mathematics from 12 process setups into one serial fixture using the registered overload and existing FunctionTestCase owner. Preserve all 39 original cases / 69 result rows, extend to 46 named cases, and reject implicit casts and incorrect result metadata.
  • Correct the test framework's float32-array oracle: finite values must not compare equal to NaN. Preserve exact finite precision and matching-NaN semantics.

Cleanup is registered immediately; each case releases its owned vectors before the next case. Removed cases are mapped to retained independent oracles. Review documents, private mutation overlays and measurement artifacts are not committed. No dependency or security changes are included.

Validation

  • Reuse the previously reviewed and validated executor/planner and aggregate cohorts whose relevant source is unchanged; aggregate owning-package, focused race and incremental static evidence were recorded at their delivery checkpoints.
  • Parquet owning-package: PASS (1,281 named nodes); focused race: PASS (97 named nodes); incremental golangci-lint: exit 0, zero issues. Reached mutation and FailNow cleanup checks reject incorrect results and leaked vectors.
  • Array math final owning-package: PASS, including all 46 cohort cases. Independent mutations reject L1 incorrectly wired to signed summation, single-precision summation, narrowed f64 Abs, self-product substituted for a dot product, constant similarity, incorrect zero-vector distance and the old NaN comparison.
  • Array math incremental golangci-lint: exit 0, zero issues; molint exit 0, with diagnostics concerning unsafe imports in files unchanged by this cohort. This is not a claim that the complete package is diagnostic-free or that full-repository CI has passed.
  • Array math focused race: PASS, including cohort, assertion/ownership and existing batch contract tests. Final implementation review uses gpt-6.1-sol with xhigh reasoning.
  • Integration with main ffe8362614: migrate the newly merged Product dependency test to the current fixture signature and remove references to retired fields. Product owning-package UT, related cancellation/reuse/recursive-marker race tests, incremental golangci-lint (zero issues) and molint pass; gpt-6.1-sol xhigh review APPROVE.
  • BVT: no SQL behavior is changed by this test cleanup. Existing public batch/narrow-vector regressions remain intact; no new service or cluster fixture is introduced.
  • Staged design and implementation review: gpt-6.1-sol with xhigh reasoning. A mutation uncovered a colliding dot-product oracle; corrected inputs distinguish the wrong self-product and now reject it for both precisions.

Latest review corrections

Remove the stale function-test fixture import that prevented SCA and Coverage compilation. Retire both unused checkArgsSkl methods after their last test caller was removed; the live writeStateArg owner and exact COUNT serialization/merge assertions retain the count/storage consistency contract. No replacement validator or production execution branch is introduced.

Aggregate owning-package normal UT: PASS (2,324 named passes). Owning-package race: PASS (2,322 named passes); two allocation-count tests are intentionally skipped under race and pass in normal mode. Full affected-package golangci-lint: zero issues, including unused without incremental line filtering; molint: exit 0 with empty diagnostics. Reached fixed-index and opaque skiplist enumeration mutations are rejected by the retained COUNT boundary serialization assertion. These probes do not claim exhaustive arbitrary internal corruption coverage or runtime improvement.

Cost and limits

The array cohort's three alternating baseline/candidate measurements used precompiled binaries, 200 repetitions per process, two CPU threads and a 2 GiB Go memory limit. Before the final dot-product literal correction, median CPU fell approximately 37% and wall time approximately 43%; peak RSS stayed approximately flat. The candidate ran more cases and included residual checks. These subsecond, shared-host measurements are scoped to this cohort and are not a CI-wide speedup claim.

Follow-up QA corrected the earlier vector mask hypothesis: direct built-in calls do not establish a SQL defect, because FunctionExpressionExecutor owns row selection centrally. Private probes through the registered expression executor pass mixed/all-null masks and reuse for NormalizeL2 and both SubVector arities, including suppression of an unselected overflow and rejection when it is selected. No production mask patch is justified by that evidence. The broad cleanup and effective-coverage goal remains active.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep review of 11368ecb7ecc13653f4e5edca0891d5455af7308 against ffe8362614b8bde8fe0fa249ee472edc87bf256a.

结论:设计方向合理,但当前尚不满足 approve 门槛,发现 1 个已复现的 P2 静态检查回归。当前账号也是 PR 作者,因此提交 COMMENT,不伪报 APPROVED。

需要修复

删除 count2_test.go 中最后一个 checkArgsSkl() 调用后,aggState.go:4049 和 :4092 的两个方法都成为无用代码。仓库启用了 unused,相同配置、同一 owning package 的对照结果:

  • base:exit 0,0 issues。
  • head:exit 2,两个 func ... checkArgsSkl is unused。

随后把同一 unused 检查扩展到全部 29 个受影响包,仍只有这两个诊断,没有发现其他同类遗漏。

这不是未修改代码原本就有的告警,而是本 PR 删除调用点造成的。只按 diff 行过滤 lint 会漏掉这种位于未修改文件中的新增诊断。请同步删除失去职责的两个方法;如果确有需要保留的独立内部不变量,应由精简的测试专用断言承担,不应仅为消除 unused 或抬高覆盖率恢复旧的大量重复填充。

设计与工程质量

逐一检查了 52 个文件的改动和相关调用/清理路径。主要沿用现有 executor、FunctionTestCase、Parquet mapper 和 aggregate 所有权边界,没有增加平行状态机、执行路径或测试框架。测试 +4,486/-7,284 行;非测试文件仅 mock fixture +6/-8 行,修掉先分配再覆盖向量的泄漏;文档无增量。未发现 SQL 执行逻辑或持久化格式变更。

聚合大批量用例改成边界加代表性增长见证,保留跨两个 chunk、短尾、offset、跳过 group、NULL、过滤序列化/恢复/合并和 distinct 存储扩容,而不再对所有类型重复灌满 20,000 组。逐组值、类型、NULL 和资源归零断言比原来的总和/长度断言更有区分力。Parquet 111 个原映射与 12 项 helper 行为、数组原 39 用例/69 行结果都能对应到保留用例;数组扩至 46 个具名用例。无须为此引入新的抽象层。

整体耗时,而非单个 cohort 的提速

本地 Apple M4 / darwin-arm64 / Go 1.26.4,GOMAXPROCS=4 GOMEMLIMIT=3GiB,全部 29 个受影响包,-p 2 -count=1。先分别预热,再按 base/head/head/base 顺序运行;期间不并行运行其他 review 测试。base 原有 unused import 导致 function 包无法编译,对照仅通过临时 overlay 删除该 import,不改变其测试行为。

指标 base 两次 head 两次
完整命令墙钟时间 75.17 / 77.97 s 75.15 / 74.43 s
aggexec 包执行时间 2.013 / 2.038 s 1.718 / 1.684 s

整体差异较小,样本少且是共享主机,不能宣称显著 CI-wide 提速;aggexec 的局部下降比较清楚。external 包在两侧均约 35 s,主要由未修改的 Kafka 测试占用。因此该 PR 目前的主要收益是更少的重复维护和更有效的断言,而不是已经证明的大幅整体提速。这里也没有 SQL 负载性能提升的证据或主张。

覆盖与对抗验证

  • head 全部 29 个 owning packages 普通 UT 通过;两轮正式计时中的 base/head 也各自 29/29 通过。
  • aggexec 同配置覆盖:base 13,652/16,865 statements(80.9%),head 13,666/16,865(81.0%)。不能只看比例:新增执行 36 条语句,失去执行的 22 条全部属于上述不再被调用的校验方法;没有观察到该包其他原已覆盖执行块丢失。此数字不代表全仓覆盖率。
  • insert 的同步等待用例在初次 race 测量后,以相同精确选择器执行 -race -count=100,100 次通过;insert 整包另做单次 race,也通过。
  • 通过私有 overlay 将 LAG 的非 NULL 前序值强制改成 frame[0],新断言准确失败:row 2 期望 200、实际 100;不注入故障的控制组通过。
  • 对 variance fixture 在“已分配输入 / 已填充 executor / 已返回结果”三处注入 FailNow,三个退出点都观测到 offheap=0、onheap=0、objects=0。实验中的非零退出是预期故障,不是原始 head 测试失败。
  • 7 个改过的 benchmark 各以 -benchtime=3x 验证实际多轮复用,均通过;这里只验证生命周期,不拿 smoke 数值作性能结论。
  • UTC+14 的 temporal 映射对照通过;生产 Time→Datetime 明确采用 UTC,未把已排除的本地日期疑点列成 finding。

评审开始前没有人工 review threads,只有 Qodo 暂停服务的机器人评论;不存在可声称“已全部解决”的历史人工意见。上述新 finding 仍需修复。未修改 PR 源码,所有故障注入和测量补丁仅在私有 overlay 中。全量 Linux SCA、UT 与 BVT 仍在运行,未等待 CI,也不把 pending 视为通过。

Comment thread pkg/sql/colexec/aggexec/count2_test.go Resolved

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

复核完成:当前代码层面未发现阻塞项,上轮 P2 已修复。基于当前证据,代码达到可批准标准;这不代表 CI 已通过。当前账号与 PR 作者相同,因此正式提交 COMMENT,不声称已获得 GitHub APPROVED 或独立第三方审批。

范围:ffe8362614b8bde8fe0fa249ee472edc87bf256a..ebab8811b38c3ec2e035fd05aee623ea45375797。相对上轮完整评审的 11368ecb7e,唯一新增变化是 aggState.go 删除两个 checkArgsSkl 方法,共 49 行。其余 52 个文件、测试、依赖及构建配置未变;复用上轮完整变更映射及仍有效的验证,不以重新跑同样的大套件替代评审。

上轮问题与设计闭环

  • 全仓已无 checkArgsSkl 定义/引用。没有通过关闭 unused、添加假调用或引入新 validator 来消除告警。
  • 最新 head 的 aggexec 完整包、全部仓库配置 linters、不按 diff 行过滤:exit 0,0 issues。
  • 真实的序列化入口继续通过 writeStateToBuf/writeAllStatesToBuf -> writeStateArg 检查枚举数量与 argCnt 的一致性;错误向 SaveIntermediateResult / chunk 保存入口返回。现有 TestAggregateStatePrimitiveBoundaryMatrix 直接验证 mismatch 错误,COUNT DISTINCT 的 TINYINT/VARCHAR 边界、过滤序列化、恢复和合并测试仍被执行。
  • 删除的是此前已经无调用的测试辅助检查,未删除运行期调用或替换公共契约。现有检查针对实际序列化条目,不将其夸大成任意内部存储损坏的完整探测器。当前处理符合职责复用和同步清理要求,不需要增加另一个校验框架。

最新 head 的验证与覆盖

重新运行 aggexec 整包 -count=1 -coverprofile=...:exit 0,2,324 个具名节点通过,0 fail、0 skip。正常边界、wire/merge、allocation failure 和结果/资源断言保持原样。

覆盖率从上轮 81.0% 变为 81.2%,但覆盖语句数同为 13,666:分母从 16,865 降到 16,838。逐块比较无已覆盖块丢失、无新增覆盖块;这是删除 27 条未执行语句的分母变化,不是新增测试覆盖。没有为了好看的比例添加无意义测试。

上轮 29 个 owning packages、insert 精确选择器 100 次 race 与所属包 race、7 组 benchmark 多轮复用、LAG 错误值 mutation、三个提前失败点资源归零、Parquet/数组行为矩阵验证仍语义有效:本次没有改变其输入、断言、共享 fixture、并发机制或执行路径。最新 aggexec 包的正常测试和静态结果则由本轮重新取得。

整体耗时和质量结论

本轮仅删除无调用方法,没有新计时数据,也不主张额外运行性能收益。复用上轮相同配置的整体测量:29 包 base 75.17 / 77.97 s,候选 75.15 / 74.43 s;aggexec 约 2.03 -> 1.70 s。局部优化有效,整体没有足够证据支持显著提速。更明确的价值仍是减少重复维护、增强独立结果断言和清理所有权。当前总增量为 53 文件 +4,492/-7,341;未发现为净减行数而削弱断言,或新增平行执行/状态路径。

CI 红灯的实际原因

最新 head 的 UT Coverage job 在准备环境时失败。虽然外层 step 叫 Set up Go,内层 actions/setup-go 已成功;实际停点是 setup-cmake 的 Download and extract CMake:12:43:55 开始,12:53:27 超时(约 572 秒),尚未执行 UT。后续缺失 coverage 报告脚本/产物是前置阶段未完成后的连带现象,不是本 PR 的覆盖率下降或断言失败。日志不能进一步区分下载端、网络还是解压环节,因此不编造更深层基础设施根因。

其余相关 CI 尚在运行。没有重跑、等待 CI 或修改源码;合并前仍需按仓库要求完成 CI。上轮 finding 的代码问题已闭环,本轮没有新增 code findings。

@XuPeng-SH
XuPeng-SH merged commit 5669b16 into main Oct 6, 2026
@XuPeng-SH
XuPeng-SH deleted the codex/quality-29249-post29638-20261006 branch October 6, 2026 14:37
XuPeng-SH added a commit that referenced this pull request Oct 7, 2026
…29649)

## What type of PR is this?

- [x] BUG

## Which issue(s) this PR fixes:

Fixes #29641

## What this PR does / why we need it:

Dragonboat NewNodeHost swallowed non-error panics, changed error-valued
panic identity and leaked its directory lock on Goexit. NewTransport
could also lose a returned child before constructor handoff. Pin
Dragonboat to `abc3d2fce5a6b82b3a8a922c342fd1ec4afb8df3`
(matrixorigin/dragonboat#18): each existing
constructor owner keeps rollback until successful return and reuses its
shared destruction path, preserving the primary failure.

Transport Close now stops and joins the receiver before cleaning
snapshot chunks. Otherwise a final valid receive can recreate
`.receiving` storage after cleanup. The shared path covers ordinary
shutdown and partial-start rollback, including returned child Close
errors. Existing EngineConfig validation also rejects snapshot/close
worker counts beyond Go's reflect.Select hard limit before acquisition.
No new state machine, engine rollback framework or steady-state work is
added.

Remove the unused testutil import that blocked this branch's
function-package compilation. This matches the existing correction on
main (#29648), without pulling in its other changes.

The MatrixOne regression exercises the actual public constructor with
StrictMem LogDB injection and no bound ports, checking ordinary errors,
panic identity, Goexit and exactly-once lock cleanup. Dependency
regressions reuse existing fixtures and validate ownership handoff,
receiver draining with both Close outcomes, terminal snapshot-directory
cleanup, and unsafe configuration rejection before acquisition.

Validation (Go 1.26.4, Linux/amd64):
- Prior implementations fail the new ownership, terminal-directory and
invalid-worker-count oracles; passing ordinary-error/success controls
distinguish the defects.
- Dragonboat config/root/transport packages normal and race PASS.
Receiver-drain regression ×100 race PASS; nine actual-constructor QA
cases PASS under race.
- Full MatrixOne pkg/logservice normal/race PASS (104.129s/109.050s).
Six existing function execution-contract tests normal/race PASS.
Published-pin constructor and actual LOG create/close/retry consumers
PASS under race.
- Incremental formatting, vet and configured golangci-lint PASS for
affected packages, with zero introduced findings. MatrixOne molint
completes successfully; its two unchanged baseline checkunsafe
diagnostics are outside this delta.
- Downloaded dependency origin/checksums verified; 41 relevant
module/config/root/transport files match the tested source byte for
byte. Required gpt-6.1-sol/xhigh design, overall review and final
pin/evidence reconciliation are recorded.

Merge Dragonboat #18 first. Custom child Close retains its requirement
to terminate and join callbacks; resources a factory never returns and
arbitrary fatal/nonterminating destructors retain their existing
contracts. Hard worker-count limits do not guarantee affordability of
extremely large configurations. Local validation is distinct from hosted
CI; new-head CI is not claimed green.

This branch was previously deployed

1 inactive deployment
ci — ebab8811 Deployed Oct 6, 2026 by XuPeng-SH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement kind/refactor Code refactor kind/test-ci size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants