[Data] Compute Expressions-datetime#58740
[Data] Compute Expressions-datetime#58740alexeykudinkin merged 11 commits intoray-project:masterfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces datetime expression operations under the .dt namespace, which is a great addition. The implementation in dt_namespace.py is mostly clean and follows existing patterns.
However, there is a critical omission: the dt property is not defined on the Expr class in python/ray/data/expressions.py. Without this, expressions like col('my_date').dt.year() will fail. This property needs to be added, similar to how .list, .str, and .struct are implemented. You can add the following property to the Expr class:
@property
def dt(self) -> "_DatetimeNamespace":
"""Access datetime operations for this expression."""
from ray.data.namespace_expressions.dt_namespace import _DatetimeNamespace
return _DatetimeNamespace(self)I've also left a couple of comments in dt_namespace.py regarding potential improvements:
- A high-severity issue with how the return data type is determined for
ceil,floor, androundfunctions, which could lead to incorrect type inference. - A medium-severity suggestion to refactor duplicated code for better maintainability.
Signed-off-by: 400Ping <fourhundredping@gmail.com>
Signed-off-by: 400Ping <fourhundredping@gmail.com>
Signed-off-by: 400Ping <fourhundredping@gmail.com>
Signed-off-by: 400Ping <fourhundredping@gmail.com>
86ce74f to
5a04f43
Compare
Signed-off-by: 400Ping <fourhundredping@gmail.com>
Signed-off-by: 400Ping <fourhundredping@gmail.com>
Signed-off-by: 400Ping <fourhundredping@gmail.com>
|
/gemini summary |
Summary of ChangesThis pull request significantly enhances Ray Data's expression capabilities by adding a dedicated datetime namespace. It allows users to perform a wide range of temporal manipulations directly on columns, such as extracting date parts, formatting, and rounding timestamps. This improves the expressiveness and convenience for data processing workflows involving datetime data. Highlights
Changelog
Activity
|
## Description Completing the datetime namespace operations ## Related issues Related to ray-project#58674 ## Additional information --------- Signed-off-by: 400Ping <fourhundredping@gmail.com> Signed-off-by: YK <1811651+ykdojo@users.noreply.github.com>
## Description Completing the datetime namespace operations ## Related issues Related to ray-project#58674 ## Additional information --------- Signed-off-by: 400Ping <fourhundredping@gmail.com>
## Description Completing the datetime namespace operations ## Related issues Related to ray-project#58674 ## Additional information --------- Signed-off-by: 400Ping <fourhundredping@gmail.com> Signed-off-by: peterxcli <peterxcli@gmail.com>
Description
Completing the datetime namespace operations
Related issues
Related to #58674
Additional information