Skip to content

functions_arithmetic.yaml

This document file is generated for functions_arithmetic.yaml

Scalar Functions

add

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

Add two values.

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

    Implementations:
    subtract(opt_enum:overflow, x, y): -> return_type
    0. subtract(opt_enum:overflow, i8, i8): -> i8
    1. subtract(opt_enum:overflow, i16, i16): -> i16
    2. subtract(opt_enum:overflow, i32, i32): -> i32
    3. subtract(opt_enum:overflow, i64, i64): -> i64
    4. subtract(opt_enum:rounding, fp32, fp32): -> fp32
    5. subtract(opt_enum:rounding, fp64, fp64): -> 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(opt_enum:overflow, x, y): -> return_type
    0. multiply(opt_enum:overflow, i8, i8): -> i8
    1. multiply(opt_enum:overflow, i16, i16): -> i16
    2. multiply(opt_enum:overflow, i32, i32): -> i32
    3. multiply(opt_enum:overflow, i64, i64): -> i64
    4. multiply(opt_enum:rounding, fp32, fp32): -> fp32
    5. multiply(opt_enum:rounding, fp64, fp64): -> fp64

    Multiply two values.

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

    Implementations:
    divide(opt_enum:overflow, x, y): -> return_type
    0. divide(opt_enum:overflow, i8, i8): -> i8
    1. divide(opt_enum:overflow, i16, i16): -> i16
    2. divide(opt_enum:overflow, i32, i32): -> i32
    3. divide(opt_enum:overflow, i64, i64): -> i64
    4. divide(opt_enum:rounding, opt_enum:on_domain_error, opt_enum:on_division_by_zero, fp32, fp32): -> fp32
    5. divide(opt_enum:rounding, opt_enum:on_domain_error, opt_enum:on_division_by_zero, fp64, fp64): -> 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(opt_enum:overflow, x): -> return_type
    0. negate(opt_enum:overflow, i8): -> i8
    1. negate(opt_enum:overflow, i16): -> i16
    2. negate(opt_enum:overflow, i32): -> i32
    3. negate(opt_enum:overflow, i64): -> i64
    4. negate(fp32): -> fp32
    5. negate(fp64): -> fp64

    Negation of the value

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

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

    Get the remainder when dividing one value by another.

    power

    Implementations:
    power(opt_enum:overflow, x, y): -> return_type
    0. power(opt_enum:overflow, i64, i64): -> 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(opt_enum:rounding, opt_enum:on_domain_error, x): -> return_type
    0. sqrt(opt_enum:rounding, opt_enum:on_domain_error, i64): -> fp64
    1. sqrt(opt_enum:rounding, opt_enum:on_domain_error, fp32): -> fp32
    2. sqrt(opt_enum:rounding, opt_enum:on_domain_error, fp64): -> 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(opt_enum:rounding, x): -> return_type
    0. exp(opt_enum:rounding, fp32): -> fp32
    1. exp(opt_enum:rounding, fp64): -> 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(opt_enum:rounding, x): -> return_type
    0. cos(opt_enum:rounding, fp32): -> fp64
    1. cos(opt_enum:rounding, fp64): -> fp64

    Get the cosine of a value in radians.

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

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

    Get the sine of a value in radians.

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

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

    Get the tangent of a value in radians.

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

    Implementations:
    cosh(opt_enum:rounding, x): -> return_type
    0. cosh(opt_enum:rounding, fp32): -> fp32
    1. cosh(opt_enum:rounding, fp64): -> 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(opt_enum:rounding, x): -> return_type
    0. sinh(opt_enum:rounding, fp32): -> fp32
    1. sinh(opt_enum:rounding, fp64): -> 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(opt_enum:rounding, x): -> return_type
    0. tanh(opt_enum:rounding, fp32): -> fp32
    1. tanh(opt_enum:rounding, fp64): -> 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(opt_enum:rounding, opt_enum:on_domain_error, x): -> return_type
    0. acos(opt_enum:rounding, opt_enum:on_domain_error, fp32): -> fp64
    1. acos(opt_enum:rounding, opt_enum:on_domain_error, fp64): -> 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(opt_enum:rounding, opt_enum:on_domain_error, x): -> return_type
    0. asin(opt_enum:rounding, opt_enum:on_domain_error, fp32): -> fp64
    1. asin(opt_enum:rounding, opt_enum:on_domain_error, fp64): -> 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(opt_enum:rounding, x): -> return_type
    0. atan(opt_enum:rounding, fp32): -> fp64
    1. atan(opt_enum:rounding, fp64): -> fp64

    Get the arctangent of a value in radians.

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

    Implementations:
    acosh(opt_enum:rounding, opt_enum:on_domain_error, x): -> return_type
    0. acosh(opt_enum:rounding, opt_enum:on_domain_error, fp32): -> fp32
    1. acosh(opt_enum:rounding, opt_enum:on_domain_error, fp64): -> 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(opt_enum:rounding, x): -> return_type
    0. asinh(opt_enum:rounding, fp32): -> fp32
    1. asinh(opt_enum:rounding, fp64): -> 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(opt_enum:rounding, opt_enum:on_domain_error, x): -> return_type
    0. atanh(opt_enum:rounding, opt_enum:on_domain_error, fp32): -> fp32
    1. atanh(opt_enum:rounding, opt_enum:on_domain_error, fp64): -> 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(opt_enum:rounding, opt_enum:on_domain_error, x, y): -> return_type
    0. atan2(opt_enum:rounding, opt_enum:on_domain_error, fp32, fp32): -> fp64
    1. atan2(opt_enum:rounding, opt_enum:on_domain_error, fp64, fp64): -> 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']
  • abs

    Implementations:
    abs(opt_enum:overflow, x): -> return_type
    0. abs(opt_enum:overflow, i8): -> i8
    1. abs(opt_enum:overflow, i16): -> i16
    2. abs(opt_enum:overflow, i32): -> i32
    3. abs(opt_enum:overflow, i64): -> 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(opt_enum:overflow, n): -> return_type
    0. factorial(opt_enum:overflow, i32): -> i32
    1. factorial(opt_enum:overflow, i64): -> 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']
  • Aggregate Functions

    sum

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

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

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

    Implementations:
    avg(opt_enum:overflow, x): -> return_type
    0. avg(opt_enum:overflow, i8): -> i8?
    1. avg(opt_enum:overflow, i16): -> i16?
    2. avg(opt_enum:overflow, i32): -> i32?
    3. avg(opt_enum:overflow, i64): -> i64?
    4. avg(opt_enum:overflow, fp32): -> fp32?
    5. avg(opt_enum:overflow, fp64): -> 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?

    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?

    Max a set of values.

    product

    Implementations:
    product(opt_enum:overflow, x): -> return_type
    0. product(opt_enum:overflow, i8): -> i8
    1. product(opt_enum:overflow, i16): -> i16
    2. product(opt_enum:overflow, i32): -> i32
    3. product(opt_enum:overflow, i64): -> i64
    4. product(opt_enum:rounding, fp32): -> fp32
    5. product(opt_enum:rounding, fp64): -> 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(opt_enum:rounding, opt_enum:distribution, x): -> return_type
    0. std_dev(opt_enum:rounding, opt_enum:distribution, fp32): -> fp32?
    1. std_dev(opt_enum:rounding, opt_enum:distribution, fp64): -> 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(opt_enum:rounding, opt_enum:distribution, x): -> return_type
    0. variance(opt_enum:rounding, opt_enum:distribution, fp32): -> fp32?
    1. variance(opt_enum:rounding, opt_enum:distribution, fp64): -> 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(opt_enum:rounding, x, y): -> return_type
    0. corr(opt_enum:rounding, fp32, fp32): -> fp32?
    1. corr(opt_enum:rounding, fp64, fp64): -> 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(req_enum:precision, opt_enum:rounding, x): -> return_type
    0. median(req_enum:precision, opt_enum:rounding, i8): -> i8?
    1. median(req_enum:precision, opt_enum:rounding, i16): -> i16?
    2. median(req_enum:precision, opt_enum:rounding, i32): -> i32?
    3. median(req_enum:precision, opt_enum:rounding, i64): -> i64?
    4. median(req_enum:precision, opt_enum:rounding, fp32): -> fp32?
    5. median(req_enum:precision, opt_enum:rounding, fp64): -> 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(req_enum:boundaries, req_enum:precision, opt_enum:rounding, n, distribution): -> 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(req_enum:boundaries, req_enum:precision, opt_enum:rounding, i64, any): -> 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.