v.23.2New Feature

Support for NTILE Window Function

Support window function ntile. (lgbo).
Added support for the window function ntile in ClickHouse.

Why it matters

The ntile window function allows users to divide ordered data into a specified number of buckets or tiles, enabling better data segmentation and ranking within partitions. This helps in analytical queries that require percentile or quantile-based grouping.

How to use it

Use the ntile function as a window function in your SELECT statements with an OVER clause to specify the partitioning and ordering. For example:

SELECT column1, ntile(4) OVER (PARTITION BY column2 ORDER BY column3) AS tile_group
FROM table_name

This will divide the rows within each partition defined by column2 into 4 buckets based on the ordering of column3.