import type { FunctionDefinition } from '../../definition_types'; /** * Creates groups of values - buckets - out of a datetime or numeric input. * The size of the buckets can either be provided directly, or chosen based on a recommended count and values range. * * @example * FROM employees * | WHERE hire_date >= "1985-01-01T00:00:00Z" AND hire_date < "1986-01-01T00:00:00Z" * | STATS hire_date = MV_SORT(VALUES(hire_date)) BY month = BUCKET(hire_date, 20, "1985-01-01T00:00:00Z", "1986-01-01T00:00:00Z") * * @example * FROM employees * | WHERE hire_date >= "1985-01-01T00:00:00Z" AND hire_date < "1986-01-01T00:00:00Z" * | STATS hires_per_month = COUNT(*) BY month = BUCKET(hire_date, 20, "1985-01-01T00:00:00Z", "1986-01-01T00:00:00Z") * | SORT month * * @example * FROM employees * | WHERE hire_date >= "1985-01-01T00:00:00Z" AND hire_date < "1986-01-01T00:00:00Z" * | STATS hires_per_week = COUNT(*) BY week = BUCKET(hire_date, 100, "1985-01-01T00:00:00Z", "1986-01-01T00:00:00Z") * * @example * FROM employees * | WHERE hire_date >= "1985-01-01T00:00:00Z" AND hire_date < "1986-01-01T00:00:00Z" * | STATS hires_per_week = COUNT(*) BY week = BUCKET(hire_date, 1 week) * | SORT week * * @example * FROM employees * | STATS COUNT(*) by bs = BUCKET(salary, 20, 25324, 74999) * | SORT bs * * @example * FROM employees * | WHERE hire_date >= "1985-01-01T00:00:00Z" AND hire_date < "1986-01-01T00:00:00Z" * | STATS c = COUNT(1) BY b = BUCKET(salary, 5000.) * | SORT b * * @example * FROM sample_data * | WHERE @timestamp >= NOW() - 1 day and @timestamp < NOW() * | STATS COUNT(*) BY bucket = BUCKET(@timestamp, 25, NOW() - 1 day, NOW()) * * @example * FROM employees * | WHERE hire_date >= "1985-01-01T00:00:00Z" AND hire_date < "1986-01-01T00:00:00Z" * | STATS AVG(salary) BY bucket = BUCKET(hire_date, 20, "1985-01-01T00:00:00Z", "1986-01-01T00:00:00Z") * * @example * FROM employees * | STATS s1 = b1 + 1, s2 = BUCKET(salary / 1000 + 999, 50.) + 2 BY b1 = BUCKET(salary / 100 + 99, 50.), b2 = BUCKET(salary / 1000 + 999, 50.) * | SORT b1, b2 * | KEEP s1, b1, s2, b2 * * @example * FROM employees * | STATS dates = MV_SORT(VALUES(birth_date)) BY b = BUCKET(birth_date + 1 HOUR, 1 YEAR) - 1 HOUR * | EVAL d_count = MV_COUNT(dates) */ declare const definition: FunctionDefinition; export default definition; //# sourceMappingURL=bucket.d.ts.map