Skip to content

Conversation

@400Ping
Copy link
Contributor

@400Ping 400Ping commented Nov 18, 2025

Description

Completing the datetime namespace operations

Related issues

Related to #58674

Additional information

@400Ping 400Ping requested a review from a team as a code owner November 18, 2025 15:38
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and round functions, which could lead to incorrect type inference.
  • A medium-severity suggestion to refactor duplicated code for better maintainability.

@400Ping 400Ping changed the title [Data]Compute Expressions-datetime [WIP][Data]Compute Expressions-datetime Nov 18, 2025
@ray-gardener ray-gardener bot added data Ray Data-related issues community-contribution Contributed by the community labels Nov 18, 2025
@400Ping 400Ping marked this pull request as draft November 20, 2025 10:27
@400Ping 400Ping force-pushed the data/compute-expressions-dt branch from 86ce74f to 5a04f43 Compare November 21, 2025 18:39
Signed-off-by: 400Ping <[email protected]>
Signed-off-by: 400Ping <[email protected]>
@400Ping 400Ping changed the title [WIP][Data]Compute Expressions-datetime [Data] Compute Expressions-datetime Nov 22, 2025
@400Ping 400Ping marked this pull request as ready for review November 22, 2025 05:57
Signed-off-by: 400Ping <[email protected]>
@goutamvenkat-anyscale goutamvenkat-anyscale added the go add ONLY when ready to merge, run all tests label Nov 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community data Ray Data-related issues go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants