[Data][expr] Add cast method for type conversion in expressions#60695
Conversation
Signed-off-by: daiping8 <dai.ping88@zte.com.cn>
There was a problem hiding this comment.
Code Review
This pull request introduces a cast method for expressions, enabling type conversions within Ray Data expressions. The implementation is well-structured, leveraging a helper function _normalize_cast_target_type to handle various type representations and creating a UDF for the casting operation. The accompanying tests are comprehensive, covering basic conversions, edge cases like safe casting, and error handling for invalid types.
I have one suggestion to simplify the type normalization logic for improved maintainability. Overall, this is a great addition that enhances the expressiveness of Ray Data.
|
Thanks for the contribution. Left a few comments. |
Signed-off-by: daiping8 <dai.ping88@zte.com.cn>
Thank you for your suggestion. All suggestions have been adopted. |
Signed-off-by: daiping8 <dai.ping88@zte.com.cn>
Signed-off-by: daiping8 <dai.ping88@zte.com.cn>
Signed-off-by: daiping8 <dai.ping88@zte.com.cn>
Signed-off-by: daiping8 <dai.ping88@zte.com.cn>
Signed-off-by: daiping8 <dai.ping88@zte.com.cn>
|
@goutamvenkat-anyscale All suggestions have been applied. CI test has passed. Please review again, thank you. |
…project#60695) ## Description - Implemented a new `cast` method in the `Expr` class to allow casting of expressions to specified data types using PyArrow. - Added comprehensive tests for the `cast` method covering basic conversions, use cases, safe mode, and error handling for invalid types. ## Related issues Closes ray-project#60644 --------- Signed-off-by: daiping8 <dai.ping88@zte.com.cn> Signed-off-by: 金嘉淇10353800 <jin.jiaqi@zte.com.cn> Co-authored-by: 金嘉淇10353800 <jin.jiaqi@zte.com.cn> Signed-off-by: Adel Nour <ans9868@nyu.edu>
…project#60695) ## Description - Implemented a new `cast` method in the `Expr` class to allow casting of expressions to specified data types using PyArrow. - Added comprehensive tests for the `cast` method covering basic conversions, use cases, safe mode, and error handling for invalid types. ## Related issues Closes ray-project#60644 --------- Signed-off-by: daiping8 <dai.ping88@zte.com.cn> Signed-off-by: 金嘉淇10353800 <jin.jiaqi@zte.com.cn> Co-authored-by: 金嘉淇10353800 <jin.jiaqi@zte.com.cn>
Description
castmethod in theExprclass to allow casting of expressions to specified data types using PyArrow.castmethod covering basic conversions, use cases, safe mode, and error handling for invalid types.Related issues
Closes #60644