HyukjinKwon opened a new pull request, #43968:
URL: https://github.com/apache/spark/pull/43968
### What changes were proposed in this pull request?
This PR improves error messages related to argument types in `cute`,
`rollup`, `groupBy`, and `pivot`.
```bash
./bin/pyspark --remote local
```
```python
>>> help(spark.range(1).cube)
Help on method cube in module pyspark.sql.connect.dataframe:
cube(*cols: 'ColumnOrName') -> 'GroupedData' method of
pyspark.sql.connect.dataframe.DataFrame instance
Create a multi-dimensional cube for the current :class:`DataFrame` using
the specified columns, allowing aggregations to be performed on them.
...
```
**Before:**
```python
>>> spark.range(1).cube(1.2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/.../python/pyspark/sql/connect/dataframe.py", line 544, in cube
raise PySparkTypeError(
pyspark.errors.exceptions.base.PySparkTypeError: [NOT_COLUMN_OR_STR]
Argument `cube` should be a Column or str, got float.
```
**After:**
```
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/.../python/pyspark/sql/connect/dataframe.py", line 544, in cube
raise PySparkTypeError(
pyspark.errors.exceptions.base.PySparkTypeError: [NOT_COLUMN_OR_STR]
Argument `cols` should be a Column or str, got float.
```
### Why are the changes needed?
For better error messages to end users.
### Does this PR introduce _any_ user-facing change?
Yes, it fixes the user-facing error message.
### How was this patch tested?
Manually tested.
### Was this patch authored or co-authored using generative AI tooling?
No.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]