#5734·prql

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

Author: sunyeongchoiCreated Mar 25, 2026Updated Mar 26, 2026

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.