Skip to content

functions_arithmetic.yaml

This document file is generated for functions_arithmetic.yaml

Scalar Functions

add

Implementations:
add(x, y, option:overflow): -> return_type
0. add(i8, i8, option:overflow): -> i8
1. add(i16, i16, option:overflow): -> i16
2. add(i32, i32, option:overflow): -> i32
3. add(i64, i64, option:overflow): -> i64
4. add(fp32, fp32, option:rounding): -> fp32
5. add(fp64, fp64, option:rounding): -> fp64

Add two values.

Options:
  • overflow ['SILENT', 'SATURATE', 'ERROR']
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • subtract

    Implementations:
    subtract(x, y, option:overflow): -> return_type
    0. subtract(i8, i8, option:overflow): -> i8
    1. subtract(i16, i16, option:overflow): -> i16
    2. subtract(i32, i32, option:overflow): -> i32
    3. subtract(i64, i64, option:overflow): -> i64
    4. subtract(fp32, fp32, option:rounding): -> fp32
    5. subtract(fp64, fp64, option:rounding): -> fp64

    Subtract one value from another.

    Options:
  • overflow ['SILENT', 'SATURATE', 'ERROR']
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • multiply

    Implementations:
    multiply(x, y, option:overflow): -> return_type
    0. multiply(i8, i8, option:overflow): -> i8
    1. multiply(i16, i16, option:overflow): -> i16
    2. multiply(i32, i32, option:overflow): -> i32
    3. multiply(i64, i64, option:overflow): -> i64
    4. multiply(fp32, fp32, option:rounding): -> fp32
    5. multiply(fp64, fp64, option:rounding): -> fp64

    Multiply two values.

    Options:
  • overflow ['SILENT', 'SATURATE', 'ERROR']
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • divide

    Implementations:
    divide(x, y, option:overflow): -> return_type
    0. divide(i8, i8, option:overflow): -> i8
    1. divide(i16, i16, option:overflow): -> i16
    2. divide(i32, i32, option:overflow): -> i32
    3. divide(i64, i64, option:overflow): -> i64
    4. divide(fp32, fp32, option:rounding, option:on_domain_error, option:on_division_by_zero): -> fp32
    5. divide(fp64, fp64, option:rounding, option:on_domain_error, option:on_division_by_zero): -> fp64

    *Divide x by y. In the case of integer division, partial values are truncated (i.e. rounded towards 0). The on_division_by_zero option governs behavior in cases where y is 0 and x is not 0. LIMIT means positive or negative infinity (depending on the sign of x and y). If x and y are both 0 or both ±infinity, behavior will be governed by on_domain_error. *

    Options:
  • overflow ['SILENT', 'SATURATE', 'ERROR']
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • on_domain_error ['NAN', 'ERROR']
  • on_division_by_zero ['LIMIT', 'NAN', 'ERROR']
  • negate

    Implementations:
    negate(x, option:overflow): -> return_type
    0. negate(i8, option:overflow): -> i8
    1. negate(i16, option:overflow): -> i16
    2. negate(i32, option:overflow): -> i32
    3. negate(i64, option:overflow): -> i64
    4. negate(fp32): -> fp32
    5. negate(fp64): -> fp64

    Negation of the value

    Options:
  • overflow ['SILENT', 'SATURATE', 'ERROR']
  • modulus

    Implementations:
    modulus(x, y, option:division_type, option:overflow, option:on_domain_error): -> return_type
    0. modulus(i8, i8, option:division_type, option:overflow, option:on_domain_error): -> i8
    1. modulus(i16, i16, option:division_type, option:overflow, option:on_domain_error): -> i16
    2. modulus(i32, i32, option:division_type, option:overflow, option:on_domain_error): -> i32
    3. modulus(i64, i64, option:division_type, option:overflow, option:on_domain_error): -> i64

    *Calculate the remainder ® when dividing dividend (x) by divisor (y). In mathematics, many conventions for the modulus (mod) operation exists. The result of a mod operation depends on the software implementation and underlying hardware. Substrait is a format for describing compute operations on structured data and designed for interoperability. Therefore the user is responsible for determining a definition of division as defined by the quotient (q). The following basic conditions of division are satisfied: (1) q ∈ ℤ (the quotient is an integer) (2) x = y * q + r (division rule) (3) abs® < abs(y) where q is the quotient. The division_type option determines the mathematical definition of quotient to use in the above definition of division. When division_type=TRUNCATE, q = trunc(x/y). When division_type=FLOOR, q = floor(x/y). In the cases of TRUNCATE and FLOOR division: remainder r = x - round_func(x/y) The on_domain_error option governs behavior in cases where y is 0, y is ±inf, or x is ±inf. In these cases the mod is undefined. The overflow option governs behavior when integer overflow occurs. If x and y are both 0 or both ±infinity, behavior will be governed by on_domain_error. *

    Options:
  • division_type ['TRUNCATE', 'FLOOR']
  • overflow ['SILENT', 'SATURATE', 'ERROR']
  • on_domain_error ['NULL', 'ERROR']
  • power

    Implementations:
    power(x, y, option:overflow): -> return_type
    0. power(i64, i64, option:overflow): -> i64
    1. power(fp32, fp32): -> fp32
    2. power(fp64, fp64): -> fp64

    Take the power with x as the base and y as exponent.

    Options:
  • overflow ['SILENT', 'SATURATE', 'ERROR']
  • sqrt

    Implementations:
    sqrt(x, option:rounding, option:on_domain_error): -> return_type
    0. sqrt(i64, option:rounding, option:on_domain_error): -> fp64
    1. sqrt(fp32, option:rounding, option:on_domain_error): -> fp32
    2. sqrt(fp64, option:rounding, option:on_domain_error): -> fp64

    Square root of the value

    Options:
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • on_domain_error ['NAN', 'ERROR']
  • exp

    Implementations:
    exp(x, option:rounding): -> return_type
    0. exp(fp32, option:rounding): -> fp32
    1. exp(fp64, option:rounding): -> fp64

    The mathematical constant e, raised to the power of the value.

    Options:
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • cos

    Implementations:
    cos(x, option:rounding): -> return_type
    0. cos(fp32, option:rounding): -> fp64
    1. cos(fp64, option:rounding): -> fp64

    Get the cosine of a value in radians.

    Options:
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • sin

    Implementations:
    sin(x, option:rounding): -> return_type
    0. sin(fp32, option:rounding): -> fp64
    1. sin(fp64, option:rounding): -> fp64

    Get the sine of a value in radians.

    Options:
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • tan

    Implementations:
    tan(x, option:rounding): -> return_type
    0. tan(fp32, option:rounding): -> fp64
    1. tan(fp64, option:rounding): -> fp64

    Get the tangent of a value in radians.

    Options:
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • cosh

    Implementations:
    cosh(x, option:rounding): -> return_type
    0. cosh(fp32, option:rounding): -> fp32
    1. cosh(fp64, option:rounding): -> fp64

    Get the hyperbolic cosine of a value in radians.

    Options:
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • sinh

    Implementations:
    sinh(x, option:rounding): -> return_type
    0. sinh(fp32, option:rounding): -> fp32
    1. sinh(fp64, option:rounding): -> fp64

    Get the hyperbolic sine of a value in radians.

    Options:
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • tanh

    Implementations:
    tanh(x, option:rounding): -> return_type
    0. tanh(fp32, option:rounding): -> fp32
    1. tanh(fp64, option:rounding): -> fp64

    Get the hyperbolic tangent of a value in radians.

    Options:
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • acos

    Implementations:
    acos(x, option:rounding, option:on_domain_error): -> return_type
    0. acos(fp32, option:rounding, option:on_domain_error): -> fp64
    1. acos(fp64, option:rounding, option:on_domain_error): -> fp64

    Get the arccosine of a value in radians.

    Options:
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • on_domain_error ['NAN', 'ERROR']
  • asin

    Implementations:
    asin(x, option:rounding, option:on_domain_error): -> return_type
    0. asin(fp32, option:rounding, option:on_domain_error): -> fp64
    1. asin(fp64, option:rounding, option:on_domain_error): -> fp64

    Get the arcsine of a value in radians.

    Options:
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • on_domain_error ['NAN', 'ERROR']
  • atan

    Implementations:
    atan(x, option:rounding): -> return_type
    0. atan(fp32, option:rounding): -> fp64
    1. atan(fp64, option:rounding): -> fp64

    Get the arctangent of a value in radians.

    Options:
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • acosh

    Implementations:
    acosh(x, option:rounding, option:on_domain_error): -> return_type
    0. acosh(fp32, option:rounding, option:on_domain_error): -> fp32
    1. acosh(fp64, option:rounding, option:on_domain_error): -> fp64

    Get the hyperbolic arccosine of a value in radians.

    Options:
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • on_domain_error ['NAN', 'ERROR']
  • asinh

    Implementations:
    asinh(x, option:rounding): -> return_type
    0. asinh(fp32, option:rounding): -> fp32
    1. asinh(fp64, option:rounding): -> fp64

    Get the hyperbolic arcsine of a value in radians.

    Options:
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • atanh

    Implementations:
    atanh(x, option:rounding, option:on_domain_error): -> return_type
    0. atanh(fp32, option:rounding, option:on_domain_error): -> fp32
    1. atanh(fp64, option:rounding, option:on_domain_error): -> fp64

    Get the hyperbolic arctangent of a value in radians.

    Options:
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • on_domain_error ['NAN', 'ERROR']
  • atan2

    Implementations:
    atan2(x, y, option:rounding, option:on_domain_error): -> return_type
    0. atan2(fp32, fp32, option:rounding, option:on_domain_error): -> fp64
    1. atan2(fp64, fp64, option:rounding, option:on_domain_error): -> fp64

    Get the arctangent of values given as x/y pairs.

    Options:
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • on_domain_error ['NAN', 'ERROR']
  • radians

    Implementations:
    radians(x, option:rounding): -> return_type
    0. radians(fp32, option:rounding): -> fp32
    1. radians(fp64, option:rounding): -> fp64

    *Converts angle x in degrees to radians. *

    Options:
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • degrees

    Implementations:
    degrees(x, option:rounding): -> return_type
    0. degrees(fp32, option:rounding): -> fp32
    1. degrees(fp64, option:rounding): -> fp64

    *Converts angle x in radians to degrees. *

    Options:
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • abs

    Implementations:
    abs(x, option:overflow): -> return_type
    0. abs(i8, option:overflow): -> i8
    1. abs(i16, option:overflow): -> i16
    2. abs(i32, option:overflow): -> i32
    3. abs(i64, option:overflow): -> i64
    4. abs(fp32): -> fp32
    5. abs(fp64): -> fp64

    *Calculate the absolute value of the argument. Integer values allow the specification of overflow behavior to handle the unevenness of the twos complement, e.g. Int8 range [-128 : 127]. *

    Options:
  • overflow ['SILENT', 'SATURATE', 'ERROR']
  • sign

    Implementations:
    sign(x): -> return_type
    0. sign(i8): -> i8
    1. sign(i16): -> i16
    2. sign(i32): -> i32
    3. sign(i64): -> i64
    4. sign(fp32): -> fp32
    5. sign(fp64): -> fp64

    *Return the signedness of the argument. Integer values return signedness with the same type as the input. Possible return values are [-1, 0, 1] Floating point values return signedness with the same type as the input. Possible return values are [-1.0, -0.0, 0.0, 1.0, NaN] *

    factorial

    Implementations:
    factorial(n, option:overflow): -> return_type
    0. factorial(i32, option:overflow): -> i32
    1. factorial(i64, option:overflow): -> i64

    *Return the factorial of a given integer input. The factorial of 0! is 1 by convention. Negative inputs will raise an error. *

    Options:
  • overflow ['SILENT', 'SATURATE', 'ERROR']
  • bitwise_not

    Implementations:
    bitwise_not(x): -> return_type
    0. bitwise_not(i8): -> i8
    1. bitwise_not(i16): -> i16
    2. bitwise_not(i32): -> i32
    3. bitwise_not(i64): -> i64

    *Return the bitwise NOT result for one integer input. *

    bitwise_and

    Implementations:
    bitwise_and(x, y): -> return_type
    0. bitwise_and(i8, i8): -> i8
    1. bitwise_and(i16, i16): -> i16
    2. bitwise_and(i32, i32): -> i32
    3. bitwise_and(i64, i64): -> i64

    *Return the bitwise AND result for two integer inputs. *

    bitwise_or

    Implementations:
    bitwise_or(x, y): -> return_type
    0. bitwise_or(i8, i8): -> i8
    1. bitwise_or(i16, i16): -> i16
    2. bitwise_or(i32, i32): -> i32
    3. bitwise_or(i64, i64): -> i64

    *Return the bitwise OR result for two given integer inputs. *

    bitwise_xor

    Implementations:
    bitwise_xor(x, y): -> return_type
    0. bitwise_xor(i8, i8): -> i8
    1. bitwise_xor(i16, i16): -> i16
    2. bitwise_xor(i32, i32): -> i32
    3. bitwise_xor(i64, i64): -> i64

    *Return the bitwise XOR result for two integer inputs. *

    Aggregate Functions

    sum

    Implementations:
    sum(x, option:overflow): -> return_type
    0. sum(i8, option:overflow): -> i64?
    1. sum(i16, option:overflow): -> i64?
    2. sum(i32, option:overflow): -> i64?
    3. sum(i64, option:overflow): -> i64?
    4. sum(fp32, option:overflow): -> fp64?
    5. sum(fp64, option:overflow): -> fp64?

    Sum a set of values. The sum of zero elements yields null.

    Options:
  • overflow ['SILENT', 'SATURATE', 'ERROR']
  • sum0

    Implementations:
    sum0(x, option:overflow): -> return_type
    0. sum0(i8, option:overflow): -> i64
    1. sum0(i16, option:overflow): -> i64
    2. sum0(i32, option:overflow): -> i64
    3. sum0(i64, option:overflow): -> i64
    4. sum0(fp32, option:overflow): -> fp64
    5. sum0(fp64, option:overflow): -> fp64

    *Sum a set of values. The sum of zero elements yields zero. Null values are ignored. *

    Options:
  • overflow ['SILENT', 'SATURATE', 'ERROR']
  • avg

    Implementations:
    avg(x, option:overflow): -> return_type
    0. avg(i8, option:overflow): -> i8?
    1. avg(i16, option:overflow): -> i16?
    2. avg(i32, option:overflow): -> i32?
    3. avg(i64, option:overflow): -> i64?
    4. avg(fp32, option:overflow): -> fp32?
    5. avg(fp64, option:overflow): -> fp64?

    Average a set of values. For integral types, this truncates partial values.

    Options:
  • overflow ['SILENT', 'SATURATE', 'ERROR']
  • min

    Implementations:
    min(x): -> return_type
    0. min(i8): -> i8?
    1. min(i16): -> i16?
    2. min(i32): -> i32?
    3. min(i64): -> i64?
    4. min(fp32): -> fp32?
    5. min(fp64): -> fp64?
    6. min(timestamp): -> timestamp?
    7. min(timestamp_tz): -> timestamp_tz?

    Min a set of values.

    max

    Implementations:
    max(x): -> return_type
    0. max(i8): -> i8?
    1. max(i16): -> i16?
    2. max(i32): -> i32?
    3. max(i64): -> i64?
    4. max(fp32): -> fp32?
    5. max(fp64): -> fp64?
    6. max(timestamp): -> timestamp?
    7. max(timestamp_tz): -> timestamp_tz?

    Max a set of values.

    product

    Implementations:
    product(x, option:overflow): -> return_type
    0. product(i8, option:overflow): -> i8
    1. product(i16, option:overflow): -> i16
    2. product(i32, option:overflow): -> i32
    3. product(i64, option:overflow): -> i64
    4. product(fp32, option:rounding): -> fp32
    5. product(fp64, option:rounding): -> fp64

    Product of a set of values. Returns 1 for empty input.

    Options:
  • overflow ['SILENT', 'SATURATE', 'ERROR']
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • std_dev

    Implementations:
    std_dev(x, option:rounding, option:distribution): -> return_type
    0. std_dev(fp32, option:rounding, option:distribution): -> fp32?
    1. std_dev(fp64, option:rounding, option:distribution): -> fp64?

    Calculates standard-deviation for a set of values.

    Options:
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • distribution ['SAMPLE', 'POPULATION']
  • variance

    Implementations:
    variance(x, option:rounding, option:distribution): -> return_type
    0. variance(fp32, option:rounding, option:distribution): -> fp32?
    1. variance(fp64, option:rounding, option:distribution): -> fp64?

    Calculates variance for a set of values.

    Options:
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • distribution ['SAMPLE', 'POPULATION']
  • corr

    Implementations:
    corr(x, y, option:rounding): -> return_type
    0. corr(fp32, fp32, option:rounding): -> fp32?
    1. corr(fp64, fp64, option:rounding): -> fp64?

    *Calculates the value of Pearson’s correlation coefficient between x and y. If there is no input, null is returned. *

    Options:
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • mode

    Implementations:
    mode(x): -> return_type
    0. mode(i8): -> i8?
    1. mode(i16): -> i16?
    2. mode(i32): -> i32?
    3. mode(i64): -> i64?
    4. mode(fp32): -> fp32?
    5. mode(fp64): -> fp64?

    *Calculates mode for a set of values. If there is no input, null is returned. *

    median

    Implementations:
    median(precision, x, option:rounding): -> return_type
    0. median(precision, i8, option:rounding): -> i8?
    1. median(precision, i16, option:rounding): -> i16?
    2. median(precision, i32, option:rounding): -> i32?
    3. median(precision, i64, option:rounding): -> i64?
    4. median(precision, fp32, option:rounding): -> fp32?
    5. median(precision, fp64, option:rounding): -> fp64?

    *Calculate the median for a set of values. Returns null if applied to zero records. For the integer implementations, the rounding option determines how the median should be rounded if it ends up midway between two values. For the floating point implementations, they specify the usual floating point rounding mode. *

    Options:
  • precision ['EXACT', 'APPROXIMATE']
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • quantile

    Implementations:
    quantile(boundaries, precision, n, distribution, option:rounding): -> return_type

  • n: A positive integer which defines the number of quantile partitions.
  • distribution: The data for which the quantiles should be computed.
  • 0. quantile(boundaries, precision, i64, any, option:rounding): -> LIST?<any>

    *Calculates quantiles for a set of values. This function will divide the aggregated values (passed via the distribution argument) over N equally-sized bins, where N is passed via a constant argument. It will then return the values at the boundaries of these bins in list form. If the input is appropriately sorted, this computes the quantiles of the distribution. The function can optionally return the first and/or last element of the input, as specified by the boundaries argument. If the input is appropriately sorted, this will thus be the minimum and/or maximum values of the distribution. When the boundaries do not lie exactly on elements of the incoming distribution, the function will interpolate between the two nearby elements. If the interpolated value cannot be represented exactly, the rounding option controls how the value should be selected or computed. The function fails and returns null in the following cases: - n is null or less than one; - any value in distribution is null.

    The function returns an empty list if n equals 1 and boundaries is set to NEITHER. *

    Options:
  • boundaries ['NEITHER', 'MINIMUM', 'MAXIMUM', 'BOTH']
  • precision ['EXACT', 'APPROXIMATE']
  • rounding ['TIE_TO_EVEN', 'TIE_AWAY_FROM_ZERO', 'TRUNCATE', 'CEILING', 'FLOOR']
  • Window Functions

    row_number

    Implementations:
    0. row_number(): -> i64?

    the number of the current row within its partition.

    rank

    Implementations:
    0. rank(): -> i64?

    the rank of the current row, with gaps.

    dense_rank

    Implementations:
    0. dense_rank(): -> i64?

    the rank of the current row, without gaps.

    percent_rank

    Implementations:
    0. percent_rank(): -> fp64?

    the relative rank of the current row.

    cume_dist

    Implementations:
    0. cume_dist(): -> fp64?

    the cumulative distribution.

    ntile

    Implementations:
    ntile(x): -> return_type
    0. ntile(i32): -> i32?
    1. ntile(i64): -> i64?

    Return an integer ranging from 1 to the argument value,dividing the partition as equally as possible.

    first_value

    Implementations:
    first_value(expression): -> return_type
    0. first_value(any1): -> any1

    *Returns the first value in the window. *

    last_value

    Implementations:
    last_value(expression): -> return_type
    0. last_value(any1): -> any1

    *Returns the last value in the window. *

    nth_value

    Implementations:
    nth_value(expression, window_offset, option:on_domain_error): -> return_type
    0. nth_value(any1, i32, option:on_domain_error): -> any1?

    *Returns a value from the nth row based on the window_offset. window_offset should be a positive integer. If the value of the window_offset is outside the range of the window, null is returned. The on_domain_error option governs behavior in cases where window_offset is not a positive integer or null. *

    Options:
  • on_domain_error ['NAN', 'ERROR']
  • lead

    Implementations:
    lead(expression): -> return_type
    0. lead(any1): -> any1?
    1. lead(any1, i32): -> any1?
    2. lead(any1, i32, any1): -> any1?

    *Return a value from a following row based on a specified physical offset. This allows you to compare a value in the current row against a following row. The expression is evaluated against a row that comes after the current row based on the row_offset. The row_offset should be a positive integer and is set to 1 if not specified explicitly. If the row_offset is negative, the expression will be evaluated against a row coming before the current row, similar to the lag function. A row_offset of null will return null. The function returns the default input value if row_offset goes beyond the scope of the window. If a default value is not specified, it is set to null. Example comparing the sales of the current year to the following year. row_offset of 1. | year | sales | next_year_sales | | 2019 | 20.50 | 30.00 | | 2020 | 30.00 | 45.99 | | 2021 | 45.99 | null | *

    lag

    Implementations:
    lag(expression): -> return_type
    0. lag(any1): -> any1?
    1. lag(any1, i32): -> any1?
    2. lag(any1, i32, any1): -> any1?

    *Return a column value from a previous row based on a specified physical offset. This allows you to compare a value in the current row against a previous row. The expression is evaluated against a row that comes before the current row based on the row_offset. The expression can be a column, expression or subquery that evaluates to a single value. The row_offset should be a positive integer and is set to 1 if not specified explicitly. If the row_offset is negative, the expression will be evaluated against a row coming after the current row, similar to the lead function. A row_offset of null will return null. The function returns the default input value if row_offset goes beyond the scope of the partition. If a default value is not specified, it is set to null. Example comparing the sales of the current year to the previous year. row_offset of 1. | year | sales | previous_year_sales | | 2019 | 20.50 | null | | 2020 | 30.00 | 20.50 | | 2021 | 45.99 | 30.00 | *