Skip to content

Deprecate custom UDF time_bucket in favor of date_bin #558

@jiacai2050

Description

@jiacai2050

Describe This Problem

In early version of CeresDB, there is a custom UDF time_bucket to align time of values, but now datafusion support it out of box, so I suggest deprecate our time_bucket, and use data_bin instead. Ex:

SELECT
      DATE_BIN(INTERVAL '15' minute, time, TIMESTAMP '2001-01-01T00:00:00Z') AS time,
      val
    FROM (
      VALUES
        (TIMESTAMP '2021-06-10 17:05:00Z', 0.5),
        (TIMESTAMP '2021-06-10 17:19:10Z', 0.3)
      ) as t (time, val)


        "+---------------------+-----+",
        "| time                | val |",
        "+---------------------+-----+",
        "| 2021-06-10 17:00:00 | 0.5 |",
        "| 2021-06-10 17:15:00 | 0.3 |",
        "+---------------------+-----+",

Proposal

  1. Completely remove it before 1.0 is out.
  2. If cannot remove it, add a deprecation warning.

Additional Context

apache/datafusion#3015

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions