Skip to content

Commit

Permalink
[SPARK-47183][PYTHON] Fix the error class for sameSemantics
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?
Fix the error class for `sameSemantics`

### Why are the changes needed?
the expected type should be `DataFrame`

### Does this PR introduce _any_ user-facing change?
yes

### How was this patch tested?
updated test

### Was this patch authored or co-authored using generative AI tooling?
no

Closes apache#45280 from zhengruifeng/py_fix_error_sameSemantics.

Authored-by: Ruifeng Zheng <ruifengz@apache.org>
Signed-off-by: Ruifeng Zheng <ruifengz@apache.org>
  • Loading branch information
zhengruifeng committed Feb 27, 2024
1 parent a778e6c commit cdae4c6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion python/pyspark/sql/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -6711,7 +6711,7 @@ def sameSemantics(self, other: "DataFrame") -> bool:
"""
if not isinstance(other, DataFrame):
raise PySparkTypeError(
error_class="NOT_STR",
error_class="NOT_DATAFRAME",
message_parameters={"arg_name": "other", "arg_type": type(other).__name__},
)
return self._jdf.sameSemantics(other._jdf)
Expand Down
2 changes: 1 addition & 1 deletion python/pyspark/sql/tests/test_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -1849,7 +1849,7 @@ def test_same_semantics_error(self):

self.check_error(
exception=pe.exception,
error_class="NOT_STR",
error_class="NOT_DATAFRAME",
message_parameters={"arg_name": "other", "arg_type": "int"},
)

Expand Down

0 comments on commit cdae4c6

Please sign in to comment.