HyukjinKwon opened a new pull request #25989: [SPARK-29317][SQL][PYTHON] Avoid 
inheritance hierarchy in pandas CoGroup arrow runner and its plan
URL: https://github.com/apache/spark/pull/25989
 
 
   ### What changes were proposed in this pull request?
   
   This PR proposes to avoid abstract classes introduced at 
https://github.com/apache/spark/pull/24965 but instead uses trait and object.
   
   - `abstract class BaseArrowPythonRunner` -> `trait PythonArrowOutput` to 
allow mix-in
   
       **Before:**
   
       ```
       BasePythonRunner
       ├── BaseArrowPythonRunner
       │   ├── ArrowPythonRunner
       │   └── CoGroupedArrowPythonRunner
       ├── PythonRunner
       └── PythonUDFRunner
       ```
   
       **After:**
   
       ```
       └── BasePythonRunner
           ├── ArrowPythonRunner
           ├── CoGroupedArrowPythonRunner
           ├── PythonRunner
           └── PythonUDFRunner
       ```
   - `abstract class BasePandasGroupExec ` -> `object PandasGroupUtils` to 
decouple
   
       **Before:**
   
       ```
       └── BasePandasGroupExec
           ├── FlatMapGroupsInPandasExec
           └── FlatMapCoGroupsInPandasExec
       ```
   
       **After:**
   
       ```
       ├── FlatMapGroupsInPandasExec
       └── FlatMapCoGroupsInPandasExec
       ```
   
   
   
   ### Why are the changes needed?
   
   The problem is that R code path is being matched with Python side:
   
   **Python:**
   
   ```
   └── BasePythonRunner
       ├── ArrowPythonRunner
       ├── CoGroupedArrowPythonRunner
       ├── PythonRunner
       └── PythonUDFRunner
   ```
   
   **R:**
   
   ```
   └── BaseRRunner
       ├── ArrowRRunner
       └── RRunner
   ```
   
   I would like to match the hierarchy and decouple other stuff for now if 
possible. Ideally we should deduplicate both code paths. Internal 
implementation is also similar intentionally.
   
   `BasePandasGroupExec` case is similar as well. R (with Arrow optimization, 
in particular) has some duplicated codes with Pandas UDFs. 
   
   `FlatMapGroupsInRWithArrowExec` <> `FlatMapGroupsInPandasExec`
   `MapPartitionsInRWithArrowExec` <> `ArrowEvalPythonExec`
   
   In order to prepare deduplication here as well, it might better avoid 
changing hierarchy alone in Python side.
   
   ### Does this PR introduce any user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Locally tested existing tests. Jenkins tests should verify this too.
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to