Module datafusion_expr::expr_fn
source · Expand description
Functions for creating logical expressions
Functions
- absolute value
- inverse cosine
- inverse hyperbolic cosine
- Return a new expression with a logical AND
- Returns the approximate number of distinct input values. This function provides an approximation of count(DISTINCT x). Zero is returned if all input values are null. This function should produce a standard error of 0.81%, which is the standard deviation of the (approximately normal) error distribution over all possible sets. It does not guarantee an upper bound on the error for any specific input set.
- Calculate an approximation of the median for
expr
. - Calculate an approximation of the specified
percentile
forexpr
. - Calculate an approximation of the specified
percentile
forexpr
andweight_expr
. - returns an Arrow array using the specified input expressions.
- Create an expression to represent the array_agg() aggregate function
- appends an element to the end of an array.
- concatenates arrays.
- returns an array of the array’s dimensions.
- extracts the element with the index n from the array.
- returns 1 for an empty array or 0 for a non-empty array.
- returns true, if the element appears in the first array, otherwise false.
- returns true if each element of the second array appears in the first array; otherwise, it returns false.
- returns true if at least one element of the second array appears in the first array; otherwise, it returns false.
- returns the length of the array dimension.
- returns the number of dimensions of the array.
- returns the array without the last element.
- searches for an element in the array, returns first occurrence.
- searches for an element in the array, returns all occurrences.
- prepends an element to the beginning of an array.
- removes the first element from the array equal to the given value.
- removes all elements from the array equal to the given value.
- removes the first
max
elements from the array equal to the given value. - returns an array containing element
count
times. - replaces the first occurrence of the specified element with another specified element.
- replaces all occurrences of the specified element with another specified element.
- replaces the first
max
occurrences of the specified element with another specified element. - returns a slice of the array.
- converts each element to its text representation.
- data type
- ASCII code value of the character
- inverse sine
- inverse hyperbolic sine
- inverse tangent
- inverse tangent of a division given in the argument
- inverse hyperbolic tangent
- Create an expression to represent the avg() aggregate function
- Return a new expression
left <op> right
- the number of bits in the
string
- Return a new expression with bitwise AND
- Return a new expression with bitwise OR
- Return a new expression with bitwise SHIFT LEFT
- Return a new expression with bitwise SHIFT RIGHT
- Return a new expression with bitwise XOR
- removes all characters, spaces by default, from both sides of a string
- Calls a named built in function
- returns the total number of elements in the array.
- Create a CASE WHEN statement with literal WHEN expressions for comparison to the base expression.
- Create a cast expression
- cube root of a number
- nearest integer greater than or equal to argument
- the number of characters in the
string
- converts the Unicode code point to a UTF8 character
- returns
coalesce(args...)
, which evaluates to the value of the first Expr which is not NULL - Create a column expression based on a qualified or unqualified column name. Will normalize unquoted identifiers according to SQL rules (identifiers will become lowercase).
- Concatenates the text representations of all the arguments. NULL arguments are ignored.
- concatenates several strings
- Concatenates all but the first argument, with separators. The first argument is used as the separator. NULL arguments in
values
are ignored. - concatenates several strings, placing a seperator between each one
- cosine
- hyperbolic cosine
- cotangent
- Create an expression to represent the count() aggregate function
- Create an expression to represent the count(distinct) aggregate function
- Creates a new UDAF with a specific signature, state type and return type. The signature and state type must match the
Accumulator's implementation
. - Creates a new UDF with a specific signature and specific return type. This is a helper function to create a new UDF. The function
create_udf
returns a subset of all possibleScalarFunction
: - Creates a new UDWF with a specific signature, state type and return type.
- Create a grouping set for all combination of
exprs
- returns current UTC date as a [
DataType::Date32
] value - returns current UTC time as a [
DataType::Time64
] value - coerces an arbitrary timestamp to the start of the nearest specified interval
- extracts a subfield from the date
- truncates the date to a specified level of precision
- decode the
input
, using theencoding
. encoding can be base64 or hex - converts radians to degrees
- compute the binary hash of
input
, using thealgorithm
- encode the
input
, using theencoding
. encoding can be base64 or hex - Create an EXISTS subquery expression
- exponential
- factorial
- flattens an array of arrays into a single array.
- nearest integer less than or equal to argument
- returns the unix time in format
- greatest common divisor
- Create a grouping set
- Create an unqualified column expression from the provided name, without normalizing the column.
- Create an in_list expression
- Create an IN subquery expression
- converts the first letter of each word in
string
in uppercase and the remaining characters in lowercase - Create is false expression
- Create is not false expression
- Create is not true expression
- Create is not unknown expression
- Create is null expression
- Create is true expression
- Create is unknown expression
- returns true if a given number is +NaN or -NaN otherwise returns false
- returns true if a given number is +0.0 or -0.0 otherwise returns false
- least common multiple
- returns the first
n
characters in thestring
- natural logarithm
- logarithm of a
x
for a particularbase
- base 2 logarithm
- base 10 logarithm
- convert the string to lower case
- fill up a string to the length by prepending the characters
- removes all characters, spaces by default, from the beginning of a string
- Create an expression to represent the max() aggregate function
- returns the MD5 hash of a string
- Calculate the median for
expr
. - Create an expression to represent the min() aggregate function
- returns x if x is not NaN otherwise returns y
- Create a NOT EXISTS subquery expression
- Create a NOT IN subquery expression
- returns current timestamp in nanoseconds, using the same value for all instances of now() in same statement
- returns NULL if value1 equals value2; otherwise it returns value1. This can be used to perform the inverse operation of the COALESCE expression.
- returns the number of bytes of a string
- Return a new expression with a logical OR
- Create an out reference column which hold a reference that has been resolved to a field outside of the current plan.
- Returns an approximate value of π
base
raised to the power ofexponent
- converts degrees to radians
- Returns a random value in the range 0.0 <= x < 1.0
- matches a regular expression against a string and returns matched substrings.
- replace strings that match a regular expression
- repeats the
string
ton
times - replaces all occurrences of
from
withto
in thestring
- reverses the
string
- returns the last
n
characters in thestring
- Create a grouping set for rollup
- round to nearest integer
- fill up a string to the length by appending the characters
- removes all characters, spaces by default, from the end of a string
- Create a scalar subquery expression
- SHA-224 hash
- SHA-256 hash
- SHA-384 hash
- SHA-512 hash
- sign of the argument (-1, 0, +1)
- sine
- hyperbolic sine
- splits a string based on a delimiter and picks out the desired field based on the index.
- square root of a number
- whether the
string
starts with theprefix
- Create an expression to represent the stddev() aggregate function
- finds the position from where the
substring
matches thestring
- substring from the
position
to the end - substring from the
position
withlength
characters - Create an expression to represent the sum() aggregate function
- tangent
- hyperbolic tangent
- returns the hexdecimal representation of an integer
- converts a string to a
Timestamp(Microseconds, None)
- converts a string to a
Timestamp(Milliseconds, None)
- converts a string to a
Timestamp(Seconds, None)
- replaces the characters in
from
with the counterpart into
- removes all characters, space by default from the string
- truncate toward zero, with optional precision
- Create a try cast expression
- converts the string to upper case
- returns uuid v4 as a string value
- Create a CASE WHEN statement with boolean WHEN expressions and no base expression.