Skip to content

[Subtask]: Enable dictionary scan, filter and projection outputs #32386

Closed

Description

@aunjgr

Parent Issue

#32379

Detail of Subtask

Enable selected outputs after consumer/ownership prerequisites merge. Direct-column projections share accounted immutable backing and selections; computed columns may remain flat. Preserve row order, duplicates, NULL/grouping and provenance, source reuse and budget refusal fallbacks.

Status: approved staged work; no delivered implementation or performance claim yet. See versioned design #32380. Dependencies follow the seven-PR series; no dependent producer enablement before prerequisites merge.

Describe implementation you've considered

Use immutable snapshots and shared selections, existing allocation/lease machinery and explicit read/materialization contracts. Every live backing has one effective release owner and a physical bound. Unsupported ownership or consumers retain ordinary accounted materialization.

Additional information

Acceptance: Confirmed Q12 speedup at SF10 and SF100 memory profiles; all-query memory/disk regression gates.

Activity

  1. self-assigned this
    on Nov 8, 2026
  2. added
    severity/s0
    on Nov 8, 2026
  3. aunjgr commented on Nov 10, 2026

    @aunjgr
    ContributorAuthor

    Implementation/protocol update — 2026-11-10

    The requester approved combining #32385 and #32386 into one implementation PR. #32405 has merged; the local implementation was rebased onto main 00da05219f, excluding inherited prerequisite commits. #32387 (shuffle/join output views) and #32388 (deeper early filtering/late payload work) remain separate.

    The requester replaced the repeated-process acceptance protocol for this and future PRs:

    • One process per build, scale and memory/cache configuration; load/open once.
    • Run Q1–Q22 as six complete consecutive suites.
    • Exclude the first cold suite; report/profile/account the following five warm suites.
    • No reload/restart between those suites and no additional five-process-pair layer.
    • Keep all-query and Total reporting, matched budgets, no SF100 spill, and no benchmark-time input/result verification.
    • Warm repetitions describe within-process variation, not independent process samples.

    Q12 remains the predeclared primary speedup target. Q1 is also in the scan-copy/aggregate-read validation scope: its filter is at scan, and dictionary-aware consumers must preserve that copy reduction rather than forcing immediate materialization. This does not replace #30841's small-domain grouping/hash work or #30847's aggregate update-cost work.

    Local consumer, selected reader/tombstone, grouping, join, forwarding and account-lifecycle checks are passing. Performance acceptance and the implementation PR are still pending; no speedup or completion is claimed. Results will be appended in separate comments.

  4. aunjgr commented on Nov 10, 2026

    @aunjgr
    ContributorAuthor

    Implementation is published as templated draft #32492, covering #32385/#32386.

    The revised local SF10 memory qualification failed. Full Q1–Q22/Total results, allocation/profile diagnosis and proposed corrections are recorded separately from the PR description. Product code is frozen pending the requester's review; revised disk/SF100 checks have not run.

    The current protocol is one process per build/configuration, one cold full22 suite excluded and five warm full22 suites profiled/accounted. Qualification is local SF10 memory/disk and local SF100 disk-backed, without spilling/swap/OOM or benchmark-time dataset/result verification. This replaces the older independent-process-pair/server129 wording; it does not weaken the regression gate.

  5. aunjgr commented on Nov 10, 2026

    @aunjgr
    ContributorAuthor

    The ownership and private-header corrections are published in draft #32492, head 73930d6ace, on updated main 1a12e18e68. Functional, race/account, SQL and static checks pass, but the current local SF10 memory qualification still fails the performance gate. Full all22/Total results and read-only diagnosis. Code is frozen pending requester review; disk/SF100 acceptance has not run. Earlier PR benchmark tables have been collapsed to avoid presenting them as current evidence.

  6. aunjgr commented on Nov 10, 2026

    @aunjgr
    ContributorAuthor

    The approved sorted-routing and typed-gather corrections are published in draft #32492, head 2f2617d6b3. Functional/race/SQL/SCA checks pass, but the local all22 memory gate still fails. Current full results and diagnosis. Earlier tables are collapsed; code is frozen for requester review and disk/SF100 acceptance remains pending.

  7. aunjgr commented on Nov 10, 2026

    @aunjgr
    ContributorAuthor

    Updated #32492 qualification and proposed correction: the approved retained-cache revision d5a1f21f1c passes correctness/race/SQL/static checks, but SF10 memory Total is 3.4048 -> 3.6820s (+8.1%). Snapshot-header/lease allocation churn and selected predicate/key work remain. No spill/swap/OOM or warm physical reads. Disk/SF100 qualification stopped; issue remains open and PR remains draft. Product changes are paused for requester review of the concrete correction.

  8. aunjgr commented on Nov 10, 2026

    @aunjgr
    ContributorAuthor

    Latest #32492 qualification and diagnosis, candidate 31c018976f: the approved fixes remove the large snapshot-header allocation excess and improve Q12 8.6% (SF10 memory) / 7.6% (disk). Total remains +0.6% / +0.3%; Q21 remains +8.0% / +4.0% and disk's screen stops before SF100. Correctness/race/SQL/static checks passed. A newly identified unconditional workspace-reclaim call reaches flat scalar join setup; the comment proposes guarding it, without claiming that accounts for the whole regression. Product edits are frozen for requester review. Keep issue open and PR draft.

  9. aunjgr commented on Nov 10, 2026

    @aunjgr
    ContributorAuthor

    Updated #32492 results/diagnosis: approved scalar reclaim guard af9d97b151 is pushed and matched with newest main 4c701ab3da; owning checks, SQL and SCA passed. Reclaim overhead drops out of ordinary scalar setup, but Total remains +1.7% memory/+2.4% disk. Disk flags Q7/Q20/Q21 and stops before SF100. Source-line samples identify the temporary Boolean-match construction plus separate original-row composition pass as the next proposed correction; Q20 is explicitly not attributed solely to that loop. Product edits stopped for requester review; issue remains open and PR draft.

  10. aunjgr commented on Nov 11, 2026

    @aunjgr
    ContributorAuthor

    #32492 current results and boundary diagnosis: approved direct compaction is pushed as 9d4934cb42 on newest main 553e16f52b; owning checks, SQL and full SCA pass. SF10-memory Total is +3.7%, Q21 +7.5%; screen stops before disk/SF100. A real Q21 stack builds selected views ahead of an ordinary shuffle and then copies them flat for its downstream consumer. Earlier flat-only admission assessment was incomplete; the comment proposes downstream admission propagation with mechanical capability separated to avoid configuration cycles. No implementation of that next correction yet. Issue stays open; PR stays draft.

  11. added a commit that references this issue on Nov 15, 2026
    49d552e
  12. XuPeng-SH commented on Nov 15, 2026

    @XuPeng-SH
    Contributor

    QA handoff: merged consumer/scan implementation (not acceptance)

    #32492 merged into main at 2026-11-15 19:34 UTC as 49d552e16cfb7fb9160210d19f2874dc4a71272c; reported final PR head is c0af04287132343b2c4509fd549cba03ce1168cc. The combined implementation covers #32385/#32386: selected consumer reads, bounded execution-owned normalization, scan/filter publication and safe shuffle ingress/fallback. The earlier issue comments describe older candidates; their unfinished boundary correction is implemented in the merged change, not a reason to keep the old draft status.

    Evidence checked remotely, not tests run in this handoff:

    • Author reports owning-package normal/race, ownership/admission/SQL controls and repository static/pre-push checks. The merge-queue record confirms CI Required satisfied for the merge.
    • Review 5912164730 approves 0a9739b99fa83fd6b48ab03adbefde90fd16574b, with fresh bufferlease race execution and reused CI. That review SHA is not relabeled as the final head or merge SHA.
    • Final performance report measures main d1893e5ae7 against candidate 866816d85f, not the final merge. SF10 memory/disk totals improve 1.54%/2.55%; SF100 disk total is 3.46% slower in that run. Different I/O/huge-page context supports but does not prove environmental attribution. Q6's 70,893 extra counted metadata bytes and the original Q7 SF100 +6.24% allocation observation remain disclosed; focused matched-input controls do not reconstruct or erase the latter. Review records these as disclosed tradeoffs/uncertainty, not universal zero regression.

    Please verify the merged build's selected/flat fallback semantics, NULL/grouping/order/repeated-row behavior, cancellation/reset, held-borrower/COW and memory-pressure accounting; independently check Q1/Q12 activation and Q6/Q7/SF100 performance with matched budgets and source pins. This is transfer for QA, not acceptance, production qualification, or a claim that benchmark results were reproduced here. The one-process/five-warm-suite observations are not independent-process confidence bounds.

    #32387/#32388, parent #32379, and other performance tasks remain separate; no automatic closure of those scopes or backport requirement is implied.

  13. Ariznawlll commented on Nov 16, 2026

    @Ariznawlll
    Collaborator

    测试版本

    原问题验证

    selected scan/filter 批次跨 expression 与 operator consumer 边界保留后,SQL 语义不变:10 万行低基数列(10 个 tag 值)+ 高基数对照列 + 含 NULL/重复的侧表上,全部断言精确通过,包括 filter(=、IN、NOT IN、IS NULL)、projection(重复保留、函数求值)、GROUP BY/COUNT DISTINCT、join(重复相乘、NULL 键不匹配)、ORDER BY+LIMIT、prepared 重复执行、混合表达式与写操作。

    Happy Path 覆盖

    1. 语义矩阵全部精确断言:eq3=10000、in02=20000、notin=90000、每组 count=10000/dgrp=2、join=40000(tag_0 10000×3 + tag_3 10000×1)、desc tag_5 → 99995/99985/99975、min/max 逐组正确。
    2. prepared 语句重复执行结果逐次一致;gcd 交互边界(tag_2∧grp=1 → 0,tag_7∧grp=3 → 5000)与数学期望精确一致。
    3. UPDATE/DELETE 经相同 consumer 路径后行值与计数正确。

    Unhappy Path 覆盖

    1. NULL 分组/NULL 键/NULL note 的 join 与聚合语义正确(NULL grp 单独成组、NULL tag 不参与内连接、NULL note 行完整保留)。
    2. 不支持 borrowing 的 consumer 回退 owned 物化路径(perf(exec): consume selected scan batches through expressions and operators #32492 合入源码单测断言 flat 边界与 owned fallback)。

    白盒验证

    核对已合入的 #32492:blockio/publishReaderSelection 按批提交选中列头;expression/key encoder/aggregate/payload gather 直接读逻辑行(dictionary_selection.go、scoped_owned_read.go),掩码计算限定活跃行,保留既有 flat/constant 快速路径与原生 decimal 内核。未修改产品源码。

    回归测试

    已追加 matrixorigin/motr#349:14_issue_regression/issue_32385_32386_dictionary_consumers(33 语句,覆盖上述语义矩阵,同时作为 #32383 中性基础断言)。验收要求的 SF10/SF100 内存/磁盘 gate 与确认的 Q12 加速采用 PR #32492 作者记录的配对证据(五组独立配对进程、Q1–Q22 + Total、spill/swap/OOM 守卫通过);本地未重复 SF100 基准。

    测试证据

    受影响包单测:pkg/vm/engine/tae/blockio(read/dictionary_selection/scoped_owned_read)、pkg/container/vector、pkg/objectio 系列全部通过;聚焦 race 通过;motr 用例 record + 两轮 diff + -j 2 并行全绿、逐字节稳定。

    测试结论

    测试通过。

  14. Ariznawlll commented on Nov 16, 2026

    @Ariznawlll
    Collaborator

    验证通过(comment),回归用例已追加 motr#349。关闭。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/subtaskseverity/s0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions