Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ message MapPartitions {
// (Required) Input user-defined function.
CommonInlineUserDefinedFunction func = 2;

// (Optional) isBarrier.
// (Optional) Whether to use barrier mode execution or not.
optional bool is_barrier = 3;
}

Expand Down
14 changes: 6 additions & 8 deletions python/pyspark/sql/connect/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -1645,7 +1645,7 @@ def _map_partitions(
func: "PandasMapIterFunction",
schema: Union[StructType, str],
evalType: int,
is_barrier: bool,
barrier: bool,
) -> "DataFrame":
from pyspark.sql.connect.udf import UserDefinedFunction

Expand All @@ -1660,7 +1660,7 @@ def _map_partitions(

return DataFrame.withPlan(
plan.MapPartitions(
child=self._plan, function=udf_obj, cols=self.columns, is_barrier=is_barrier
child=self._plan, function=udf_obj, cols=self.columns, is_barrier=barrier
),
session=self._session,
)
Expand All @@ -1669,21 +1669,19 @@ def mapInPandas(
self,
func: "PandasMapIterFunction",
schema: Union[StructType, str],
is_barrier: bool = False,
barrier: bool = False,
) -> "DataFrame":
return self._map_partitions(
func, schema, PythonEvalType.SQL_MAP_PANDAS_ITER_UDF, is_barrier
)
return self._map_partitions(func, schema, PythonEvalType.SQL_MAP_PANDAS_ITER_UDF, barrier)

mapInPandas.__doc__ = PySparkDataFrame.mapInPandas.__doc__

def mapInArrow(
self,
func: "ArrowMapIterFunction",
schema: Union[StructType, str],
is_barrier: bool = False,
barrier: bool = False,
) -> "DataFrame":
return self._map_partitions(func, schema, PythonEvalType.SQL_MAP_ARROW_ITER_UDF, is_barrier)
return self._map_partitions(func, schema, PythonEvalType.SQL_MAP_ARROW_ITER_UDF, barrier)

mapInArrow.__doc__ = PySparkDataFrame.mapInArrow.__doc__

Expand Down
2 changes: 1 addition & 1 deletion python/pyspark/sql/connect/proto/relations_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2767,7 +2767,7 @@ class MapPartitions(google.protobuf.message.Message):
def func(self) -> pyspark.sql.connect.proto.expressions_pb2.CommonInlineUserDefinedFunction:
"""(Required) Input user-defined function."""
is_barrier: builtins.bool
"""(Optional) isBarrier."""
"""(Optional) Whether to use barrier mode execution or not."""
def __init__(
self,
*,
Expand Down