> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firebolt.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Window functions

> Spark window functions supported in SparkSQL and Databricks compatibility modes.

Preview

Spark [window functions](https://spark.apache.org/docs/latest/sql-ref-functions-builtin.html#window-functions) in [SparkSQL and Databricks compatibility modes](https://docs.firebolt.io/reference-sql/spark/overview.md). Both modes share these functions. Support is one of: Supported, With limitations, or Not supported. Supported means every example in the Spark reference returns what Spark returns; a note under With limitations quotes a call that differs.

| Function | Support | Notes |
| :- | :- | :- |
| [`CUME_DIST`](https://spark.apache.org/docs/4.1.0/api/sql/#cume_dist) | Supported | |
| [`LAG`](https://spark.apache.org/docs/4.1.0/api/sql/#lag) | Supported | |
| [`LEAD`](https://spark.apache.org/docs/4.1.0/api/sql/#lead) | Supported | |
| [`NTH_VALUE`](https://spark.apache.org/docs/4.1.0/api/sql/#nth_value) | Supported | |
| [`NTILE`](https://spark.apache.org/docs/4.1.0/api/sql/#ntile) | Supported | |
| [`PERCENT_RANK`](https://spark.apache.org/docs/4.1.0/api/sql/#percent_rank) | Supported | |
| [`DENSE_RANK`](https://spark.apache.org/docs/4.1.0/api/sql/#dense_rank) | With limitations | Returns `BIGINT`, where Spark returns `INTEGER`. |
| [`RANK`](https://spark.apache.org/docs/4.1.0/api/sql/#rank) | With limitations | Returns `BIGINT`, where Spark returns `INTEGER`. |
| [`ROW_NUMBER`](https://spark.apache.org/docs/4.1.0/api/sql/#row_number) | With limitations | Returns `BIGINT`, where Spark returns `INTEGER`. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.