Skip to content

Commit 19d69ca

Browse files
committed
fix: improve error messages for join key validation in DataFrame
1 parent ec769fe commit 19d69ca

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

python/datafusion/dataframe.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -759,16 +759,25 @@ def _resolve_join_keys(
759759

760760
if resolved_on is not None:
761761
if left_on is not None or right_on is not None:
762-
error_msg = "`left_on` or `right_on` should not provided with `on`"
762+
error_msg = (
763+
"`left_on` or `right_on` should not be provided with `on`. "
764+
"Note: `deduplicate` must be specified as a keyword argument."
765+
)
763766
raise ValueError(error_msg)
764767
left_on = resolved_on
765768
right_on = resolved_on
766769
elif left_on is not None or right_on is not None:
767770
if left_on is None or right_on is None:
768-
error_msg = "`left_on` and `right_on` should both be provided."
771+
error_msg = (
772+
"`left_on` and `right_on` should both be provided. "
773+
"Note: `deduplicate` must be specified as a keyword argument."
774+
)
769775
raise ValueError(error_msg)
770776
else:
771-
error_msg = "either `on` or `left_on` and `right_on` should be provided."
777+
error_msg = (
778+
"Either `on` or both `left_on` and `right_on` should be provided. "
779+
"Note: `deduplicate` must be specified as a keyword argument."
780+
)
772781
raise ValueError(error_msg)
773782

774783
# At this point, left_on and right_on are guaranteed to be non-None

0 commit comments

Comments
 (0)