jiayuasu opened a new pull request, #925:
URL: https://github.com/apache/sedona-db/pull/925

   Small follow-up to #908. Completes the join surface from #791.
   
   ## API
   
   ```python
   df.cross_join(other)
   ```
   
   - Returns the Cartesian product of `self` and `other`.
   - Result row count is `len(self) * len(other)`.
   - Both sides' columns are kept verbatim — matches PySpark's `crossJoin` 
shape. Disambiguate via `df.alias(...)` if column names collide.
   - No `on=` / `how=` — those would be `join(...)`.
   
   ## Implementation
   
   DataFusion's `DataFrame` doesn't expose a direct `cross_join` method (52.5); 
the builder lives on `LogicalPlanBuilder`. The Rust binding uses 
`DataFrame::into_parts` to split off the `SessionState`, runs 
`LogicalPlanBuilder::cross_join`, and reassembles with `DataFrame::new`.
   
   | File | Change |
   |---|---|
   | `python/sedonadb/src/dataframe.rs` | New 
`InternalDataFrame::cross_join(right)`. Plan-builder path; no per-row work. |
   | `python/sedonadb/python/sedonadb/dataframe.py` | New 
`DataFrame.cross_join(other)`. Validates `other` is a DataFrame; otherwise 
raises `TypeError`. |
   
   ## Test plan
   
   7 tests in `tests/expr/test_dataframe_cross_join.py`:
   
   - **Positive**: 2×2; multi-column on both sides; 1×N; empty×N (zero rows); 
aliased sides sharing a key name (row-count check, since `to_pandas` collapses 
qualifiers on duplicate names).
   - **Lazy return**: `isinstance(out, DataFrame)`.
   - **Error**: non-DataFrame `other` → `TypeError`.
   
   Output assertions use exact `pd.testing.assert_frame_equal` after sorting 
where row order isn't unique.
   
   Local: 7 unit + 25 doctests + `ruff check` + `cargo fmt --check` all clean. 
Re-ran the 21 join tests from #908 — no regressions.
   


-- 
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]

Reply via email to