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
13 changes: 4 additions & 9 deletions python/pyspark/errors/error-conditions.json
Original file line number Diff line number Diff line change
Expand Up @@ -808,26 +808,21 @@
"Number of columns of the returned data doesn't match specified schema. Expected: <expected> Actual: <actual>"
]
},
"RESULT_ROWS_MISMATCH": {
"RESULT_COLUMN_TYPES_MISMATCH": {
"message": [
"The number of output rows (<output_length>) must match the number of input rows (<input_length>)."
"Column types of the returned data do not match specified schema. Mismatch: <mismatch>."
]
},
"RESULT_TYPE_MISMATCH_FOR_ARROW_UDF": {
"RESULT_ROWS_MISMATCH": {
"message": [
"Columns do not match in their data type: <mismatch>."
"The number of output rows (<output_length>) must match the number of input rows (<input_length>)."
]
},
"REUSE_OBSERVATION": {
"message": [
"An Observation can be used with a DataFrame only once."
]
},
"SCHEMA_MISMATCH_FOR_ARROW_PYTHON_UDF": {
"message": [
"Result vector from <udf_type> was not the required length: expected <expected>, got <actual>."
]
},
"SCHEMA_MISMATCH_FOR_PANDAS_UDF": {
"message": [
"Result vector from <udf_type> was not the required length: expected <expected>, got <actual>."
Expand Down
6 changes: 4 additions & 2 deletions python/pyspark/sql/tests/arrow/test_arrow_cogrouped_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ def test_apply_in_arrow_returning_wrong_types(self):
with self.quiet():
with self.assertRaisesRegex(
PythonException,
f"Columns do not match in their data type: {expected}",
"Column types of the returned data do not match specified schema. "
f"Mismatch: {expected}",
):
self.cogrouped.applyInArrow(
lambda left, right: left, schema=schema
Expand All @@ -171,7 +172,8 @@ def test_apply_in_arrow_returning_wrong_types_positional_assignment(self):
with self.quiet():
with self.assertRaisesRegex(
PythonException,
f"Columns do not match in their data type: {expected}",
"Column types of the returned data do not match specified schema. "
f"Mismatch: {expected}",
):
self.cogrouped.applyInArrow(
lambda left, right: left, schema=schema
Expand Down
6 changes: 4 additions & 2 deletions python/pyspark/sql/tests/arrow/test_arrow_grouped_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ def test_apply_in_arrow_returning_wrong_types(self):
for func_variation in function_variations(lambda table: table):
with self.assertRaisesRegex(
PythonException,
f"Columns do not match in their data type: {expected}",
"Column types of the returned data do not match specified schema. "
f"Mismatch: {expected}",
):
df.groupby("id").applyInArrow(func_variation, schema=schema).collect()

Expand All @@ -196,7 +197,8 @@ def test_apply_in_arrow_returning_wrong_types_positional_assignment(self):
for func_variation in function_variations(lambda table: table):
with self.assertRaisesRegex(
PythonException,
f"Columns do not match in their data type: {expected}",
"Column types of the returned data do not match specified schema. "
f"Mismatch: {expected}",
):
df.groupby("id").applyInArrow(
func_variation, schema=schema
Expand Down
2 changes: 1 addition & 1 deletion python/pyspark/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ def verify_arrow_result(result, assign_cols_by_name, expected_cols_and_types):

if type_mismatch:
raise PySparkRuntimeError(
errorClass="RESULT_TYPE_MISMATCH_FOR_ARROW_UDF",
errorClass="RESULT_COLUMN_TYPES_MISMATCH",
messageParameters={
"mismatch": ", ".join(
"column '{}' (expected {}, actual {})".format(name, expected, actual)
Expand Down