dbtsai opened a new pull request, #654:
URL: https://github.com/apache/spark-connect-rust/pull/654

   Depends on [#549](https://github.com/apache/spark-connect-rust/pull/549), 
based on its published head `3e41297b6099d23c278500447906dc418ed4bbd0`. The 
diff against Apache `master` includes that parent until it lands. Review the 
[expression-only 
comparison](https://github.com/dbtsai/spark-connect-rust/compare/3e41297b6099d23c278500447906dc418ed4bbd0...9c494b2dfd3614dc04b8182617f4ccdd170b7d64).
 This draft needs a rebase with the parent and review of the 
construction/memory tradeoffs below.
   
   ### What changes were proposed in this pull request?
   
   Store each shared expression as a node with an `ExpressionKind` payload, 
ordered shared children, explicit declared type state and construction origin. 
Add checked construction/rebuilding, unique-node and occurrence visitors, and a 
memoized bottom-up rewrite that preserves sharing and unchanged node identities.
   
   `ExpressionSpec` provides typed construction. UDF payloads and declared 
types are shared during rebuilding; immutable opaque protobuf payloads cache 
their physical depth. Short function argument lists stay inline; wide calls 
reuse their builder allocation. The [design 
guide](https://github.com/dbtsai/spark-connect-rust/blob/9c494b2dfd3614dc04b8182617f4ccdd170b7d64/dev/design/expression-representation.md)
 documents ordering, traversal boundaries and recursion limits.
   
   ### Why are the changes needed?
   
   Expression consumers can inspect and rewrite all structural inputs through 
one interface, following the plan representation in #549. This establishes a 
boundary for future lowering adapters. Name resolution and type inference 
remain server operations.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, for direct Rust representation users in the unreleased 4.3 line. The 
former `ExpressionNode` enum becomes construction-only `ExpressionSpec`; 
`expression.node()` now borrows an enclosing struct. Match on 
`expression.kind()` and inspect inputs with `expression.children()`. The 
[compatibility 
guide](https://github.com/dbtsai/spark-connect-rust/blob/9c494b2dfd3614dc04b8182617f4ccdd170b7d64/docs/compatibility.md)
 includes migration examples. Column/DataFrame/Python APIs and the Connect 
protocol retain their behavior.
   
   ### How was this patch tested?
   
   Added exhaustive normalization fixtures, invalid-layout checks, 
sharing/origin/depth and traversal/rewrite tests, opaque-payload tests, and 
argument-storage regression coverage.
   
   - Final source: `9c494b2dfd3614dc04b8182617f4ccdd170b7d64`, tested with Rust 
1.100.0 and Spark 4.3.0.
   - Release library tests: 698 passed. Full live Rust client/core run, 
including doctests: 1,376 passed, 29 ignored, zero failed.
   - Workspace all-target check, all default/WASM integration-test compilation, 
and formatting passed.
   - Native Python offline drop-in/Arrow/ML: 3,285 passed, 8 skipped. Live 
Arrow/drop-in/ML: 316 passed.
   - Public-name inventory: zero missing names across 12 selected classes; this 
checks names, not complete signature/behavior parity. No-stub audit, strict 
MkDocs, 60 published Rust snippets and the design snippet passed.
   - Scoped client Clippy passes. Workspace Clippy still has 73 inherited 
errors; location/source comparison found no new emitted diagnostics.
   - Earlier official reference-builder/raw-transport coverage remains 
applicable to unchanged code: 87 files, 2,594 passed, 624 skipped; separate 
resource/artifact phase 15 passed, 14 skipped. These historical runs precede 
the final native-expression optimization and do not substitute for the fresh 
native tests above.
   
   The existing localhost benchmark harness ran 24 of 353 cases, with three 
rotating fresh-process samples per client/case and matched Maturin builds 
against the exact #549 parent. Both Rust clients are 4.3.0. All 144 Rust 
samples passed fixture checks, and all 72 paired RPC counter dictionaries 
matched, including request-byte counts. The overall command exited 1 because 
nine Python-reference 4.2.0 depth-32 cases hit the existing upb decode-depth 
limit.
   
   Construction regressions remain:
   
   | Case | Parent median | This PR median | Change |
   | --- | ---: | ---: | ---: |
   | IN, 1,000 values | 57.442 µs | 72.446 µs | +26.1% |
   | IN, 10,000 values | 461.683 µs | 679.992 µs | +47.3% |
   | Linear expression, depth 12 | 8.500 µs | 9.894 µs | +16.4% |
   | Linear expression, depth 32 | 21.513 µs | 23.062 µs | +7.2% |
   
   These four cases have separated sample ranges; construction timing includes 
disposal of overwritten results. The canonical node is 160 bytes versus the 
parent's 104-byte enum. Measured held-RSS growth for IN-10,000 increases from 
1,424 to 1,888 KiB; the shared-DAG depth-10 outbound case decreases from 7,072 
to 5,376 KiB. This is a small-sample screen with canned gRPC responses, not 
query-execution performance evidence or a no-regression claim. Performance 
acceptance remains open in this draft.
   
   The parent currently conflicts with `master`. When integrating the stack, 
newer ML enum matches on `.node()` must migrate to `.kind()`; current-parent 
validation does not establish current-master integration.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: OpenAI Codex
   
   This pull request and its description were written by OpenAI Codex.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to