Repository: modin-project/modin

Issue:
BaseFrameManager.broadcast_apply has argument "other_name" but it is impossible to pass from query_compiler level
### System information
- **OS Platform and Distribution (e.g., Linux Ubuntu 16.04)**:

Ubuntu 20.04.2 LTS

- **Modin version** (`modin.__version__`):

0.9.0+15.g371b1abe.dirty

- **Python version**:

Python 3.8.6

- **Code we can use to reproduce**:

<!--
You can obtain the Modin version with

python -c "import modin; print(modin.__version__)"
-->

### Describe the problem
<!-- Describe the problem clearly here. -->

There is a function `BaseFrameManager.broadcast_apply` https://github.com/modin-project/modin/blob/master/modin/engines/base/frame/partition_manager.py#L251 which has argument `other_name` which means name of second frame argument in the applied function. But when calling this function via `BasePandasFrame.broadcast_apply` it is impossible to specify this name because `BasePandasFrame.broadcast_apply` has no such argument and always calls `BaseFrameManager.broadcast_apply` implicitly without specifying `other_name` parameter https://github.com/modin-project/modin/blob/master/modin/engines/base/frame/data.py#L1509.
Because of this developer is forced to write apply function with implicit 2nd parameter name `r` which isn't very meaningful and isn't documented anywhere.

### Source code / logs
<!-- Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. Try to provide a reproducible test case that is the bare minimum necessary to generate the problem. -->



Discussion:
@gshimansky can you update this issue with the latest code lines? I think things have changed.
I think the bug still applies although class names have changed.
Function `broadcast_apply` still exists and its `other_name` parameter implicit value is still `"r"` https://github.com/modin-project/modin/blob/master/modin/core/dataframe/pandas/partitioning/partition_manager.py#L338
It is still called without `other_name` parameter from `PandasDataframe.broadcast_apply` https://github.com/modin-project/modin/blob/master/modin/core/dataframe/pandas/dataframe/dataframe.py#L2148

Resolving patch:
diff --git a/modin/core/dataframe/pandas/partitioning/partition_manager.py b/modin/core/dataframe/pandas/partitioning/partition_manager.py
--- a/modin/core/dataframe/pandas/partitioning/partition_manager.py
+++ b/modin/core/dataframe/pandas/partitioning/partition_manager.py
@@ -242,7 +242,7 @@ def groupby_reduce(
 
         if by is not None:
             mapped_partitions = cls.broadcast_apply(
-                axis, map_func, left=partitions, right=by, other_name="other"
+                axis, map_func, left=partitions, right=by
             )
         else:
             mapped_partitions = cls.map_partitions(partitions, map_func)
@@ -332,7 +332,7 @@ def get_partitions(index):
 
     @classmethod
     @wait_computations_if_benchmark_mode
-    def broadcast_apply(cls, axis, apply_func, left, right, other_name="right"):
+    def broadcast_apply(cls, axis, apply_func, left, right):
         """
         Broadcast the `right` partitions to `left` and apply `apply_func` function.
 
@@ -346,9 +346,6 @@ def broadcast_apply(cls, axis, apply_func, left, right, other_name="right"):
             NumPy array of left partitions.
         right : np.ndarray
             NumPy array of right partitions.
-        other_name : str, default: "right"
-            Name of key-value argument for `apply_func` that
-            is used to pass `right` to `apply_func`.
 
         Returns
         -------
@@ -365,7 +362,7 @@ def map_func(df, *others):
             other = (
                 pandas.concat(others, axis=axis ^ 1) if len(others) > 1 else others[0]
             )
-            return apply_func(df, **{other_name: other})
+            return apply_func(df, other)
 
         map_func = cls.preprocess_func(map_func)
         rt_axis_parts = cls.axis_partition(right, axis ^ 1)


Test patch: