Skip to content

Commit

Permalink
[SPARK-45538][PYTHON][CONNECT] pyspark connect overwrite_partitions bug
Browse files Browse the repository at this point in the history
Fix a bug in pyspark connect.

DataFrameWriterV2.overwritePartitions set mode as overwrite_partitions [pyspark/sql/connect/readwriter.py, line 825], but WirteOperationV2 take it as overwrite_partition [pyspark/sql/connect/plan.py, line 1660]

make dataframe.writeTo(table).overwritePartitions() work

No

No test. This bug is very obvious.

No

Closes #43367 from xieshuaihu/python_connect_overwrite.

Authored-by: xieshuaihu <[email protected]>
Signed-off-by: Hyukjin Kwon <[email protected]>
(cherry picked from commit 9bdad31)
Signed-off-by: Hyukjin Kwon <[email protected]>
  • Loading branch information
xieshuaihu authored and HyukjinKwon committed Oct 16, 2023
1 parent 146fba1 commit daa3281
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python/pyspark/sql/connect/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -1655,7 +1655,7 @@ def command(self, session: "SparkConnectClient") -> proto.Command:
plan.write_operation_v2.mode = proto.WriteOperationV2.Mode.MODE_CREATE
elif wm == "overwrite":
plan.write_operation_v2.mode = proto.WriteOperationV2.Mode.MODE_OVERWRITE
elif wm == "overwrite_partition":
elif wm == "overwrite_partitions":
plan.write_operation_v2.mode = proto.WriteOperationV2.Mode.MODE_OVERWRITE_PARTITIONS
elif wm == "append":
plan.write_operation_v2.mode = proto.WriteOperationV2.Mode.MODE_APPEND
Expand Down

0 comments on commit daa3281

Please sign in to comment.