You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/05/31 23:19:56 UTC
[GitHub] [spark] ueshin commented on a diff in pull request #36353: [SPARK-38946][PYTHON][PS] Generates a new dataframe instead of operating inplace in df.eval/update/fillna/setitem
ueshin commented on code in PR #36353:
URL: https://github.com/apache/spark/pull/36353#discussion_r886192259
##########
python/pyspark/pandas/frame.py:
##########
@@ -8412,7 +8430,11 @@ def update(self, other: "DataFrame", join: str = "left", overwrite: bool = True)
*HIDDEN_COLUMNS,
)
internal = self._internal.with_new_sdf(sdf, data_fields=data_fields)
- self._update_internal_frame(internal, requires_same_anchor=False)
+ # Since Spark 3.4, df.update generates a new dataframe instead of operating
+ # in-place to follow pandas v1.4 behavior, see also SPARK-38946.
+ self._update_internal_frame(
+ internal, requires_same_anchor=False, anchor_force_disconnect=True
Review Comment:
We don't need to specify `requires_same_anchor` any more if `anchor_force_disconnect=True`?
##########
python/pyspark/pandas/frame.py:
##########
@@ -11944,7 +11966,11 @@ def eval_func(pdf): # type: ignore[no-untyped-def]
if inplace:
# Here, the result is always a frame because the error is thrown during schema inference
# from pandas.
- self._update_internal_frame(result._internal, requires_same_anchor=False)
+ # Since Spark 3.4, eval with inplace generates a new dataframe instead of operating
+ # in-place to follow pandas v1.4 behavior, see also SPARK-38946.
+ self._update_internal_frame(
+ result._internal, requires_same_anchor=False, anchor_force_disconnect=True
Review Comment:
ditto.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org