@uwdata/mosaic-sql
Version:
SQL query construction and analysis.
74 lines • 3.64 kB
TypeScript
import type { ExprValue, NumberValue } from '../types.js';
/**
* Create a window function that returns the number of the current row
* within the partition, counting from 1.
*/
export declare function row_number(): import("../index.js").WindowNode;
/**
* Create a window function that returns the rank of the current row with gaps.
* This is the same as the row_number of its first peer.
*/
export declare function rank(): import("../index.js").WindowNode;
/**
* Create a window function that returns the rank of the current row without
* gaps. The function counts peer groups.
*/
export declare function dense_rank(): import("../index.js").WindowNode;
/**
* Create a window function that returns the relative rank of the current row.
* Computed as (rank() - 1) / (total partition rows - 1).
*/
export declare function percent_rank(): import("../index.js").WindowNode;
/**
* Create a window function that returns the cumulative distribution. Computed
* as (number of preceding or peer partition rows) / total partition rows.
*/
export declare function cume_dist(): import("../index.js").WindowNode;
/**
* Create a window function that returns an integer ranging from 1 to the
* argument value, dividing the partition as equally as possible.
* @param num_buckets The number of quantile buckets.
*/
export declare function ntile(num_buckets: NumberValue): import("../index.js").WindowNode;
/**
* Create a window function that returns the expression evaluated at the row
* that is offset rows before the current row within the partition.
* If there is no such row, instead return default (which must be of the same
* type as the expression). Both offset and default are evaluated with respect
* to the current row. If omitted, offset defaults to 1 and default to null.
* @param expr The expression to evaluate.
* @param offset The row offset (default `1`).
* @param defaultValue The default value (default `null`).
*/
export declare function lag(expr: ExprValue, offset?: NumberValue, defaultValue?: unknown): import("../index.js").WindowNode;
/**
* Create a window function that returns the expression evaluated at the row
* that is offset rows after the current row within the partition.
* If there is no such row, instead return default (which must be of the same
* type as the expression). Both offset and default are evaluated with respect
* to the current row. If omitted, offset defaults to 1 and default to null.
* @param expr The expression to evaluate.
* @param offset The row offset (default `1`).
* @param defaultValue The default value (default `null`).
*/
export declare function lead(expr: ExprValue, offset?: NumberValue, defaultValue?: unknown): import("../index.js").WindowNode;
/**
* Create a window function that returns the expression evaluated at the row
* that is the first row of the window frame.
* @param expr The expression to evaluate.
*/
export declare function first_value(expr: ExprValue): import("../index.js").WindowNode;
/**
* Create a window function that returns the expression evaluated at the row
* that is the last row of the window frame.
* @param expr The expression to evaluate.
*/
export declare function last_value(expr: ExprValue): import("../index.js").WindowNode;
/**
* Create a window function that returns the expression evaluated at the
* nth row of the window frame (counting from 1), or null if no such row.
* @param expr The expression to evaluate.
* @param nth The 1-based window frame index.
*/
export declare function nth_value(expr: ExprValue, nth: NumberValue): import("../index.js").WindowNode;
//# sourceMappingURL=window.d.ts.map