Skip to content

refactor(vector): remove allocation account, areaDisjoint and leases from Vector (#33018) - #33033

Merged
fengttt merged 20 commits into
matrixorigin:mainfrom
fengttt:vector-alloc-out2
Nov 22, 2026
Merged

fengttt merged 20 commits into
matrixorigin:mainfrom
fengttt:vector-alloc-out2

Conversation

@fengttt

@fengttt fengttt commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • Code Refactoring

Which issue(s) this PR fixes:

issue #33018

What this PR does / why we need it:

Removes allocationAccount, areaDisjoint, dataLease and areaLease from Vector, so a Vector is a plain container again.

Stacked on #33027 (and #33024). Review only the last four commits: 02c0ca4abc..1cc5610d95.

  1. areaDisjoint is computed, not tracked (02c0ca4). VarlenaAreaIsDisjoint checks the live descriptors on demand: one pass for monotone layouts, a sort otherwise.
  2. Accounted MPool views (7b5cb06). mp.WithAccount(account, owner, site, class) and mp.WithAdmission(admit) return a view of the pool. Fresh off-heap allocations through the view are charged to its account. Growth and free follow each allocation's own metadata, so any view of the pool can grow or free it. Deleting a view is a no-op.
  3. The Vector carries no account (1319afe). Code that attached a vector.AllocationAccountSelection to vectors or batches now builds a view once and passes it as the mp wherever those vectors allocate. Operators that bind an account at compile time build their views lazily, through mpool.AccountBinding. Allocation through a view is always off-heap.
  4. The Vector holds no leases (1cc5610). A borrowed backing is a plain alias; the lender keeps the lease.
    • Scan output, Arrow and Sirius results: the output batch holds the lease (batch.HoldLease, bufferlease.Holder).
    • The batch releases it in Clean, CleanOnlyData and FreeColumns, so cache pins stay bounded to one block (TestReaderBorrowedPinsStayBoundedAcrossBlocks).
    • pSpool and the retained views copy aliased data.
    • Cache-backed scans stay zero-copy.

Behaviour changes

  • Charges that no longer follow a vector into later code. These copies are now unaccounted:
    • disttae Delete copy-on-write and raw-INSERT row-id copies (restoring them needs an engine API change);
    • limit, offset and partition copies of accounted input;
    • non-owned shuffle pools;
    • group sort-rollup window copies.
  • Connector/dispatch spools are charged to the bound statement account, under a generic owner and site.
  • Block reads with an output account, and accounted aggregates, now also charge their temporary buffers.
  • Aliased vectors (borrowed, windows, decoded) are copied before any mutation. SetFixedAt on an aliased data backing returns an error.

Tests

  • go build ./pkg/... ./cmd/..., go vet ./pkg/... and make static-check are clean.
  • go test ./pkg/... is green except:
  • Deleted tests cover only removed APIs: shuffle provenance-lane sealing, CopyWithReadonlyArea, RetainedReadonlyView*, and vector-held lease refcounts.
  • New regression tests cover bounded pins, a moved aliased vector being copied before release, pSpool copying aliased fixed and varlen data, and mpool.AccountBinding.

TPC-H SF20 (2-CN dev cluster, warm, best of 2)

main #33027 this PR
Total, 22 queries 18,945 ms 18,785 ms 18,479 ms (−2.5% vs main)

All 22 results match main. q12 is +5.6% vs main, the same as on #33027.

🤖 Generated with Claude Code

fengttt and others added 18 commits November 20, 2026 10:04
…n#33007)

EXECUTE already binds each `?` to its real source type, but the value
still traveled as TEXT: lowerPreparedSourceTransports rewrote every typed
ParamRef into cast(text -> type), and per-vector prepareParamKind tags
told the casts how to undo the stringification (NaN text, Boolean text,
float rounding, ...).

This is the first step of removing that lineage from Vector:

- Process carries the parameters as a one-row typed batch (column i is
  parameter i) next to the TEXT transport. It shares the detach/borrow/
  restore ownership of the TEXT parameters and is cleared whenever new
  TEXT parameters are installed.
- At EXECUTE the frontend builds typed values from the bound source types
  (integers, floats incl. NaN/Inf, bool, decimals). Other types, strings
  and NULL keep the TEXT transport.
- ParamExpressionExecutor evaluates a non-string ParamRef from the typed
  value directly, casts it from its own source type when the types
  differ, and otherwise falls back to the TEXT cast built in the
  expression's own context (so folding, selection and diagnostics are
  unchanged on that path).
- The process codec sends typed values to remote CNs (new repeated
  bytes field). A peer that ignores the field reads the TEXT transport.
- lowerPreparedSourceTransports is removed; its tests now compare the
  TEXT and typed transports instead of logical and lowered plans.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…origin#33007)

Prepared parameters now reach execution as typed values (previous commit),
so the per-row "prepare param kind" tag that rebuilt a parameter's type from
its TEXT transport carries no information. Remove it end to end:

- Vector: the kind scalar/sidecar, prepareParamType, the prepared JSON
  comparison marker, and every accessor, preflight, propagation, remap,
  checkpoint and accounting path for them. String-source preflight and
  propagation, which shared those code paths, keep string-source-only
  helpers (PreflightUnion*StringSources, propagateStringSources*).
- Batch transport trailer and the selected-rows codec: writers no longer
  emit kinds; readers still accept and drop kind data from older peers.
  Renamed the batch API (MarshalBinaryWithMetadata, HasTransportMetadata,
  ...). The trailer keeps carrying binary/text domains and string sources.
- Operators: group (trailer renamed row_metadata_trailer; old trailers are
  validated and discarded), aggexec min/max/any/maxby winner kinds, window,
  timewin, IF/CASE/COALESCE kind merging, dispatch.
- Functions: the kind branches in casts, json_*, MEMBER OF, inet_ntoa,
  random_bytes and between, and the prepared JSON comparison adapters
  (__mo_json_comparison_param / __mo_json_ordering_param; ids reserved).
  A typed parameter binds like a literal of its type; a string parameter
  compared with JSON binds as a JSON string (json_quote + cast).
- Process: kind/type metadata sections and the variable kind resolver.
  Remote metadata from older peers (4N/12N flags) is accepted and truncated.
- Frontend: typed values also for non-query EXECUTE (SHOW, DDL, SET), and
  BIT, date, time, datetime, timestamp and JSON typed values. A protocol
  BIT or SQL array on the left of MEMBER OF is rejected when binding.

The planner/frontend binding descriptor (types.StringConversionKind on
ParamValue and user variables) stays for now; it no longer touches Vector.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-out

# Conflicts:
#	pkg/container/vector/vector.go
…origin#33004)

Vector carried a per-row "string source" (Expression / Literal / User
variable / SQL PREPARE / COM_STMT) in stringSource, stringSources and
stringSourcesMP, maintained by every append, union, shuffle, shrink,
window, sort, codec and operator. Its only semantic consumer is the
planner, which reads the source on plan literals; the vector copy existed
so that constant folding could read it back off the evaluated vector.

- Vector: remove the three fields and every accessor, preflight,
  propagation, remap, normalize and copy path. Union/append helpers lose
  their source and override parameters.
- Planner: constant folding derives a folded literal's source from the
  plan expression (rule.ExprStringSource / ListStringSource), with the
  rules the executor used to apply: a literal keeps its source, a variable
  is a user variable, a parameter has its execution's source, an implicit
  cast keeps its argument's, COALESCE takes its first non-NULL-literal arm,
  anything else is an expression. GetConstantValue takes the source
  explicitly. Frontend SET evaluation derives it from the syntax tree.
- Process: a parameter's source is per execution
  (SetPrepareParamsStringSource); the remote codec keeps its per-parameter
  wire field.
- Executors and operators (expression evaluator, aggexec, group, timewin,
  window, dispatch, pSpool) no longer stamp or propagate sources.
- Wire compatibility: the batch trailer is written as v1 (no source
  section), the selected-rows codec and the aggregate-state trailer no
  longer write source bits; all readers still accept, validate and drop
  source data from older writers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	pkg/objectio/ioutil/sinker_bounded_lifecycle_test.go
…xorigin#33016)

Vector carried a per-row runtime string domain (binaryString,
binaryStringRows, textStringRows, binaryStringRowsActive) that let a
vector's rows override its static type's binary/text semantics. Every
append, union, shrink, shuffle, sort, window, codec and operator
maintained it, and functions consulted it per row.

The static type is now the only carrier of binary-vs-text semantics
(types.StaticStringDomain: binary charset, or the legacy zero charset on
BINARY/VARBINARY/BLOB).

- Vector: remove the four fields and every accessor, preflight,
  propagation, remap, rollback and accounting path.
- Functions: read the static type (isBinaryStringVector); no per-row
  branch and no result-domain publication.
- Evaluator: literals, parameters, variables and IF/CASE/COALESCE no
  longer stamp a domain. aggexec no longer merges or restores one.
- Planner: COALESCE over binary and CHAR/VARCHAR arms is typed binary,
  as IF and CASE already were (MySQL). Collation normalization leaves a
  binary literal (hex, bit, _binary) unconverted where its byte domain
  used to survive at runtime (a tie, or a case-sensitive selection).
- Process/frontend: prepared parameters carry no binary-string flags;
  BLOB COM_STMT parameters and binary user variables are typed binary by
  their bindings. The user-variable domain resolver stays on Process for
  SQL EXECUTE's source typing.
- Wire compatibility: writers no longer emit the batch metadata trailer,
  the selected-rows codec binary field and per-row flags, the aggregate
  binary-string state trailer, or the prepared-parameter IsBinaryString /
  RuntimeStringDomains fields. Readers still accept, validate and drop
  them from older peers. Spill writers use the stable batch encoding.

SQL-visible: REVERSE/LENGTH-style functions over an IF/CASE/COALESCE
with a binary arm now act on bytes for every row, matching MySQL.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
, phase A)

DICTIONARY was a lazy row-selection view: a vector whose rows indexed an
immutable, reference-counted base vector, with read views, freeze/reclaim
workspace leases installed into ordinary source vectors, selection scopes
and scan publication slots. Every consumer needed a dictionary fast path
or a normalization edge.

Remove the class and all of its machinery:

- vector: the dictionary files (views, bases, row selections, freeze and
  reclaim, scopes, workspaces, read views), the dictionary function
  parameter wrappers, IsDictionary/EnsureFlat/EnsureWritable and every
  dictionary branch. Class 2 stays a retired wire value
  (LegacyRowBufferClass) that still decodes as FLAT.
  RetainBorrowedBufferInto (cache-borrowed scan vectors) is kept, without
  the dictionary payload wrapper.
- vm: the DictionaryProducer/Consumer edge negotiation.
- colexec: the dictionary filter path, the dictionary input frame and the
  evaluator's dictionary normalization.
- functions, hashmap/keycodec, aggexec: dictionary fast paths and the
  per-overload dictionary capability.
- operators: filter, projection, table_scan, shuffle, hashjoin, hashbuild
  and group lose their dictionary producer/consumer code and use the flat
  paths they already used when dictionary output was not admitted.
- engine/blockio: selected publication gathers rows in place; the
  membership stage evaluates staged predicates on flat, account-charged
  copies of the member rows.

Behaviour is unchanged; performance changes where views avoided copies
(filter output, shuffle partitions, hashjoin probe forwarding). A
batch-level row selection replaces the shared-selection benefit in a
follow-up.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…igin#33021, phase B)

A Batch may now carry a row selection shared by all of its columns: the
vectors keep their physical rows, logical row i is physical row
Selection()[i], and RowCount() is the selected count. This replaces the
per-vector DICTIONARY views with one selection per batch.

- batch: SetSelection/ClearSelection/Selection/PhysicalRowCount,
  PhysicalView (an unselected header for evaluating expressions on the
  physical rows), SelectionMask and CompactInto. Marshal refuses a
  selected batch; SetRowCount/Clean/CleanOnlyData drop the selection.
- vm: SelectionConsumer/SelectionProducer edge negotiation, configured
  in Prepare (and for individually prepared kernels). Undeclared edges,
  the pipeline root, codecs and remote boundaries receive compacted rows.
- filter: evaluates each predicate on the input's physical rows masked to
  the current survivors, then publishes the input's vectors with the
  selection when its parent accepts it, and compacts otherwise. It also
  accepts a selected input.
- projection: accepts a selected input, evaluates its expressions masked
  to the selection, passes column references through, and keeps the
  selection or compacts only the projected columns.

A selected output borrows the input's vectors and the producer's row
list, so it lives until the producer's next Call, like any operator
output.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n#33021)

The batch row selection was a list of physical row numbers whose order
and uniqueness were a documented contract that nothing enforced: an
out-of-order list would reorder rows silently and leave the vectors'
sorted flags wrong, and duplicates could not survive masked evaluation.

Store the selection as a bitmap over the physical rows instead. It can
only describe an ascending subset with no repeats, so the contract holds
by construction. The logical row count is the bitmap's popcount, cached
when the selection is set. SelectionRows materializes the row numbers for
gathers (and, later, for row-number kernels); SelectionMask expands it for
masked expression evaluation.

Filter builds the bitmap from its first predicate and clears the rows that
fail each later one, instead of rebuilding an integer list per predicate.
Projection passes the bitmap through unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…trixorigin#33021)

reuse.go registered a reuse pool for Vector that nothing allocated from:
NewVecFromReuse returned new(Vector) and the pool calls were commented
out. Remove the pool, NewVecFromReuse (callers use new(Vector)) and the
TypeName method that only served the pool.

GetSels/PutSels kept a sync.Pool of []int64 row-number scratch. Put
stored a pointer to its own parameter, allocating on every put, and the
pooled slices carried whatever capacity their last user grew them to.
Operators that compact per batch (filter, table_scan, offset) now keep
their own scratch slice; the remaining callers (block reads with deletes
or filters, DML utilities, transactions, the frontend) use local slices.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ow list (matrixorigin#33021)

blockDataReadWithFilter maps residual-filter survivors back to block
offsets. That list must be built in its own slice: a version that reused
the storage row list's backing array overwrote the caller's rows in place
(1, 4, 7 became 4, 7, 7) while still returning correct values.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ng it (matrixorigin#33018)

Vector kept an areaDisjoint proof bit that every append, union, shrink,
shuffle, sort, window and codec path had to maintain or clear.
VarlenaAreaIsDisjoint now computes the same property from the
descriptors: every live non-inline descriptor lies inside the area and
no two share bytes. Append-built layouts are checked in one pass; other
layouts sort the live ranges. Const and dictionary vectors never report
it.

UnionBatch's contiguous-range fast path already scans the selected
descriptors, so the whole-area shortcut (CanCopyWholeVarlenaArea) and the
join pre-sizing workaround for it are removed. UnionOne still clears a
reused stale descriptor under a new NULL row.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
An MPool value is now the pool or an accounted view of it. The pool's
state moves into an embedded poolCore, so a view is a small value that
shares it and differs only in how fresh off-heap allocations are charged:
to an allocation account (WithAccount) or through a transient physical
admission (WithAdmission). Growth and release of an existing allocation
follow the allocation's own metadata, so any MPool value of the same pool
can grow or free it. Deleting a view is a no-op.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r account (matrixorigin#33018)

A Vector no longer carries an allocation account. Code that attached a
vector.AllocationAccountSelection to vectors or batches now builds an
accounted MPool view (mp.WithAccount / mp.WithAdmission) and passes it as
the mp wherever those vectors allocate. Fresh off-heap allocations through
a view are charged to its account; growth and free follow the allocation's
own metadata, so any view of the pool can grow or free it.

- vector/batch/pSpool/arrowbridge: drop AllocationAccountSelection and the
  *WithAllocation / *WithAllocationAccount variants; allocation through a
  view is always off-heap.
- objectio, blockio, disttae, materialized, sql/util: request and reader
  allocation fields are views.
- function, aggexec, colexec executors and every operator that binds an
  account build their views from it (mpool.AccountBinding when the pool is
  only known after binding).
- connector/dispatch build their spool on a view of the bound account.

Charges that used to follow a vector into later code now land only where
the caller passes a view: disttae Delete copy-on-write, raw INSERT rowid
copies, limit/offset/partition copies of accounted input, and non-owned
shuffle pools are no longer accounted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ckings (matrixorigin#33018)

A Vector no longer holds or releases a BufferLease. A borrowed backing is
a plain alias (cantFreeData/cantFreeArea); the lender keeps the lease.

- bufferlease: Holder (Hold/Release/Len) and the Keeper interface.
- batch: an unexported lease holder (HoldLease/HeldLeases/ReleaseLeases/
  MoveLeasesFrom), released in Clean, CleanOnlyData, FreeColumns and the
  decode-into-batch paths. The scan reuses its batch through CleanOnlyData,
  so cache pins stay bounded to one block (TableScan.Reset now releases).
- objectio/ioutil/blockio: TryBorrowCachedVector hands the cache pin and
  its pinned-capacity reservation to the output batch; zero-copy stays.
- arrowbridge, external Arrow reader, Sirius results: the output batch
  holds the native buffers; leases move with vectors on batch replacement.
- pSpool and retained views copy aliased backings instead of sharing them;
  CopyWithReadonlyArea and RetainedReadonlyView* are gone.
- Aliased vectors (borrowed, windows, decoded) copy before any mutation;
  SetFixedAt on an aliased data backing errors.

Also renames two typeswitch baseline entries whose switches moved into
the pool-taking helpers in the previous commit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@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 →

@mergify

mergify Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

main now carries the squashed forms of the PRs this branch was stacked on,
through matrixorigin#33027. The merged tree is this branch's own commits
(4de8e4e..1cc5610) replayed onto main, with three conflicts and one
semantic follow-up resolved:

- top: processBatchResident takes main's ordering specs (matrixorigin#33042) and keeps
  this branch's retained-pool prologue.
- external/reader_zonemap: main's rewritten saved-result reader (matrixorigin#33045)
  writes output vectors, including filled missing columns, through the
  operator's output pool; the loaded block stays on proc's pool.
- group/collation_metadata_test: main's form of the same offset fix.
- external/reader_zonemap_test (matrixorigin#33046): the capacity-failure cases bind
  an accounted output view instead of a per-vector allocation account, and
  pre-size the first column so the failure still lands on the second.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The scan passed its accounted OutputAllocation view to the reader as its
only pool, so every reader-internal allocation (cache vectors, staging,
decompression) was charged to the statement account. Under the small
per-CN budget in the embedded test cluster this exhausted the account
during information_schema init (owner=selection site=1).

The reader now allocates through proc's pool, and blockio no longer swaps
the whole filtered read onto OutputAllocation. Everything written into the
scan's output batch uses proc's pool; the emitted batch is charged by a
single capacity lease of its retained capacity, released before the batch
is refilled and on Reset/Free. Membership scratch and the scan's private
predicate gather stay on the view, so nothing is counted twice.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fengttt
fengttt merged commit 00716de into matrixorigin:main Nov 22, 2026
fengttt added a commit that referenced this pull request Nov 22, 2026
## What type of PR is this?

- [x] Code Refactoring

## Which issue(s) this PR fixes:

issue #33025

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

Removes `isBin` from `Vector`. Whether a value was spelled as a hex/bit
literal, or comes from a binary-flagged prepared parameter or user
variable, is a fact about the expression that produced the value. It is
not a property of the vector that holds it.

**Stacked on #33033 (and #33027, #33024).** Review only the last commit:
`d46b67a5ec`.

- **Removed from `Vector`:** the `isBin` field, `GetIsBin`/`SetIsBin`
and `CopyExpressionMetadataTo`.
- **The producer owns the fact.**
- `FixedVectorExpressionExecutor`, `ParamExpressionExecutor` and
`VarExpressionExecutor` record the flag for the vector they return.
- `FunctionExpressionExecutor` works out, for each argument, whether the
result it received is one of those leaves (`isBinaryLiteralResult`). The
check looks through memo and dependent wrappers. It rejects placeholders
the executor substitutes, such as NULLs for skipped branches or masked
results.
- The executor passes the flags to the kernel through the result wrapper
(`FunctionResultWrapper.SetArgumentIsBin` / `ArgumentIsBin`). Kernels
that read `ivecs[i].GetIsBin()` now call `result.ArgumentIsBin(i)`.
  - `IffConditionTruthyAt` takes the flag as an argument.
- **Frontend:** prepared `SET` and `SELECT ... INTO @var` get the flag
from the bound plan expression (`colexec.ExprIsBinLiteral`), not from
the result vector.
- **Copy, selection and scan paths** (batch compaction, pSpool, borrowed
views, blockio membership reads, table_scan gather) only passed the flag
along, so they no longer touch it.

### Tests
- `go build ./...` and `go vet` are clean on the touched packages.
- Unit tests pass: `container/{vector,batch,pSpool}`, `sql/colexec/...`,
`sql/plan/...`, `frontend`, `sql/compile`, `tae/blockio`.
- New tests: `colexec/binary_literal_test.go` and
`plan/binary_literal_argument_test.go`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
fengttt added a commit to fengttt/matrixone that referenced this pull request Nov 22, 2026
This branch already carries matrixorigin#33033's commits; keep this branch's side.
fengttt added a commit that referenced this pull request Nov 23, 2026
…3019) (#33052)

## What type of PR is this?

- [x] Code Refactoring
- [x] BUG

## Which issue(s) this PR fixes:

issue #33019

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

A `Vector` now has exactly one owner pool, and nothing else about
memory. `offHeap`, `cantFreeData` and `cantFreeArea` are gone, replaced
by one `mp *mpool.MPool` set when the vector is created.

**Stacked on #33034 and #33033.** Review commit `90b459f68c` (the
change), the merge commit `d6fc6630fc` (upstream sync) and the
follow-ups `95155a83ad`, `83a5ef6377`, `af929a9ece`, `3aa882ce19`,
`a6e0d0e4e3`, `24c5d57fbb`, `4773ebe65d` and `53b867de02`. Everything
below `90b459f68c` belongs to the earlier PRs.

### The memory model

The model is written down in `docs/ai-skills/sql-engine.md` ("Vector
内存管理模型"):

- **One pool per vector.** Every vector comes from a pool and is freed
with it. All vector memory is off-heap, so a vector that is never freed
is a leak.
- **Strict pool check.** A call that passes `mp` must pass exactly the
vector's own pool. A view of the same pool doesn't count. A mismatch is
an error, and a panic in `Free`.
- **Read-only vectors.** A nil pool means a read-only reference to
memory the vector does not own, such as FileService cache entries or
Arrow buffers. Allocating into it or mutating it fails. `Free` only
drops its references.
- **Operator pools.** Operators that buffer a lot of data own a pool
from `colexec.NewOperatorMPool`: order, top, mergetop, group, window and
hash build, plus the table scan. Other operators use `proc.Mp()`.
- **Batch lifetime.** A batch is valid until the next `Next`. Moving an
input vector into the output is fine. Modifying an input vector is not:
the operator must write into a vector it owns.
- **No new `Vector` fields** without human review.

### Main changes

- **Window and decode.**
- `Window` returns a read-only reference; `CloneWindow`/`CloneWindowTo`
copy.
- Decoding into a vector that has a pool copies into that pool; decoding
into a read-only vector keeps references.
- A read-only vector's null bitmap is always private, so writes through
`GetNulls()` can never reach cache memory.
- **Table scan.** The scan owns its output pool, so later operators
cannot modify scanned rows.
- **Transaction workspace.** It copies caller batches into its own pool
and never takes them over. Each caller frees its own batch.
- **Read-only checks.** In-place setters (`SetFixedAt*`, `SetNull`,
`UnsetNull`) reject read-only vectors.
- **Freeing.** Decode receivers that belong to another pool are
rejected. tae `Vectors.Free` is strict. Most `vec.Free(vec.MPool())`
call sites now free with the owner's pool; a few holders of several
pools still free each vector with its own pool. `batch.CleanOwned` is
only for tests.

- **Filtered scans publish a batch selection.** When the scan's parent
reads selected batches (filter, projection), a filtered block without
deletes keeps every column as a read-only reference to the cache, pinned
by the output batch until the next `Next`, and the kept rows become the
batch selection (#33021). Otherwise the reader still compacts while its
cache entries are pinned: publishing and compacting later made SF100
TPC-H, whose scans all feed joins or aggregations, about 10% slower.
- **Faster selection conversions.** Bitmap to row list, bitmap to bool
mask and row list to bitmap now work a word at a time, size their output
once and reuse storage; `CompactInto` takes a reusable row list. Per
8192-row block: rows 11.4 → 1.8 µs at 50% and 21.7 → 2.8 µs at 100%;
mask 11.7 → 4.5 µs and 22.5 → 1.8 µs.

### Bugs fixed along the way

- **INSERT/LOAD IGNORE.** The NOT NULL fill wrote implicit defaults into
the child's vectors in place. For a scan's read-only vectors that meant
cache memory. A NULL varchar into a NOT NULL column also failed the pool
check.
- Now `colexec.IgnoreFill` adjusts a copy it owns, one reusable vector
per column. PreInsert, the external insert and multi_update use it.
- multi_update's main-table leg publishes the adjusted batch to the
index legs, so index rows see the same values.
- **Lock op.** Refresh timestamps were appended to the child's vector.
Lock op now fills its own vector and publishes it through a view.
- **Arrow external reader.** It swapped its vectors into the operator's
batch, so two owners shared one batch. Now the reader owns the batch it
publishes (`BatchPublisher`).
- **C null-map over-read.**
- A null bitmap ends at its highest null, but the docfilter and
cbloomfilter C kernels test every row's bit, so they read past it.
- Before this change, read-only decodes shared the bitmap with the
encoded buffer, which hid the over-read.
  - Fix: callers now pass `Bitmap.WordsCovering(n)`.
- **SET descriptor cache.** It kept zero-copy strings over vector
memory, which are now reused off-heap memory. It now clones them first.
- **Low-precision float sort.** Sort-and-compact for BF16 and the other
low-precision floats appended without a pool.
- **Sort rollup.** It unioned aggregate results through the wrong pool.
- **HNSW sync writer.** The ISCP writer kept zero-copy views of
change-batch vectors in its CDC buffer across batches. After a copy
ALTER or TRUNCATE, an int8/uint8 index trained its range from freed
memory and returned wrong neighbours. It now copies the vectors
(`af929a9ece`).
- **`fault_inject`.** It handed zero-copy argument strings to the local
CN's fault map, so the CN running the statement stored a garbage point
name and every fault-injection BVT case on that CN failed. It now copies
them (`3aa882ce19`).
- **Collation test.** The cherry-picked `95155a83ad` carried a copy of
`collation_metadata_test.go` older than `main`'s that did not compile;
`a6e0d0e4e3` takes `main`'s file and adapts it.
- **Pool mismatches.** hashbuild runtime-filter runs and `Expr_Vec`
literals were freed through the wrong pool.

### Behavior changes

- **Copying.** Scan rows read from objects with deletes or selections
are copied into the scan's pool. Raw workspace input is copied and
charged to the workspace account.
- **No spill recovery class.** The buffered data of Order, Top and Group
no longer switches to the recovery capacity class.
- **Removed tests.** Tests of the old borrow/copy-on-write contract are
removed.

### Tests

- `go build ./...` and `go vet ./pkg/... ./cmd/...` are clean.
- **Unit tests on the merged tree:**
- 412 packages pass; the four packages that failed only because of the
merge were fixed in `83a5ef6377` and now pass.
- The squash merges of #33011, #33017 and #33024 included commits pushed
to those PR branches after this branch forked from them. Their
production changes came in through the merge. Three plan tests had been
resolved to this branch's side, so `83a5ef6377` restores their updates.
`95155a83ad` is one of those commits, cherry-picked.
- `tests/service` `TestTaskSchedulerExpiresLostRunnerWithoutReplay` is
flaky: 2 of 4 runs fail on plain upstream `main` too.
- `tests/txn` `TestWriteSkewIsAllowed` failed in the full run and passes
when run alone.
- `util/metric/mometric` fails while a local cluster holds port 7001.
`util/metric/v2/dashboard` needs Grafana.
- **BVT on a two-CN `make dev-up` cluster built from this branch:**
- `load_data` passes 99%; the only failures are `into outfile`
permission errors from the environment.
- `dml` passes 98%; the failures need `AUTO_ID_CACHE`, a CDC loopback to
6001, or ETL data.
- The full run found the sort-rollup, HNSW and `fault_inject` bugs
above, all fixed. The fault-injection and clone cases were compared
against an upstream `main` image on the same cluster and now pass.
- The remaining failures also fail on the `main` image or need what the
dev cluster lacks: `AUTO_ID_CACHE`, statement tracing (`disableTrace =
true`), `into outfile` permissions, external servers. Optimistic cases
are excluded, as in CI.
- **Manual INSERT IGNORE check.** `INSERT IGNORE ... SELECT` from a
flushed table turns NULLs into implicit defaults, with one warning per
cell. The source still reads its NULLs with a cold and a warm cache.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
fengttt added a commit to fengttt/matrixone that referenced this pull request Nov 24, 2026
Merge marshal_selection_test.go and marshal_bench_test.go into
marshal_test.go: the tests that check UnionInt32/UnionOne results take the
right marshal path (bulk for disjoint payloads, canonical for shared const
payloads) and decode to the selected rows, plus both MarshalBinary
benchmarks.

TestUnionOneConstDestinationDoesNotAcquireDisjointProof is renamed
TestUnionOneConstDestinationStaysConst; the cached disjoint proof it named
was removed in matrixorigin#33033.

The two tests that do not marshal (UnionOne into a read-only window, and a
refused UnionOne allocation keeping the existing rows) move to
unionbatch_fastpath_test.go with the other union tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fengttt added a commit to fengttt/matrixone that referenced this pull request Nov 24, 2026
Move TestRollbackAppendRejectsBeforeMutation (an invalid append checkpoint
is rejected before any mutation, with an invariant error never classified
as a retryable capacity failure) and
TestAppendAllocatorLimitReturnsErrorAndKeepsPrefix (an allocator-limit
failure keeps its sentinel through the rollback and keeps earlier rows)
next to TestAppendCheckpointRollback, and delete rollback_error_test.go.

Drop a stale comment in RollbackAppend about keeping a "proof" fail-closed;
the cached disjoint flag it referred to was removed in matrixorigin#33033.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fengttt added a commit that referenced this pull request Nov 24, 2026
## What type of PR is this?

- [x] Code Refactoring

## Which issue(s) this PR fixes:

issue #33086

## What this PR does / why we need it

Vector validated native Unicode (`utf8mb4_unicode_ci` /
`utf8_unicode_ci`) text itself, on every append **and every copy**, and
turned off several copy fast paths for Unicode columns just to keep that
check. Copies re-validated values their source vector had already
admitted. This PR moves the check to where text values are produced,
like the JSON validation removed in #33023.

**Removed from vector (`vector.go`)**
- The check in `AppendBytesWithWriter`, `BuildVarlenaFromByteSlice`
(used by `AppendBytes` / `AppendStringList`) and
`BuildVarlenaFromVarlena`.
- The Unicode-only opt-outs of fast paths: the inline copy in
`TryUnionFlatFixedRows`, the empty-area/inline branches of union, and
`canPregrowRawByteList`.

**Added at the boundaries** (an audit showed `AppendBytes` was the only
guard for these inputs)
- `FunctionResult` byte writers (`AppendBytes`, `AppendMultiBytes`,
`AppendMustBytesValue`, `AppendBytesWithWriter`). All function and cast
results go through these, including non-assignment casts (`func_cast`
only validates in assignment mode). No function writes result bytes
through vector directly.
- LOAD DATA / external text fields: new `appendFieldText` in
`external.go`.
- Parquet: `appendParquetVarlenValue` already checked UTF-8 for
CHAR/VARCHAR; it now also enforces the utf8mb3 repertoire and covers
TEXT.

Values read from storage were validated when written, and key encoding
(`serial`, `index_util`) validates on its own.

**Tests**
- Deleted `vector/collation_metadata_test.go` and
`vector/collation_value_test.go`.
- The wire-format collation metadata round trip moved into
`vector_test.go` as `TestVectorWireFormatsKeepCollationMetadata`.
- The rejection rules are now `TestValidateCollationValue` in
`pkg/container/types`.
- New `TestFunctionResultValidatesUnicodeText` and
`TestFileInputValidatesUnicodeText`. Removing each new check fails every
bad case (12 and 6 subtests).
- The function test framework's "current vector rollback" subtest used
invalid Unicode only to force a mid-construction failure; it now uses a
capped pool.

## Open question for reviewers

Copies now rely on the source vector already having the destination's
exact type. A path that unions a legacy-charset vector into a Unicode
vector without a cast would no longer be caught. The audit found no such
path, and `BuildVarlenaFromVarlena` already documented the same-type
requirement, but this is the main residual risk.

`FunctionResult` still lives in `pkg/container/vector/functionTools.go`,
so the function-result check is physically in the vector package, though
it belongs to the function framework.

## Validation

- `mo-cgo-test ./pkg/container/... ./pkg/sql/plan/function/...
./pkg/sql/colexec/... ./pkg/sql/util/... ./pkg/common/collation/...`:
pass
- `mo-cgo-test -run '^TestUnicodeCollation' ./pkg/tests/sqlintegration/`
(`TestUnicodeCollationConsumerContract`): pass
- `go build ./pkg/...`, `go vet`, `golangci-lint` on vector, types,
external, function: clean

## Second commit: remove race-detector-only code (7bafa42)

Code must behave the same with and without `-race`; a real race is a bug
to fix.

- Removed race-only switches: vector `compile_config_*.go` (+ its two
debug checks and `typed_read_typecheck_test.go`), readutil
`compile_config_{race,no_race}.go` (sorted-rowid assert), `common/util`
`build_type_{debug,release}.go` (`Debug`, `RaceDetectorEnabled`), and
group `sanityCheck` (only ran under `util.Debug`).
- Dropped every `!race` build tag and race skip from tests. `-race`
reports no data race in the affected packages. Tests the race runtime
perturbs (it drops some `sync.Pool` puts on purpose) now assert what
holds in both modes: fulltext2 counts buffers taken vs. returned;
catalog subtracts seek-key pool refills; the matmul length test allows a
small pool-refill tolerance.
- **Real fix found on the way:** `vectorMatmulParseBound` missed sonic's
pooled optdec parser (~2.1 MB) that the first vecblock-JSON decode after
a GC allocates. A cold one-query parse allocated 2,104,984 bytes against
a 30,900-byte bound. Added `vectorMatmulJSONDecoderScratch` for
JSON-format queries; `TestVectorMatmulParseBoundCoversParse` now checks
`bound >= committed config + score scratch + one parser` and a truly
cold parse, including a one-query shape. JSON-query configurations now
reserve ~2.1 MB more during the parse; only the retained configuration
stays charged.

Validation: changed packages pass in normal and `-race` runs;
vector_matmul tests in compile, plan, function and sqlintegration pass;
`golangci-lint` clean.

## Third commit: delete `fixed_col_test.go` (35ed100)

It pinned that `MustFixedColWithTypeCheck` keeps a backed empty slice
for a zero-row vector, a behavior added for the dictionary vectors of
#32394. That code is gone from vector; no caller depends on the empty
view's capacity or nil-ness, and ordinary accessor use is covered
elsewhere.

## Fourth commit: remove the never-written legacy class 2 (638b177)

Class 2 was `DIST`, declared in #8367 but never assigned to a vector,
then `DICTIONARY` (#32394 to #33027), which `PrepareMarshalBinary`
refused to serialize. No encoder ever wrote class byte 2, so decoding it
as FLAT defended against data that never existed.

- Removed `LegacyRowBufferClass`, `decodedPhysicalClass` and the
`SetClass` panic. `UnmarshalBinaryV1` and objectio's legacy column
reader reject any class above `CONSTANT`; `validateVectorBinary` rejects
class 2 like any unknown class. Every class actually written decodes as
before.
- `legacy_class_test.go` is deleted. Its valuable part moved to
`vector_test.go` as `TestVectorDecodersRoundTrip`: a round trip of
fixed, varlen, JSON, const and const-NULL vectors through all five
decoders (including `UnmarshalWithReader`, tested nowhere else),
unknown-class rejection, and a check that decoding never rewrites the
caller's input bytes.
- The objectio window test drops the legacy case and is renamed
`TestReadOneBlockAllColumnsWindowClass`.

Validation: vector and objectio packages pass in normal and `-race`
runs; `golangci-lint` clean.

## Fifth commit: merge low-precision float tests (4db2a0c)

`lowprec_const_test.go` and `lowprec_float_test.go` are combined into
`lowprec_test.go`. The tests stay: they cover vector code specific to
bf16/float16/float8/float4 (const-set and union,
`GetLowPrecisionFloatAt` used by CDC, ISCP, export and data branch, the
decoder type allowlist, and the `RowToString` helper used by
`TestRowToString`). The marshal round trip now frees its decoded vectors
and checks the pool is empty.

## Sixth commit: combine marshal tests (46f01e8)

`marshal_selection_test.go` and `marshal_bench_test.go` are merged into
`marshal_test.go`: the tests that check `UnionInt32`/`UnionOne` results
take the right marshal path (bulk for disjoint payloads, canonical for
shared const payloads) and decode to the selected rows, plus both
`MarshalBinary` benchmarks.
`TestUnionOneConstDestinationDoesNotAcquireDisjointProof` is renamed
`TestUnionOneConstDestinationStaysConst`, since the cached disjoint
proof it named was removed in #33033. The two tests that do not marshal
(`UnionOne` into a read-only window, a refused `UnionOne` allocation
keeping existing rows) move to `unionbatch_fastpath_test.go` with the
other union tests.

## Seventh commit: merge mpool tests into `mpool_test.go` (4b6a531)

`mpool_contract_test.go` (a vector allocates only from its own pool;
nil-pool vectors are read-only; windows share bytes while `CloneWindow`
and owned decodes copy) and the accounted-view fixtures from
`mpool_view_fixtures_test.go` are combined into `mpool_test.go`.
Leftovers from when vectors carried an account are dropped:
`newAccountedTestVector` was only `NewVec`, so its seven call sites call
`NewVec` directly, and the never-set `class` field of
`testVectorAllocationAccount` is replaced by
`AllocationCapacityClassDefault`.

## Eighth commit: move rollback tests into `vector_test.go` (e4eb415)

`rollback_error_test.go` is deleted; its two tests move next to
`TestAppendCheckpointRollback`.
`TestRollbackAppendRejectsBeforeMutation` checks that an invalid append
checkpoint is rejected before any mutation, with an invariant error that
callers (parquet reader, vector append paths) never classify as a
retryable capacity failure.
`TestAppendAllocatorLimitReturnsErrorAndKeepsPrefix` checks that an
allocator-limit failure keeps its sentinel through the rollback and
keeps earlier rows. A stale comment in `RollbackAppend` about keeping a
"proof" fail-closed (the cached disjoint flag removed in #33033) is
dropped.

## Ninth commit: fold `scan_followup_test.go` into `vector_test.go`
(ee64e88)

The `GetMinMaxValue` tests from #30338 move next to `TestBoolMinMax` as
`TestGetMinMaxValueFixed`, `TestGetMinMaxValueConst` and
`TestGetMinMaxValueInt64Windows`. They cover the int64 kernel for flat,
null-free columns of 32+ rows (sizes around its threshold, windows at an
offset, every value order), the bool early exit, NULL masks, read-only
backing, and that the call does not modify the vector. The
`GetMinMaxValue` benchmarks stay (`BenchmarkGetMinMaxValue`,
`BenchmarkGetMinMaxValueInt64Distributions`); the raw-loop controls, the
UTF-8 counting cases (they measure `lengthutf8`, which has its own
benchmark), and the read-only and constant variants are dropped.

## Tenth commit: unrolled min/max for every integer type and
float32/float64 (1d9ad0f)

The 4-accumulator `GetMinMaxValue` kernel was int64-only. It now covers
every integer-backed type (int8-64, uint8-64, bit, date, year, datetime,
time, timestamp, enum) through `IntegerGetMinAndMax`, and
float32/float64 through `floatMinMaxNoNull`, which uses plain
comparisons from ±Inf so NaN is skipped exactly as before (an all-NaN
column still reports no comparable value; a +0/-0 tie may report either
zero). Both apply to flat, null-free columns of at least 32 rows; the
kernels move from `scan_minmax.go` to `minmax.go`.

Four accumulators measured best among 1, 2, 4 and 8, and the reslicing
loop beat an index loop. Speedup of `GetMinMaxValue` on arm64, null-free
random columns:

| rows | int8 | int16 | int32 | int64 | float32 | float64 |
|---|---|---|---|---|---|---|
| 128 | 1.49x | 1.33x | 1.41x | 1.40x | 1.96x | 1.74x |
| 2048 | 1.54x | 1.56x | 1.34x | 1.37x | 2.51x | 2.50x |
| 65536 | 1.54x | 1.54x | 1.35x | 1.37x | 2.64x | 2.65x |

`TestGetMinMaxValueUnrolledKernels` checks all 17 types against a plain
loop (960 subtests); breaking the integer tail, the float "found" flag
or the float starting values each fails it.
`BenchmarkGetMinMaxValueByType` covers each width.

Note for a follow-up: scalar Go is at about 0.46 ns per element at every
width. A clang `-O3` C kernel via cgo measured ~40x (int8), ~10x (int32)
and ~2.5x (int64) faster at 65536 rows, but loses below a few hundred
rows and for floats, so it would need a row threshold and explicit float
handling.

## Eleventh commit: merge `search_gallop_test.go` into `search_test.go`
(382b93f)

The galloping prefix-IN tests (`CollectOffsetsByPrefixInFactory` against
the linear and merge references) and their helpers move into
`search_test.go` next to the other `search.go` tests. `search.go` itself
stays in vector: all of its functions are used by the primary-key block
filter in `readutil/pk_filter.go` and by objectio's cached-vector
search.

## Twelfth commit: drop older-writer handling from the selected-rows
codec (4701fbc)

`selection_codec.go` stays: it lets group/aggregate spill and
materialized sources write selected rows without first copying them into
a new vector, so spill can proceed when the memory budget is exhausted.
But every record is written and read by the same process within one
query, so data from an older writer cannot exist. The decoder's handling
of the retired kind, binary-string and string-source metadata fields,
the legacy ROLLUP grouping bit and their trailers is removed; NULL is
now the only defined bit and any other header or row-flag bit is
rejected. `MarshalSelectedFlagsTo`, which had no production caller, is
removed with the tests that covered only it or older-writer data.

Benchmarks (median of 6-10 runs, arm64): fixed-width encode/decode and
sparse encode unchanged; text decode unchanged to 12% faster (nullable
strings); group spill writer unchanged.

## Thirteenth commit: reorganize vector test files (7dcdae4)

Small test files are merged into the file for the code they test (24
test files become 15):

| file | now also contains |
|---|---|
| `union_test.go` (from `union_fixed_test.go`) | `union_fixed_rows`,
`unionbatch_fastpath`, `union_fixed_bench` tests |
| `append_test.go` | `append_bench_test.go` |
| `marshal_test.go` | `unmarshal_bench_test.go` |
| `search_test.go` | the `CollectOffsetsBy*` tests from `utils_test.go`
|
| `functionTool_test.go` | `function_parameter_conversion_test.go` |
| `vector_test.go` | `shrink_negate_boundary`, `area_disjoint`,
`typed_read`, `vector_narrow` tests |

`BenchmarkUnmarshal` and the one-row accessor benchmarks
(`BenchmarkToTypedSlice`, `BenchmarkToFixedCol`,
`BenchmarkMustFixedCol`) are deleted; `BenchmarkVectorUnmarshalBinary`
and `BenchmarkVectorTypedRead` cover them at scale. All other tests and
benchmarks are kept (211 functions before, 207 after: the four
benchmarks and one rename). Stale wording is fixed: the union test's
"lease" backing is now "external", "borrowed"/"lender"/"proof" comments
describe read-only vectors and computed disjointness, and
`TestVarlenaAreaIsDisjointIsComputedFromDescriptors` is renamed
`TestVarlenaAreaIsDisjointEdgeCases`. `bulk_copy_test.go` and
`clone_compact_test.go` are reworked on a separate branch and left
unchanged here.

## Fourteenth commit: drop redundant `vector_test.go` tests and split it
by topic (f1cd8ed)

Each package test was run alone with coverage. Tests in `vector_test.go`
that cover no code another test does not, and assert little beyond "no
error", are deleted: `TestLength` (it asserted a field it had just set),
`TestConst`, `TestDup`, `TestAppend`, `TestAppendBytes`,
`TestAppendArray`, `TestUnionOne`, `TestStrMarshalAndUnMarshal`,
`TestArrayMarshalAndUnMarshal` and `TestProtoVector`. Their paths are
value-checked by `union_test.go` (which uses `UnionOne` as its
reference), `marshal_test.go`, `mpool_test.go` and
`TestVectorDecodersRoundTrip` (which round-trips through proto).
`TestSize` and `TestCapacityForUntypedNull` become
`TestSizeAndCapacity`, which checks real fixed and varlena sizes.
Regression tests with no unique coverage but a specific assertion are
kept.

Topic tests move out of `vector_test.go` (5703 lines to 4025):

| Destination | Moved |
|---|---|
| `union_test.go` | union marker, metadata, preflight and capacity
tests, union benchmarks; `TestMisc` renamed `TestUnionAllFixedSizeTypes`
|
| `lowprec_test.go` | the low-precision float ordering, NaN min/max and
access tests |
| `minmax_test.go` (new) | `GetMinMaxValue` tests, fixtures and
benchmarks |

Package coverage is unchanged apart from blocks reached only by the
randomized `TestUnion2VectorVarlen`.

## Fifteenth commit: drop redundant union tests (a402266)

Same per-test coverage method as the previous commit, applied to
`union_test.go`. Deleted: `TestUnionBatchVarlenFastPath` (the no-null
twin of `TestUnionBatchNullFastPath`, which checks the same seeded
target against the same per-row `UnionOne` oracle plus nulls),
`TestUnionOneEmptyMarkerSets` (fixed-width `UnionOne` copies, checked
more thoroughly by `TestFixedSourceRowsMatchUnionOne` and
`TestUnionFixedSelection`) and
`TestUnionOneNullDoesNotClearWindowOwnerDescriptor` (windows are
read-only, so it only checked that appending to one fails, which
`mpool_test.go` covers). `TestUnionBroadcastAndPregrow` becomes
`TestUnionVarlenGatherAndBroadcast`: its full-range `UnionBatch` case
duplicated the null fast-path test, and its `AppendMultiFixed` case
moves to `append_test.go` as `TestAppendMultiFixedBroadcast`.

Tests and benchmarks named after the removed marker sets and metadata
are renamed: `TestUnionOneSourceShapes`,
`TestUnionOneAndMultiMixedSources`, `BenchmarkUnionOne`,
`BenchmarkUnionMulti`, `BenchmarkUnionBatchVarlenInline`. Package
coverage is unchanged (apart from the randomized
`TestUnion2VectorVarlen` blocks noted above).

## Sixteenth commit: drop a duplicate marshal test, move marshal tests
(c2e0d70)

`TestUnionSelectionKeepsConstVarlenaAliased` repeated the second half of
`TestUnionOneConstVarlenaCopiesIndependentPayloads` (a const selected
twice through `UnionInt32` shares its payload and marshals canonically)
and is deleted. The marshal, unmarshal and wire-format tests move from
`vector_test.go` to `marshal_test.go`:
`TestOwnedVarlenaMarshalKeepsBulkLayout`,
`TestNullableFixedWidthMarshalDoesNotCastAsVarlena`,
`TestMarshalAndUnMarshal`, `TestMarshalBinarySizeRejectsInvalidVector`,
the `TestUnmarshalBinary*` tests,
`TestVectorWireFormatsKeepCollationMetadata` and
`TestVectorDecodersRoundTrip`. Two stale comments are fixed: the
owned-varlena marshal benchmark no longer calls itself the "non-Arrow
control", and a window is described as a read-only reference that
marshals only its rows.

## Seventeenth commit: keep `unsafe` out of reorganized test files
(a60c5b5)

SCA's `checkunsafe` allows the `unsafe` import only in listed files. The
reorganization had renamed `functionTool_test.go` (listed) and moved a
min/max helper using `unsafe.Sizeof` into `minmax_test.go` (not listed).
The original file name is restored, the area-backing check compares
`&area[0]` with `require.Same`, and the signed minimum is found by
shifting 1 up to the sign bit, so neither file imports `unsafe`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

This branch was previously deployed

1 inactive deployment
ci — 2aeb388c Deployed Nov 22, 2026 by fengttt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/refactor Code refactor size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants