dbtsai opened a new pull request, #400:
URL: https://github.com/apache/spark-connect-rust/pull/400
### What changes were proposed in this pull request?
Provide a Python public `pyspark.sql.DataFrame` base/factory so independent
subclasses can initialize Python-owned state and override operations. Ordinary
construction returns the concrete native Connect frame. Public calls dispatch
to the current concrete implementation, and removing temporary public-class
overrides restores the prior concrete state. Preserve public-base fallbacks and
add subclass, dispatch, restoration and annotation regression coverage.
### Why are the changes needed?
The public class currently reexports the native allocator. Official
PySpark's `MockDataset` allocates a Python subclass with `object.__new__(cls)`,
which raises `TypeError` with that allocator before its initializer runs. The
official pipeline tests depend on this pattern.
### Does this PR introduce _any_ user-facing change?
Yes. This example can initialize the subclass's own state:
```python
from pyspark.testing.mlutils import MockDataset
assert MockDataset().index == 0
```
The native concrete class has virtual public-base membership; its actual MRO
remains native, so `super(DataFrame, native_frame)` is unsupported. Direct
native subclasses must initialize their native payload through its constructor.
The public base uses an `ABCMeta` subclass; ordinary Python subclasses use
standard `abc.ABCMeta`, while unrelated metaclasses require a combined
metaclass. Public and Connect `Column` aliases are the same native object,
although its advertised module metadata differs from official public PySpark.
Inherited signatures and factory/metaclass differences remain; full DataFrame
or ML parity is not claimed.
### How was this patch tested?
- On the final helper-name/comment revision, this selection passed **13
cases**, with 81 deselected and no skips, failures or errors:
```bash
python -m pytest -q --rootdir=python --import-mode=importlib \
python/tests/test_ml_offline.py \
-k 'public_dataframe or python_dataframe_subclass or
local_dataframe_subclasses_cloudpickle'
```
Pytest exited 0. The outer harness exited 1 because it incorrectly
expected at least 22 cases from this narrower selection; that counting failure
was retained and assessed separately.
- Before those two private-helper renames and comment changes, the full
offline selection passed **2,676 Python tests**, including all **22 required
subclass cases** and the new annotation assertions; eight separate live-server
cases skipped. Those results carry forward as historical executions: reversing
the private-helper renames produces the same AST, and all other source, tests,
compiled inputs and the extension are unchanged.
- Historical checks on identical Rust/build inputs passed 141 core Rust
tests, 495 API Rust tests, formatting, extension build, all-test compilation
and wasm-udf test compilation. These were verified and carried forward rather
than rerun. Advisory workspace/all-target Clippy exited **101** at source sites
assessed as inherited; a clean lint result is not claimed.
- The unchanged 20-case official pipeline/tuning/one-vs-rest selection
passed on both official and native high-level clients under predeclared
`PYTHONHASHSEED=0`: **16 passed / four upstream-disabled GC skips each**,
including `test_pipeline` and `test_identity_pipeline`. This is bounded
historical evidence. An earlier default-hash native Random Forest
cross-validation run failed on a one-class training fold; the failure is
retained and its cause remains unproven.
- The artifact independently ran official high-level PySpark through its
Rust transport plugin: **39 passed / five skipped** across configuration,
DataFrame creation, pipeline, tuning and one-vs-rest. Configuration/creation
accounted for 23 passes and one skip; ML accounted for 16 passes and four GC
skips. This transport execution is distinct from the native high-level ML
selection above and predates only the private-helper renames/comments.
- The third cloudpickle probe passed on the source before those
renames/comments: an ordinary local subclass and captured closure were
reconstructed and exercised in an official-only consumer without native
imports. This coverage excludes independent instances, explicit user
metaclasses, native DataFrame serialization and server UDFs.
- API assessment covered all **500 canonical mismatch records / 171
controlled fields**, plus 12 central API groups and the Row-name gate. Getter
parameter annotations now match official PySpark, and tests verify the return
annotation is the public/Connect `Column` object. The raw comparison exited 1
for assessed differences; public/concrete name inventories have no missing
public names. Native MRO, metaclass, factory, inherited-signature and `Column`
module-metadata limits remain visible.
- Shared transport evidence was completed on a separate artifact with the
same **53 transport/build/dependency inputs**: 87 ordinary modules recorded
2,586 passes, 641 skips, one manifest deselection and one retained expected
catalog-drift failure; four separate cluster modules recorded 15 passes and 14
skips. No unexpected failures remained. This candidate carries that
common-source evidence and executed its own plugin checks above; it did not
execute those full suites. Source equality does not establish binary
equivalence. The shared harness does not record complete dependency-tree
start/end attestations, per-case skip provenance or per-module pytest exit
codes.
Final independent full-patch review completed with no remaining findings.
All earlier findings and fixes, including the final helper-name and comment
changes, were assessed. The execution boundaries and retained failures above
remain part of the validation record.
### 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]