HyukjinKwon opened a new pull request, #226:
URL: https://github.com/apache/spark-connect-rust/pull/226

   ### What changes were proposed in this pull request?
   
   [SPARK-61024](https://issues.apache.org/jira/browse/SPARK-61024): DataFrame 
methods now check their arguments on the client and raise PySpark's errors.
   
   - `select`, `repartition` and the other methods that take columns raise 
`NOT_EXPECTED_TYPE` for a value that is neither a Column nor a string, as 
PySpark's `_to_cols`. `toDF` does so for a value that is not a string.
   - `withColumn` raises `NOT_EXPECTED_TYPE` for a value that is not a Column, 
and `withColumns` and `withColumnsRenamed` for one that is not a dict. 
`withColumns` asserts that it is given one dict of Columns. 
`withColumnsRenamed` sends the renames in the order of the dict.
   - `hint` raises `NOT_EXPECTED_TYPE` for a name that is not a string, and 
`INVALID_ITEM_FOR_CONTAINER` for a parameter that is not a string, a float, an 
int, a Column or a list of them. It sends each parameter as `lit` of it, a 
literal of its type.
   - `dropDuplicates`, `drop_duplicates` and `dropDuplicatesWithinWatermark` 
raise `NOT_EXPECTED_TYPE` for a subset that is not a list or tuple of strings.
   - `repartition`, `repartitionByRange`, `repartitionById` and `coalesce` 
raise `VALUE_NOT_POSITIVE` for a number of partitions that is not positive, and 
`NOT_EXPECTED_TYPE` for one of another type. `repartitionByRange` raises 
`CANNOT_BE_EMPTY` without columns, and sorts by each column ascending unless it 
is already a sort order.
   
   In the Rust API, `DataFrame::hint_expressions` takes the parameters of a 
hint as expressions.
   
   ### Why are the changes needed?
   
   These methods raised `TypeError`s, such as `argument 'col2': 'int' object is 
not an instance of 'str'`, whose `getCondition()` is not `NOT_EXPECTED_TYPE`. 
They also:
   
   - sent the parameters of `hint` as strings, and accepted parameters of other 
types;
   - sent numbers of partitions that were not positive to the server, which 
failed;
   - repartitioned by range by no columns.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. These methods raise the errors of PySpark 4.3.0 for arguments of other 
types.
   
   ### How was this patch tested?
   
   - A new offline test checks the errors of 24 calls. It passes with official 
PySpark 4.3.0, and fails without this change.
   - Probes of these calls match official PySpark 4.3.0.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Opus 5.5
   
   This pull request and its description were written by Isaac.
   


-- 
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]

Reply via email to