Skip to content

Rebuild Python UDF with typed revisions and Arrow Flight execution - #29152

Merged
XuPeng-SH merged 302 commits into
matrixorigin:mainfrom
iamlinjunhong:m-28132
Nov 28, 2026
Merged

XuPeng-SH merged 302 commits into
matrixorigin:mainfrom
iamlinjunhong:m-28132

Conversation

@iamlinjunhong

@iamlinjunhong iamlinjunhong commented Sep 20, 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:

Related to #28132. This PR delivers the opt-in external Python UDF adapter for test and development. Production sandboxing and tenant isolation remain outside this stage.

What this PR does / why we need it:

Python type-family checks and launch config

Commit b23ac8120eb6c71223ef9c3688f86522c3808c4f declares the intended Python decimal and temporal subsets checked by TestTypeSwitchFamilies. DECIMAL256 and YEAR remain outside the Python ABI. TIME keeps the Arrow Duration representation, and TIMESTAMP NULLs use an explicit typed branch. The type-check baseline is unchanged. The rebase onto 940d135ce8c0af3e0d855fb19f71e87d5ff8904d also preserves both the upstream Sirius settings and the Python UDF client settings in etc/launch/cn.toml. Both remain disabled by default. Failing Coverage worker

New Darwin/arm64 validation reproduced all eight diagnostics on the prior head and passed go test -short -tags matrixone_test -count=1 -run '^TestTypeSwitchFamilies$' ./pkg/container/types with the fix. The Python UDF Go package in short mode, seven focused catalog and launcher tests, TOML equivalence checks, scoped vet and lint, and the Loom artifact check passed. Earlier SQL parser evidence remains applicable. Hosted CI has yet to validate the new commit.

Coverage workflow refresh

Rebased onto official main at 3cb7a5e4a93dc5bd85e0fb107e558a07df934693 to pick up the shared Coverage controller and worker update. The previous run's two Coverage workers succeeded, and both selectors received HTTP 403 while reading worker metadata. The Coverage summary therefore had no complete inputs. Previous run · Shared CI fix

The PR patch content is unchanged at c73c922a5fc5a78ae0e97c2be5ed26c182df449d. Fresh validation passed for node --test .github/ci/*.test.cjs (86 tests), actionlint on the active entrypoint and Coverage worker, the full parser suite, two focused backup tests, vet on cmd/mo-service and pkg/backup, and Loom's artifact check. The parser and prepared-routine regression sources are unchanged. The earlier real SQL result below is retained. Hosted CI on the rebased head is pending.

SQL identifier compatibility

Commit af7fcda18ee8ed21acd431a38b87a473cf6c53bc restores bare called, input, scalar, and vector in generic function calls, role names, and Iceberg references. Python routine mode and NULL-policy clauses still use these keywords. Review finding

New Darwin/arm64 validation with Go 1.27.1:

  • go test -count=1 ./pkg/sql/parsers/... passed. All 16 focused cases returned syntax errors on the prior head and passed with the official main parser overlay and with the fix. Repository goyacc regeneration was byte-identical with zero conflicts.
  • go test -tags=matrixone_test -run '^TestPreparedRoutineFieldHistory$' ./pkg/tests/sqlintegration passed against a real embedded CN. An unquoted SQL routine named vector worked in direct queries and binary PREPARE. The existing text PREPARE control also passed.
  • Scoped vet, incremental lint, and Loom's PR artifact check passed. The previous head's CI remains the reference for unchanged worker and runtime paths. This round used the parser and embedded CN lanes. Hosted CI for the new commit is pending.

Replace the demo's per-value protobuf transport with typed, revision-bound Python UDF execution over Arrow Flight. CN evaluates expressions using native MatrixOne vectors and runs user code in external handler processes.

  • Share immutable routine revisions, type descriptors, and exact overload identities with SQL UDFs. Validate definitions before publishing digest-addressed artifacts. Invalidate cached and prepared calls when the overload namespace changes.
  • Support scalar and vector handlers while preserving SQL evaluation semantics, including conditional execution, NULL handling, and DML error atomicity.
  • Bound Gateway and worker admission, stream windows, and terminal state. Cancel work independently across invocations and clean up owned handlers on worker exit. Exercise real workers through SQL and existing multi-CN CI/BVT.
  • Keep Python disabled in generic launch. Enabling the development adapter requires explicit unisolated opt-in.

Current design contract (r46) · Design and approval history · Implementation and rollout · Overload validation · Usage and BVT cases

Compatibility and rollout

  • Preserve existing SQL UDF behavior, including overload ranking and snapshots with historical catalog layouts. Legacy demo Python definitions require explicit recreation. A retained v4.2.6 launcher block for the old Python server is skipped with a migration diagnostic. Snapshot and launcher evidence · Overload compatibility evidence
  • The current contract uses catalog 4.0.7/53 and retains MORPC 134 and the Arrow/Flight ABI. The new Python status RPC uses separate slots from the upstream cache-locality RPC. Worker/Gateway capabilities and environment digests must agree before execution.
  • Artifact publication uses a shared lifetime reservation limit. Production isolation, authenticated/TLS Flight, and full production Operator rollout are outside this stage. See the current design contract for limits and remaining verification.

Validation and open review

  • At e7d568b65b0b, hosted CI Required, ARM64 SCA, and the enabled multi-CN BVT lanes passed. The rebased head also has local parser regeneration, focused FLUSH/PREPARE, Python SQL, and cancellation coverage. Hosted release-upgrade lanes were skipped. CI run
  • Earlier targeted evidence covers published catalog fixtures, real Flight workers, and cross-account snapshot restore. The capability-probe cancellation fix passed focused race tests and CI on 41947d4bce9a. Earlier capability-fix CI
  • Open change request for e7d568b65b0b. The latest review reports that newly reserved words break some previously valid unquoted identifiers in shared SQL parsing. Current review

@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 added kind/bug Something isn't working kind/feature kind/enhancement kind/documentation Improvements or additions to documentation kind/test-ci labels Sep 20, 2026
@matrix-meow matrix-meow added the size/L Denotes a PR that changes [500,999] lines label Sep 20, 2026
Sync newly provisioned shared roots and their parent entries before accepting publication, retry sync on reopen, and preserve pre-provisioned roots below search-only ancestors. Reconcile routine definer test fixtures with the rebased catalog writes.
Keep same-version routine round-trip, index expression cloning and coordinator ownership checks after main removed mixed-version execution gates.
Keep shared FileService startup independent of parent-directory sync. Recheck the root and ancestor entries before reserving or accepting Python artifacts, and keep publication fail-closed across restarts and sync retries.
Keep upstream cache-locality RPC fields and use the next free tags for the unpublished Python status RPC. Refresh the wire fixtures and record the r46 current-stage contract.
@XuPeng-SH

XuPeng-SH commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: b23ac8120eb6c71223ef9c3688f86522c3808c4f

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-local · review

Commit: b23ac8120eb6c71223ef9c3688f86522c3808c4f

Assessment: approve

Approve the explicitly enabled, trusted development-stage implementation. It reuses the existing SQL evaluator, catalog, and FileService; immutable revisions, worker execution, and bounded fencing serve distinct lifecycle and recovery responsibilities. Earlier capability-cancellation and SQL identifier regressions are addressed. Architecture and SQL/Planner decisions remain pending review status; the assigned review procedure does not establish them as a separate gate for this stage.

Model: gpt-6.1-terra / max

Session: 01a220f2-4126-7281-a3bf-dbc612e51e78 · slot 0 · generation 36

Validation:

  • The frozen source, 280-path patch, 195 discussion keys, and 195 native build inputs were reconciled successfully. Records are in final-audit-v4.log and validation-reconciliation.json; audit receipt checks/1795858732648896511-6.json.

  • Isolation preflight passed. The Python worker suite passed 154 tests, and focused gateway tests passed capability-cancellation, artifact-admission, and real-worker Flight cases. Receipts: checks/1795857724884509755-2.json, checks/1795857890044581150-2.json, and checks/1795857946285977060-2.json.

  • Parser and type checks passed, the generated parser matched the grammar, and an embedded prepared-statement test passed in binary and text modes. Receipts: checks/1795857958352917758-2.json, checks/1795858166921976746-2.json, and checks/1795858711801997252-2.json.

  • An embedded SQL server with a real Python worker passed boundary tests for type widths, failed replacement, artifact recovery, and READ COMMITTED no-replay behavior. Receipt: checks/1795858613005398481-2.json.

  • Focused physical backup and fresh-WAL restore tests passed. A single-CN released-schema fixture passed legacy SQL routine repair, replacement, and retained-snapshot restore checks. Receipts: checks/1795858347088087549-2.json and checks/1795858351926658713-2.json.

  • The supplied exact-head CI snapshot reports successful build, unit, coverage, and active multi-CN BVT jobs; raw named-case logs were unavailable.

Limitations:

  • Three permission-sensitive publication subtests skipped in the isolated runtime and are not counted as passes. Earlier same-PR host-user review evidence and current source were considered for the ancestor-permission paths.

  • The upgrade fixture models released catalog schemas; no historical server binary or released backup was run locally. The supplied CI upgrade lanes were skipped. A prior same-PR review reported matching the fixture and launcher inputs to v4.2.9 artifacts.

  • The permanent 1,024-identity artifact budget and temporary group-fence exhaustion are documented development-stage limits. This assessment does not establish production throughput, quota fairness, or sandbox isolation.

This branch was successfully deployed

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

Labels

kind/api-change kind/bug Something isn't working kind/documentation Improvements or additions to documentation kind/enhancement kind/feature kind/refactor Code refactor kind/test-ci size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants