Skip to content

fix(embedding): preserve retained casts and protect destructive MO inputs - #30

Merged
aunjgr merged 6 commits into
matrixorigin:upstream-dev-mergefrom
aunjgr:fix/embedded-varchar-identity-cast
Oct 11, 2026
Merged

aunjgr merged 6 commits into
matrixorigin:upstream-dev-mergefrom
aunjgr:fix/embedded-varchar-identity-cast

Conversation

@aunjgr

@aunjgr aunjgr commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Public MatrixOne TPC-H execution exposed two GPU correctness failures: Q7 failed on a retained VARCHAR identity cast, and Q15 could silently split a destructive MO input between consumers of a shared CTE.

Exact Substrait preparation skips DuckDB's ordinary optimizer and retains semantic VARCHAR → VARCHAR casts. Preserve string values and validity by transferring an owned column or copying a borrowed view on the caller's stream and memory resource, instead of passing STRING to cuDF's fixed-width cast.

Validate reachable read consumption through ReferenceRel before admitting work. Shared references cannot replay a destructive MO input, and unreachable MO bindings cannot start producers that never receive a consumer. A single reference and immutable TAE replay remain valid. Reference expansion has explicit node/depth bounds. MatrixOne's accompanying fix gives each inlined MO occurrence an independent reader on the same snapshot; canonical SQL stays unchanged.

Update the value-variant test to guard the already merged, appended exact coefficient at index 21. Its stale 21-alternative assertion prevented the owning test target from compiling. No native API or numeric ABI layout change.

Validation:

  • VARCHAR ownership, empty/ASCII/Unicode values and NULL under MATERIALIZE, AST_INTERPRET and AST_JIT: 22 assertions passed. Owning expression suite: 1,383 assertions in 18 cases passed.
  • CUDA memcheck over cast/value cases: 106 assertions in 28 cases, zero errors.
  • Shared-reference regression fails on the previous validator because it accepts two consumers of one MO binding; passes with this fix. Full binding suite: 856 assertions in 82 cases passed.
  • Current control suite: 606 assertions in 78 cases passed. Freshly relinked GPU consumers: 30,635 assertions in 18 cases passed.
  • Public MatrixOne development validation: canonical Q7 and Q15 match native MO, including complete rows/descriptors, completed GPU work, healthy cleanup and zero retained input/result credit. All 22 SF1 queries have passing smoke evidence. These checks are development evidence, not full campaign acceptance.
  • Changed-file hooks passed.

Prerequisite for MatrixOne #28968. Base: upstream-dev-merge.

@aunjgr
aunjgr marked this pull request as ready for review October 10, 2026 20:06
@aunjgr aunjgr changed the title fix(expression): preserve semantic VARCHAR identity casts fix(embedding): preserve retained casts and protect destructive MO inputs Oct 10, 2026
@aunjgr
aunjgr merged commit 955b688 into matrixorigin:upstream-dev-merge Oct 11, 2026
6 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant