Expand description
DataFusion “prelude” to simplify importing common types.
Like the standard library’s prelude, this module simplifies importing of common items. Unlike the standard prelude, the contents of this module must be imported manually:
use datafusion::prelude::*;
Re-exports§
pub use crate::dataframe::DataFrame;
pub use crate::execution::context::SQLOptions;
pub use crate::execution::context::SessionContext;
pub use crate::execution::options::AvroReadOptions;
pub use crate::execution::options::CsvReadOptions;
pub use crate::execution::options::NdJsonReadOptions;
pub use crate::execution::options::ParquetReadOptions;
Structs§
- Column
- A named reference to a qualified field in a schema.
- Expr
Func Builder - Implementation of
ExprFunctionExt
. - Session
Config - Configuration options for
SessionContext
. - Simple
AggregateUDF - Implements
AggregateUDFImpl
for functions that have a single signature and return type. - Simple
ScalarUDF - Implements
ScalarUDFImpl
for functions that have a single signature and return type. - Simple
WindowUDF - Implements
WindowUDFImpl
for functions that have a single signature and return type.
Enums§
- Expr
- Represents logical expressions such as
A + 1
, orCAST(c1 AS int)
. - Expr
Func Kind - Join
Type - Join type
- Partitioning
- Logical partitioning schemes supported by
LogicalPlan::Repartition
Traits§
- Add
- The addition operator
+
. - BitAnd
- The bitwise AND operator
&
. - BitOr
- The bitwise OR operator
|
. - BitXor
- The bitwise XOR operator
^
. - Div
- The division operator
/
. - Expr
Function Ext - Extensions for configuring
Expr::AggregateFunction
orExpr::WindowFunction
- Mul
- The multiplication operator
*
. - Neg
- The unary negation operator
-
. - Not
- The unary logical negation operator
!
. - Rem
- The remainder operator
%
. - Shl
- The left shift operator
<<
. Note that because this trait is implemented for all integer types with multiple right-hand-side types, Rust’s type checker has special handling for_ << _
, setting the result type for integer operations to the type of the left-hand-side operand. This means that thougha << b
anda.shl(b)
are one and the same from an evaluation standpoint, they are different when it comes to type inference. - Shr
- The right shift operator
>>
. Note that because this trait is implemented for all integer types with multiple right-hand-side types, Rust’s type checker has special handling for_ >> _
, setting the result type for integer operations to the type of the left-hand-side operand. This means that thougha >> b
anda.shr(b)
are one and the same from an evaluation standpoint, they are different when it comes to type inference. - Sub
- The subtraction operator
-
.
Functions§
- abs
- returns the absolute value of a given number
- acos
- returns the arc cosine or inverse cosine of a number
- acosh
- returns inverse hyperbolic cosine
- and
- Return a new expression with a logical AND
- array_
any_ value nested_expressions
- returns the first non-null element in the array.
- array_
append nested_expressions
- appends an element to the end of an array.
- array_
concat nested_expressions
- Concatenates arrays.
- array_
dims nested_expressions
- returns an array of the array’s dimensions.
- array_
distance nested_expressions
- returns the Euclidean distance between two numeric arrays.
- array_
distinct nested_expressions
- returns distinct values from the array after removing duplicates.
- array_
element nested_expressions
- extracts the element with the index n from the array.
- array_
empty nested_expressions
- returns true for an empty array or false for a non-empty array.
- array_
except nested_expressions
- returns an array of the elements that appear in the first array but not in the second.
- array_
has nested_expressions
- returns true, if the element appears in the first array, otherwise false.
- array_
has_ all nested_expressions
- returns true if each element of the second array appears in the first array; otherwise, it returns false.
- array_
has_ any nested_expressions
- returns true if at least one element of the second array appears in the first array; otherwise, it returns false.
- array_
intersect nested_expressions
- returns an array of the elements in the intersection of array1 and array2.
- array_
length nested_expressions
- returns the length of the array dimension.
- array_
ndims nested_expressions
- returns the number of dimensions of the array.
- array_
pop_ back nested_expressions
- returns the array without the last element.
- array_
pop_ front nested_expressions
- returns the array without the first element.
- array_
position nested_expressions
- searches for an element in the array, returns first occurrence.
- array_
positions nested_expressions
- searches for an element in the array, returns all occurrences.
- array_
prepend nested_expressions
- Prepends an element to the beginning of an array.
- array_
remove nested_expressions
- removes the first element from the array equal to the given value.
- array_
remove_ all nested_expressions
- removes all elements from the array equal to the given value.
- array_
remove_ n nested_expressions
- removes the first
max
elements from the array equal to the given value. - array_
repeat nested_expressions
- returns an array containing element
count
times. - array_
replace nested_expressions
- replaces the first occurrence of the specified element with another specified element.
- array_
replace_ all nested_expressions
- replaces all occurrences of the specified element with another specified element.
- array_
replace_ n nested_expressions
- replaces the first
max
occurrences of the specified element with another specified element. - array_
resize nested_expressions
- returns an array with the specified size filled with the given value.
- array_
reverse nested_expressions
- reverses the order of elements in the array.
- array_
slice nested_expressions
- returns a slice of the array.
- array_
sort nested_expressions
- returns sorted array.
- array_
to_ string nested_expressions
- converts each element to its text representation.
- array_
union nested_expressions
- returns an array of the elements in the union of array1 and array2 without duplicates.
- arrow_
cast - Returns value2 if value1 is NULL; otherwise it returns value1
- arrow_
typeof - Returns the Arrow type of the input expression.
- ascii
- Returns the numeric code of the first character of the argument.
- asin
- returns the arc sine or inverse sine of a number
- asinh
- returns inverse hyperbolic sine
- atan
- returns inverse tangent
- atan2
- returns inverse tangent of a division given in the argument
- atanh
- returns inverse hyperbolic tangent
- binary_
expr - Return a new expression
left <op> right
- bit_
length - Returns the number of bits in the
string
- bitwise_
and - Return a new expression with bitwise AND
- bitwise_
or - Return a new expression with bitwise OR
- bitwise_
shift_ left - Return a new expression with bitwise SHIFT LEFT
- bitwise_
shift_ right - Return a new expression with bitwise SHIFT RIGHT
- bitwise_
xor - Return a new expression with bitwise XOR
- btrim
- Removes all characters, spaces by default, from both sides of a string
- cardinality
nested_expressions
- returns the total number of elements in the array or map.
- case
- Create a CASE WHEN statement with literal WHEN expressions for comparison to the base expression.
- cast
- Create a cast expression
- cbrt
- cube root of a number
- ceil
- nearest integer greater than or equal to argument
- char_
length - the number of characters in the
string
- character_
length - the number of characters in the
string
- chr
- Converts the Unicode code point to a UTF8 character
- coalesce
- Returns
coalesce(args...)
, which evaluates to the value of the first expr which is not NULL - col
- Create a column expression based on a qualified or unqualified column name. Will normalize unquoted identifiers according to SQL rules (identifiers will become lowercase).
- concat
- Concatenates the text representations of all the arguments. NULL arguments are ignored
- concat_
ws - Concatenates all but the first argument, with separators. The first argument is used as the separator string, and should not be NULL. Other NULL arguments are ignored.
- contains
- Return true if search_string is found within string.
- cos
- cosine
- cosh
- hyperbolic cosine
- cot
- cotangent of a number
- create_
udaf - Creates a new UDAF with a specific signature, state type and return type.
The signature and state type must match the
Accumulator's implementation
. - create_
udf - Convenience method to create a new user defined scalar function (UDF) with a specific signature and specific return type.
- create_
udwf - Creates a new UDWF with a specific signature, state type and return type.
- cube
- Create a grouping set for all combination of
exprs
- current_
date - returns current UTC date as a Date32 value
- current_
time - returns current UTC time as a Time64 value
- date_
bin - coerces an arbitrary timestamp to the start of the nearest specified interval
- date_
part - extracts a subfield from the date
- date_
trunc - truncates the date to a specified level of precision
- decode
- decode the
input
, using theencoding
. encoding can be base64 or hex - degrees
- converts radians to degrees
- digest
- Computes the binary hash of an expression using the specified algorithm.
- encode
- encode the
input
, using theencoding
. encoding can be base64 or hex - ends_
with - Returns true if the
string
ends with thesuffix
, false otherwise. - exists
- Create an EXISTS subquery expression
- exp
- exponential
- factorial
- factorial
- find_
in_ set - Returns a value in the range of 1 to N if the string
str
is in the string liststrlist
consisting of N substrings - flatten
nested_expressions
- flattens an array of arrays into a single array.
- floor
- nearest integer less than or equal to argument
- from_
unixtime - converts an integer to RFC3339 timestamp format string
- gcd
- greatest common divisor
- gen_
series nested_expressions
- create a list of values in the range between start and stop, include upper bound
- get_
field - Returns the value of the field with the given name from the struct
- greatest
- Returns
greatest(args...)
, which evaluates to the greatest value in the list of expressions or NULL if all the expressions are NULL - grouping_
set - Create a grouping set
- ident
- Create an unqualified column expression from the provided name, without normalizing the column.
- in_list
- Create an in_list expression
- in_
subquery - Create an IN subquery expression
- initcap
- converts the first letter of each word in
string
in uppercase and the remaining characters in lowercase - instr
- finds the position from where the
substring
matches thestring
- interval_
datetime_ lit - interval_
month_ day_ nano_ lit - interval_
year_ month_ lit - is_
false - Create is false expression
- is_
not_ false - Create is not false expression
- is_
not_ true - Create is not true expression
- is_
not_ unknown - Create is not unknown expression
- is_null
- Create is null expression
- is_true
- Create is true expression
- is_
unknown - Create is unknown expression
- isnan
- returns true if a given number is +NaN or -NaN otherwise returns false
- iszero
- returns true if a given number is +0.0 or -0.0 otherwise returns false
- lcm
- least common multiple
- least
- Returns
least(args...)
, which evaluates to the smallest value in the list of expressions or NULL if all the expressions are NULL - left
- returns the first
n
characters in thestring
- length
- the number of characters in the
string
- levenshtein
- Returns the Levenshtein distance between the two given strings
- lit
- Create a literal expression
- lit_
timestamp_ nano - Create a literal timestamp expression
- ln
- natural logarithm (base e) of a number
- log
- logarithm of a number for a particular
base
- log2
- base 2 logarithm of a number
- log10
- base 10 logarithm of a number
- lower
- Converts a string to lowercase.
- lpad
- fill up a string to the length by prepending the characters
- ltrim
- Removes all characters, spaces by default, from the beginning of a string
- make_
array nested_expressions
- Returns an Arrow array using the specified input expressions.
- make_
date - make a date from year, month and day component parts
- map_
extract nested_expressions
- Return a list containing the value for a given key or an empty list if the key is not contained in the map.
- map_
keys nested_expressions
- Return a list of all keys in the map.
- map_
values nested_expressions
- Return a list of all values in the map.
- md5
- Computes an MD5 128-bit checksum for a string expression.
- named_
struct - Returns a struct with the given names and arguments pairs
- nanvl
- returns x if x is not NaN otherwise returns y
- not
- Return a new expression with a logical NOT
- not_
exists - Create a NOT EXISTS subquery expression
- not_
in_ subquery - Create a NOT IN subquery expression
- now
- returns the current timestamp in nanoseconds, using the same value for all instances of now() in same statement
- nullif
- Returns NULL if value1 equals value2; otherwise it returns value1. This can be used to perform the inverse operation of the COALESCE expression
- nvl
- Returns value2 if value1 is NULL; otherwise it returns value1
- nvl2
- Returns value2 if value1 is not NULL; otherwise, it returns value3.
- octet_
length - returns the number of bytes of a string
- or
- Return a new expression with a logical OR
- out_
ref_ col - Create an out reference column which hold a reference that has been resolved to a field outside of the current plan.
- overlay
- replace the substring of string that starts at the start’th character and extends for count characters with new substring
- pi
- Returns an approximate value of π
- placeholder
- Create placeholder value that will be filled in (such as
$1
) - position
- finds the position from where the
substring
matches thestring
- power
base
raised to the power ofexponent
- qualified_
wildcard - Create an ‘t.*’
Expr::Wildcard
expression that matches all columns from a specific table - qualified_
wildcard_ with_ options - Create an ‘t.*’
Expr::Wildcard
expression with the wildcard options - radians
- converts degrees to radians
- random
- Returns a random value in the range 0.0 <= x < 1.0
- range
nested_expressions
- create a list of values in the range between start and stop
- regexp_
count - Returns the number of consecutive occurrences of a regular expression in a string.
- regexp_
like - Returns true if a has at least one match in a string, false otherwise.
- regexp_
match - Returns a list of regular expression matches in a string.
- regexp_
replace - Replaces substrings in a string that match.
- repeat
- Repeats the
string
ton
times - replace
- Replaces all occurrences of
from
withto
in thestring
- reverse
- reverses the
string
- right
- returns the last
n
characters in thestring
- rollup
- Create a grouping set for rollup
- round
- round to nearest integer
- rpad
- fill up a string to the length by appending the characters
- rtrim
- Removes all characters, spaces by default, from the end of a string
- scalar_
subquery - Create a scalar subquery expression
- sha224
- Computes the SHA-224 hash of a binary string.
- sha256
- Computes the SHA-256 hash of a binary string.
- sha384
- Computes the SHA-384 hash of a binary string.
- sha512
- Computes the SHA-512 hash of a binary string.
- signum
- sign of the argument (-1, 0, +1)
- sin
- sine
- sinh
- hyperbolic sine
- split_
part - Splits a string based on a delimiter and picks out the desired field based on the index.
- sqrt
- square root of a number
- starts_
with - Returns true if string starts with prefix.
- string_
to_ array nested_expressions
- splits a
string
based on adelimiter
and returns an array of parts. Any parts matching the optionalnull_string
will be replaced withNULL
- strpos
- finds the position from where the
substring
matches thestring
- struct
- Returns a struct with the given arguments
- substr
- substring from the
position
to the end - substr_
index - Returns the substring from str before count occurrences of the delimiter
- substring
- substring from the
position
withlength
characters - tan
- returns the tangent of a number
- tanh
- returns the hyperbolic tangent of a number
- to_char
- Returns a string representation of a date, time, timestamp or duration based on a Chrono pattern.
- to_date
- to_hex
- Converts an integer to a hexadecimal string.
- to_
local_ time - converts a timezone-aware timestamp to local time (with no offset or timezone information), i.e. strips off the timezone from the timestamp
- to_
timestamp - converts a string and optional formats to a
Timestamp(Nanoseconds, None)
- to_
timestamp_ micros - converts a string and optional formats to a
Timestamp(Microseconds, None)
- to_
timestamp_ millis - converts a string and optional formats to a
Timestamp(Milliseconds, None)
- to_
timestamp_ nanos - converts a string and optional formats to a
Timestamp(Nanoseconds, None)
- to_
timestamp_ seconds - converts a string and optional formats to a
Timestamp(Seconds, None)
- to_
unixtime - converts a string and optional formats to a Unixtime
- translate
- replaces the characters in
from
with the counterpart into
- trim
- Removes all characters, spaces by default, from both sides of a string
- trunc
- truncate toward zero, with optional precision
- try_
cast - Create a try cast expression
- union_
extract - Returns the value of the field with the given name from the union when it’s selected, or NULL otherwise
- unnest
- Create a Unnest expression
- upper
- Converts a string to uppercase.
- uuid
- returns uuid v4 as a string value
- when
- Create a CASE WHEN statement with boolean WHEN expressions and no base expression.
- wildcard
- Create an ‘*’
Expr::Wildcard
expression that matches all columns - wildcard_
with_ options - Create an ‘*’
Expr::Wildcard
expression with the wildcard options