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
1 change: 1 addition & 0 deletions python/pyspark/sql/connect/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ def __init__(
def plan(self, session: "SparkConnectClient") -> proto.Relation:
assert self._child is not None
plan = proto.Relation()
plan.deduplicate.input.CopyFrom(self._child.plan(session))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a case that probably we have a test in test_connect_basic to avoid, maybe BTW add a test case there?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing tests are exhaustive they just missed that the input was never copied.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't block this PR by my comment.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me just merge this for now and go forward.

plan.deduplicate.all_columns_as_keys = self.all_columns_as_keys
if self.column_names is not None:
plan.deduplicate.column_names.extend(self.column_names)
Expand Down
2 changes: 2 additions & 0 deletions python/pyspark/sql/tests/connect/test_connect_plan_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ def test_deduplicate(self):
df = self.connect.readTable(table_name=self.tbl_name)

distinct_plan = df.distinct()._plan.to_proto(self.connect)
self.assertTrue(distinct_plan.root.deduplicate.HasField("input"), "input must be set")

self.assertEqual(distinct_plan.root.deduplicate.all_columns_as_keys, True)
self.assertEqual(len(distinct_plan.root.deduplicate.column_names), 0)

Expand Down