Skip to content

Commit f246224

Browse files
committed
docs: enhance _prepare_deduplicate docstring with detailed parameter and return information
1 parent 7d7146c commit f246224

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

python/datafusion/dataframe.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -781,16 +781,31 @@ def _resolve_join_keys(
781781
def _prepare_deduplicate(
782782
self, right: DataFrame, on: str | Sequence[str]
783783
) -> tuple[DataFrame, list[str], list[str], list[str]]:
784-
"""Rename join columns to drop them after joining."""
784+
"""Rename join columns to drop them after joining.
785+
786+
Args:
787+
right: The right DataFrame to modify.
788+
on: The join column name(s).
789+
790+
Returns:
791+
A tuple containing:
792+
- modified_right: DataFrame with renamed join columns
793+
- drop_cols: List of column names to drop after joining
794+
- left_cols: List of original left DataFrame column names
795+
- right_aliases: List of renamed right DataFrame column names
796+
"""
785797
drop_cols: list[str] = []
786798
right_aliases: list[str] = []
787799
on_cols = [on] if isinstance(on, str) else list(on)
800+
801+
modified_right = right
788802
for col_name in on_cols:
789803
alias = f"__right_{col_name}"
790-
right = right.with_column_renamed(col_name, alias)
804+
modified_right = modified_right.with_column_renamed(col_name, alias)
791805
right_aliases.append(alias)
792806
drop_cols.append(alias)
793-
return right, drop_cols, on_cols, right_aliases
807+
808+
return modified_right, drop_cols, on_cols, right_aliases
794809

795810
def join_on(
796811
self,

0 commit comments

Comments
 (0)