Skip to content

[Feature][Working]TIME_ROUND functions like Druid #4619

@ccoffline

Description

@ccoffline

Is your feature request related to a problem? Please describe.
A olap engine always deals with time. There are time_floor and time_ceil in Druid that Doris doesn't have.

Describe the solution you'd like
I am working on it. Due to closely related to timestamp_diff, I am going to fix #4618 if no one is working on it. Plz let me know if you do.

Describe alternatives you've considered
There are two solutions.

  • Accept string param represents ISO 8601 Duration, need to use regex.
  • Keep the same style like timestamp_diff, such as year_floor. This need to generate a lot of functions to support different granularities and params overload.

I'm working on the second one. This solution provides a direct implementation. I have implemented
7(year, month, week, day, hour, minute, second) * 2(floor, ceil) * 4([timestamp], [ts, period], [ts, origin], [ts, period, origin]) = 56 functions.

period specifies the number of the time granularity, such as 3 months.
origin specifies when does the period begins, such as a MONDAY in DATETIME type, or day 09 in any month.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/sql/functionIssues or PRs related to the SQL functionskind/featureCategorizes issue or PR as related to a new feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions