Skip to content

[Feature Request] Support for arbitrary time-binning in ClickHouse (e.g., toStartOfInterval) #5734

@sunyeongchoi

Description

@sunyeongchoi

I'd like to use functions like ClickHouse's toStartOfInterval natively in PRQL without having to rely on s-strings:

from events
derive bin = (timestamp | to_start_of_interval 15min)
group bin (aggregate [count])

However, toStartOfInterval is a function specific to the ClickHouse dialect and is not available in other dialects supported by PRQL. In this case, would it be appropriate for me to implement to_start_of_interval as a PRQL function? What approach would you recommend for handling such dialect-specific functions?

I’m considering three options for this:

  1. Implementing to_start_of_interval for all supported dialects.
  2. Implementing it only for ClickHouse and raising an error for other dialects that don't support it.
  3. Adding it under a specific namespace, such as ch.to_start_of_interval, to mark it as a ClickHouse-specific function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions