Hologres is compatible with PostgreSQL and allows you to use the standard PostgreSQL syntax for data development.
Functions
The following table describes the window functions supported by Hologres. The functions
supported by Hologres are only a subset of the PostgreSQL functions. For more information
about how to use these functions, see Window Functions in PostgreSQL documentation.
Function  Description  Example  Result 

row_number()  Returns the ordinal number of the current row in a partition. The return value is
of the BIGINT type.
Note The ordinal number counts from 1.

row_number() over (order by c1) 

rank()  Returns the rank of the current row in a partition. The return value is of the BIGINT
type.
Note This function adds the number of tied rows to the tied rank to calculate the next
rank. Therefore, the ranks may not be consecutive numbers.

rank() over (order by c1) 

dense_rank()  Returns the rank of the current row in a partition. The return value is of the BIGINT
type.
Note This function assigns consecutive ranks.

dense_rank() over (order by c1) 

percent_rank()  Returns the rank of the current row in a partition in the percentage format. The percentageformat
rank is calculated by using the following formula: (Rank of the current row  1)/(Total number of rows in the partition  1) . The return value is of the DOUBLE PRECISION type.

percent_rank() over (order by c1) 

lag(value anyelement [, offset integer [, default anyelement]])  Returns the value of a field in the row that is the given offset number of rows before
the current row in a partition. The return value is of the same type as the specified
field.
Note The default value is returned if the current row does not have a preceding row that
is the given offset number of rows before the current row. By default, the offset
parameter is set to 1, and the default parameter is not specified.

c1, lag(c1) over (order by c1) 

lead(value anyelement [, offset integer [, default anyelement]])  Returns the value of a field in the row that is the given offset number of rows after
the current row in a partition. The return value is of the same type as the specified
field.
Note The default value is returned if the current row does not have a following row that
is the given offset number of rows after the current row. By default, the offset parameter
is set to 1, and the default parameter is not specified.

c1, lead(c1) over (order by c1) 

first_value(value anyelement)  Returns the value of a field with respect to the first row in the window frame. The return value is of the same type as the specified field.  c1, first_value(c1) over (order by c1) 

last_value(value anyelement)  Returns the value of a field with respect to the last row in the window frame. The return value is of the same type as the specified field.  c1, last_value(c1) over (order by c1) 

Characteristics of window functions
When you call a window function, you must use an OVER clause after the window function
and the function parameter that you set. An OVER clause is used to specify the rows
in which field values are to be processed by the window function.
 If you use the
PARTITION BY
keyword in the OVER clause, rows that have the same partition key value belong to the same partition. The window function performs calculations on each row based on the partition to which the row belongs.  If you use the
ORDER BY
keyword in the OVER clause, the window function performs calculations in the sequence that is defined by the ORDER BY keyword.
Whether the ORDER BY keyword is used determines the calculation results of window
functions. The following table provides two examples. In the examples, the SUM function
is used.
When the ORDER BY keyword is used, the SUM function processes field values from the
first row to the current row, including rows that have the same partition key value
as the current row. If the ORDER BY keyword is not used, the SUM function processes
field values of all rows in the table.
Example  Result 

id, c1, sum(id) over (order by id) 

id, c1, sum(id) over () 
