不拘小节的仙人掌 · loadData与loadDataWithB ...· 3 天前 · |
耍酷的柳树 · c++正则表达式过滤特殊字符(非字母,数字, ...· 3 天前 · |
细心的桔子 · Error: Invalid ...· 3 天前 · |
独立的饺子 · 使用HtmlUnit库的Java下载器:下载 ...· 昨天 · |
唠叨的紫菜汤 · Making async calls ...· 10 小时前 · |
痴情的啄木鸟 · 黄金走高引来银行开发新业务?平安银行提前三个 ...· 2 月前 · |
想发财的火腿肠 · 香港艺人集体吸毒事件_百度百科· 2 月前 · |
酷酷的便当 · 每周招商动态(84)_周口市人民政府· 3 月前 · |
刚毅的火柴 · Angela Yuen 袁澧林的新生活卜口· 4 月前 · |
瘦瘦的柚子 · 迪士尼收购21世纪福克斯资产的交易获得中国批 ...· 4 月前 · |
table array string |
https://docs.databricks.com/en/sql/language-manual/sql-ref-functions-builtin.html |
绅士的茴香
2 周前 |
CLUSTER
BY
clause (TABLE)
mask
clause
ROW
FILTER
clause
Applies to: Databricks SQL Databricks Runtime
This article presents links to and descriptions of built-in operators and functions for strings and binary types, numeric scalars, aggregations, windows, arrays, maps, dates and timestamps, casting, CSV data, JSON data, XPath manipulation, and other miscellaneous functions.
For use cases that are not supported by existing built-in functions, consider defining a custom function. See What are user-defined functions (UDFs)? .
Also see:
For information on how operators are parsed with respect to each other, see Operator precedence .
expr1
[not]
between
expr2
and
expr2
Tests whether
expr1
is greater or equal than
expr2
and less than or equal to
expr3
.
arrayExpr
[
indexExpr
]
Returns
indexExpr
nd element of
ARRAY
arrayExpr
.
mapExpr
[
keyExpr
]
Returns value at
keyExpr
of
MAP
mapExpr
.
expr1
^
expr2
Returns the bitwise exclusive
OR
(XOR)
of
expr1
and
expr2
.
jsonStr
:
jsonPath
Returns fields extracted from the
jsonStr
.
expr
::
type
Casts the value
expr
to the target data type
type
.
expr
?::
type
Casts the value
expr
to the target data type
type
if possible, returns
NULL
otherwise.
dividend
div
divisor
Returns the integral part of the division of
dividend
by
divisor
.
mapExpr
.
keyIdentifier
Returns a
MAP
value by
keyIdentifier
.
structExpr
.
fieldIdentifier
Returns a
STRUCT
field by
fieldIdentifier
.
expr1
==
expr2
Returns
true
if
expr1
equals
expr2
, or
false
otherwise.
expr1
=
expr2
Returns
true
if
expr1
equals
expr2
, or
false
otherwise.
expr1
>=
expr2
Returns
true
if
expr1
is greater than or equal to
expr2
, or
false
otherwise.
expr1
>
expr2
Returns
true
if
expr1
is greater than
expr2
, or
false
otherwise.
exists(query)
Returns true if
query
returns at least one row, or false otherwise.
str
[not]
ilike
(pattern[ESCAPE
escape])
Returns true if
str
does (not) match
pattern
with
escape
case-insensitively.
str
[not]
ilike
{ANY|SOME|ALL}([pattern[,
...]])
Returns true if
str
does (not) match any/all patterns case-insensitively.
elem
[not]
in
(expr1[,
...])
Returns
true
if
elem
does (not) equal any
exprN
.
elem
[not]
in
(query)
Returns
true
if
elem
does (not) equal any row in
query
.
expr1
is
[not]
distinct
from
expr2
Tests whether the arguments do (not) have different values where
NULL
s are considered as comparable values.
expr
is
[not]
false
Tests whether
expr
is (not)
false
.
expr
is
[not]
null
Returns
true
if
expr
is (not)
NULL
.
expr
is
[not]
true
Tests whether
expr
is (not)
true
.
str
[not]
like
(pattern[ESCAPE
escape])
Returns true if
str
does (not) match
pattern
with
escape
.
str
[not]
like
{ANY|SOME|ALL}([pattern[,
...]])
Returns true if
str
does (not) match any/all patterns.
expr1
<=>
expr2
Returns the same result as the
EQUAL(=)
for non-null operands, but returns
true
if both are
NULL
,
false
if one of the them is
NULL
.
expr1
<=
expr2
Returns
true
if
expr1
is less than or equal to
expr2
, or
false
otherwise.
expr1
<>
expr2
Returns
true
if
expr1
does not equal
expr2
, or
false
otherwise.
expr1
<
expr2
Returns
true
if
expr1
is less than
expr2
, or
false
otherwise.
expr1
-
expr2
Returns the subtraction of
expr2
from
expr1
.
not
expr
Returns the logical
NOT
of a Boolean expression.
expr1
or
expr2
Returns the logical
OR
of
expr1
and
expr2
.
dividend
%
divisor
Returns the remainder after
dividend
/
divisor
.
expr1
||
expr2
Returns the concatenation of
expr1
and
expr2
.
expr1
|
expr2
Returns the bitwise
OR
of
expr1
and
expr2
.
expr1
+
expr2
Returns the sum of
expr1
and
expr2
.
str
[not]
regexp
regex
Returns true if
str
does (not) match
regex
.
str
[not]
regexp_like
regex
Returns true if
str
does (not) match
regex
.
str
[not]
rlike
regex
Returns true if
str
does (not) match
regex
.
dividend
/
divisor
Returns
dividend
divided by
divisor
.
~
expr
Returns the bitwise
NOT
of
expr
.
between
,
in
,
rlike
,
regexp
,
ilike
,
like
,
is
[not]
[NULL,
true,
false]
,
is
[not]
distinct
from
Returns the concatenation of
expr1
and
expr2
.
aes_decrypt(expr, key[, mode[, padding[, aad]]])
Decrypts a binary
expr
using AES encryption.
aes_encrypt(expr, key[, mode[, padding[, iv[, aad]]]])
Encrypts a binary
expr
using AES encryption.
Returns the ASCII code point of the first character of
str
.
Converts
expr
to a base 64 string.
Returns the binary representation of
expr
.
Casts the value of
expr
to
BINARY
.
Returns the bit length of string data or number of bits of binary data.
Returns the number of bits set in a
BINARY
string representing a bitmap.
Returns
str
with leading and trailing characters removed.
Returns the character at the supplied UTF-16 code point.
Returns the character length of string data or number of bytes of binary data.
Returns the character length of string data or number of bytes of binary data.
Returns the position of the first occurrence of
substr
in
str
after position
pos
.
Returns the character at the supplied UTF-16 code point.
Attaches an explicit collation
collationName
to
strExpr
.
Returns the collation attached to
strExpr
.
Returns the concatenation of the arguments.
Returns the concatenation strings separated by
sep
.
Returns
true
if
expr
STRING
or
BINARY
contains
subExpr
.
Returns a cyclic redundancy check value of
expr
.
Translates binary
expr
to a string using the character set encoding
charSet
.
Returns the binary representation of a string using the
charSet
character encoding.
Returns
true
if
expr
STRING
or
BINARY
ends with
endExpr
.
find_in_set(searchExpr, sourceExpr)
Returns the position of a string within a comma-separated list of strings.
Formats
expr
like
#,###,###.##
, rounded to
scale
decimal places.
Formats
expr
like
fmt
.
format_string(strfmt[, obj1 [, …]])
Returns a formatted string from printf-style format strings.
Converts
expr
to hexadecimal.
str ilike (pattern[ESCAPE escape])
Returns true if
str
matches
pattern
with
escape
case insensitively.
Returns
expr
with the first letter of each word in uppercase.
Returns the (1-based) index of the first occurrence of
substr
in
str
.
Returns
expr
with all characters changed to lowercase.
Returns the leftmost
len
characters from
str
.
Returns the character length of string data or number of bytes of binary data.
Returns the character length of string data or number of bytes of binary data.
Returns the Levenshtein distance between the strings
str1
and
str2
.
str like (pattern[ESCAPE escape])
Returns true if
str
matches
pattern
with
escape
.
Returns the position of the first occurrence of
substr
in
str
after position
pos
.
Returns
expr
with all characters changed to lowercase.
Returns
expr
, left-padded with
pad
to a length of
len
.
Returns
str
with leading characters within
trimStr
removed.
mask(str[, upperChar[, lowerChar[, digitChar[, otherChar]]]])
Returns a masked version of the input
str
.
Returns an MD5 128-bit checksum of
expr
as a hex string.
Returns the byte length of string data or number of bytes of binary data.
overlay(input PLACING replace FROM pos [FOR len])
Replaces
input
with
replace
that starts at
pos
and is of length
len
.
overlay(input PLACING replace FROM pos [FOR len])
Replaces
input
with
replace
that starts at
pos
and is of length
len
.
parse_url(url, partToExtract[, key])
Extracts a part from
url
.
Returns the position of the first occurrence of
substr
in
str
after position
pos
.
Returns the position of the first occurrence of
substr
in
str
after position
pos
.
Returns a formatted string from printf-style format strings.
Returns a random string of
length
alpha-numeric characters.
Returns true if
str
matches
regex
.
Returns true if
str
matches
regex
.
Returns the number of times
str
matches the
regexp
pattern.
regexp_extract(str, regexp[, idx])
Extracts the first string in
str
that matches the
regexp
expression and corresponds to the
regex
group index.
regexp_extract_all(str, regexp[, idx])
Extracts the all strings in
str
that matches the
regexp
expression and corresponds to the
regex
group index.
Returns the position of the first substring in
str
that matches
regexp
.
regexp_replace(str, regexp, rep[, position])
Replaces all substrings of
str
that match
regexp
with
rep
.
Returns the first substring in
str
that matches
regexp
.
Returns the string that repeats
expr
n
times.
replace(str, search [, replace])
Replaces all occurrences of
search
with
replace
.
Returns a reversed string or an array with reverse order of elements.
Returns the rightmost
len
characters from the string
str
.
Returns true if
str
matches
regex
.
Returns
expr
, right-padded with
pad
to a length of
len
.
Returns
str
with trailing characters removed.
sentences(str[, lang, country])
Splits
str
into an array of array of words.
Returns a sha1 hash value as a hex string of
expr
.
Returns a sha1 hash value as a hex string of
expr
.
Returns a checksum of the SHA-2 family as a hex string of
expr
.
Returns the soundex code of the string.
Returns a string consisting of
n
spaces.
Splits
str
around occurrences that match
regex
and returns an array with a length of at most
limit
.
split_part(str, delim, partNum)
Splits
str
around occurrences of
delim
and returns the
partNum
part.
Returns
true
if
expr
STRING
or
BINARY
starts with
startExpr
.
Casts the value
expr
to
STRING
.
Returns the substring of
expr
that starts at
pos
and is of length
len
.
substr(expr FROM pos[ FOR len])
Returns the substring of
expr
that starts at
pos
and is of length
len
.
Returns the substring of
expr
that starts at
pos
and is of length
len
.
substring(expr FROM pos[ FOR len])
Returns the substring of
expr
that starts at
pos
and is of length
len
.
substring_index(expr, delim, count)
Returns the substring of
expr
before
count
occurrences of the delimiter
delim
.
Returns
expr
cast to a Binary based on
fmt
.
Returns
numExpr
cast to
STRING
using formatting
fmt
.”
Returns
numExpr
cast to
STRING
using formatting
fmt
.”
Returns an
expr
where all characters in
from
have been replaced with those in
to
.
trim([[BOTH | LEADING | TRAILING] [trimStr] FROM] str)
Trim characters from a string.
try_aes_decrypt(expr, key[, mode[, padding[, aad]]])
Decrypts a binary
expr
using AES encryption, and return
NULL
in case of error.
Returns
expr
cast to
BINARY
based on
fmt
, or
NULL
if the input is invalid.
Translates a string back from
application/x-www-form-urlencoded
format, and returns
NULL
in case of error.
Returns value decompressed with Zstandard compression, or
NULL
if the input is invalid.
Returns
expr
with all characters changed to uppercase.
Returns a decoded base64 string as binary.
Converts hexadecimal
expr
to
BINARY
.
Returns
expr
with all characters changed to uppercase.
Translates a string back from application/x-www-form-urlencoded format.
Translates a string into application/x-www-form-urlencoded format.
zstd_compress (value[,level[,streaming_mode]])
Returns value compressed with Zstandard compression.
Returns value decompressed with Zstandard compression.
Returns the angle in radians between the positive x-axis of a plane and the point specified by the coordinates (
exprX
,
exprY
).
Returns inverse hyperbolic tangent of
expr
.
Casts the value
expr
to
BIGINT
.
Returns the number of bits set in the argument.
Returns the value of a bit in a binary representation of an integral numeric.
Returns the value obtained by reversing the order of the bits in the argument.
Returns the 0-based bit position of a given
BIGINT
number within a bucket.
Returns the bitmap bucket number for a given
BIGINT
number.
Returns the rounded
expr
using
HALF_EVEN
rounding mode.
Returns the cube root of
expr
.
Returns the smallest number not smaller than
expr
rounded up to
targetScale
digits relative to the decimal point.
Returns the smallest number not smaller than
expr
rounded up to
targetScale
digits relative to the decimal point.
Converts
num
from
fromBase
to
toBase
.
convert_timezone([sourceTz, ]targetTz, sourceTs)
Converts the
TIMESTAMP_NTZ
sourceTs
from the
sourceTz
time zone to
targetTz
.
Returns the cosine of
expr
.
Returns the hyperbolic cosine of
expr
.
Returns the cotangent of
expr
.
Returns the cosecant of
expr
.
Casts the value
expr
to
DECIMAL
.
Converts radians to degrees.
Returns the integral part of the division of
divisor
by
dividend
.
Casts the value
expr
to
DOUBLE
.
Returns the constant
e
.
Returns
e
to the power of
expr
.
Returns
exp(expr)
-
1
.
Returns the factorial of
expr
.
Casts the value
expr
to
FLOAT
.
Returns the largest number not smaller than
expr
rounded down to
targetScale
digits relative to the decimal point.
Returns the value of a bit in a binary representation of an integral numeric.
Returns
sqrt(expr1
*
expr1
+
expr2
*
expr2)
.
Casts the value
expr
to
INTEGER
.
Returns
true
if
expr
is
NaN
.
Returns the natural logarithm (base
e
) of
expr
.
Returns the logarithm of
expr
with
base
.
Returns
log(1
+
expr)
.
Returns the logarithm of
expr
with base
2
.
Returns the logarithm of
expr
with base
10
.
Returns the remainder after
dividend
/
divisor
.
Returns
expr1
if it’s not
NaN
, or
expr2
otherwise.
Returns the negated value of
expr
.
‘ nullifzero(expr) ’
Returns
expr
if it is not zero, or
NULL
otherwise.
Returns pi.
Returns the positive remainder after
dividend
/
divisor
.
Returns the value of
expr
.
Raises
expr1
to the power of
expr2
.
Raises
expr1
to the power of
expr2
.
Converts
expr
in degrees to radians.
Returns a random value between 0 and 1.
Returns a random value from a standard normal distribution.
Returns a random value between 0 and 1.
Returns
expr
rounded to a whole number as a
DOUBLE
.
Returns the rounded
expr
using
HALF_UP
rounding mode.
Returns the secant of
expr
.
Returns a bitwise left shifted by
n
bits.
Returns a bitwise signed signed integral number right shifted by
n
bits.
Returns a bitwise unsigned signed integral number right shifted by
n
bits.
Returns -1.0, 0.0, or 1.0 as
expr
is negative, 0, or positive.
Returns -1.0, 0.0, or 1.0 as
expr
is negative, 0, or positive.
Returns the sine of
expr
.
Returns the hyperbolic sine of
expr
.
Casts the value
expr
to
SMALLINT
.
Returns the square root of
expr
.
Returns the tangent of
expr
.
Returns the hyperbolic tangent of
expr
.
Casts
expr
to
TINYINT
.
Returns
expr
cast to
DECIMAL
using formatting
fmt
.
Returns the sum of
expr1
and
expr2
, or
NULL
in case of error.
Returns
dividend
divided by
divisor
, or
NULL
if
divisor
is 0.
Returns the remainder after
dividend
/
divisor
, or
NULL
if
divisor
is 0..
try_multiply(multiplier, multiplicand)
Returns
multiplier
multiplied by
multiplicand
, or
NULL
on overflow.
Returns the subtraction of
expr2
from
expr1
, or
NULL
on overflow.
Returns
expr
cast to
DECIMAL
using formatting
fmt
, or
NULL
if
expr
does not match the format.
Returns a random value with independent and identically distributed values within the specified range of numbers.
width_bucket(expr, minExpr, maxExpr, numBuckets)
Returns the bucket number for a value in an equi-width histogram.
‘ zeroifnull(expr) ’
Returns
expr
if it is not
NULL
, or
0
otherwise.
Returns true if at least one value of
expr
in the group is true.
Returns some value of
expr
for a group of rows.
approx_count_distinct(expr[,relativeSD])
Returns the estimated number of distinct values in
expr
within the group.
approx_percentile(expr,percentage[,accuracy])
Returns the approximate percentile of the
expr
within the group.
approx_top_k(expr[,k[,maxItemsTracked]])
Returns the top
k
most frequently occurring item values in an
expr
along with their approximate counts.
Returns an array consisting of all values in
expr
within the group.
Returns the mean calculated from values of a group.
Returns the bitwise
AND
of all input values in the group.
Returns the bitwise
OR
of all input values in the group.
Returns the bitwise
XOR
of all input values in the group.
Returns the bitwise
OR
of all bit position values in the group. between 0 and 32767 in a group as a
BINARY
.
Returns the bitwise
OR
of all
BINARY
input values in the group.
Returns true if all values in
expr
are true within the group.
Returns true if at least one value in
expr
is true within the group.
Returns an array consisting of all values in
expr
within the group.
Returns an array consisting of all unique values in
expr
within the group.
Returns Pearson coefficient of correlation between a group of number pairs.
Returns the total number of retrieved rows in a group, including rows containing null.
Returns the number of rows in a group for which the supplied expressions are all non-null.
Returns the number of true values for the group in
expr
.
count_min_sketch(column,epsilon,confidence,seed)
Returns a count-min sketch of all values in the group in
column
with the
epsilon
,
confidence
and
seed
.
Returns the population covariance of number pairs in a group.
Returns the sample covariance of number pairs in a group.
Returns true if all values of
expr
in the group are true.
Returns the first value of
expr
for a group of rows.
first_value(expr[,ignoreNull])
Returns the first value of
expr
for a group of rows.
histogram_numeric(expr,numBins)
Computes a histogram on
expr
with
numBins
bins, returning an array of pairs representing the bin centers.
hll_sketch_agg(expr[,lgConfigK])
Returns a HyperLogLog sketch used to approximate a distinct values count.
hll_union_agg(expr[,allowDifferentLgConfigK])
Aggregates HyperLogLog sketches for a group of rows.
Returns the kurtosis value calculated from values of a group.
Returns the last value of
expr
for the group of rows.
Returns the last value of
expr
for the group of rows.
Returns the maximum value of
expr
in a group.
Returns the value of an
expr1
associated with the maximum value of
expr2
in a group.
Returns the mean calculated from values of a group.
Returns the median calculated from values of a group.
Returns the minimum value of
expr
in a group.
Returns the value of an
expr1
associated with the minimum value of
expr2
in a group.
Returns the most frequent, not
NULL
, value of
expr
in a group.
percentile(expr, percentage [,frequency])
Returns the exact percentile value of
expr
at the specified
percentage
.
percentile_approx(expr,percentage[,accuracy])
Returns the approximate percentile of the
expr
within the group.
percentile_cont(pct) WITHIN GROUP (ORDER BY key)
Returns the interpolated percentile of the
key
within the group.
percentile_disc(pct) WITHIN GROUP (ORDER BY key)
Returns the discrete percentile of the
key
within the group.
Returns the mean of
xExpr
calculated from values of a group where
xExpr
and
yExpr
are
NOT
NULL
.
Returns the mean of
yExpr
calculated from values of a group where
xExpr
and
yExpr
are
NOT
NULL
.
Returns the number of non-null value pairs
yExpr
,
xExpr
in the group.
Returns the intercept of the uni-variate linear regression line in a group where
xExpr
and
yExpr
are NOT NULL.
Returns the coefficient of determination from values of a group where
xExpr
and
yExpr
are NOT NULL.
Returns the slope of the linear regression line of non-null value pairs
yExpr
,
xExpr
in the group.
Returns the sum of squares of the
xExpr
values of a group where
xExpr
and
yExpr
are NOT NULL.
Returns the sum of products of
yExpr
and
xExpr
calculated from values of a group where
xExpr
and
yExpr
are
NOT
NULL
.
Returns the sum of squares of the
yExpr
values of a group where
xExpr
and
yExpr
are NOT NULL.
schema_of_json_agg(json[, options])
Returns the combined schema of
JSON
strings in a group in DDL format.
schema_of_variant_agg(variantExpr)
Returns the combined schema of all
VARIANT
values in a group in DDL format.
Returns the skewness value calculated from values of a group.
Returns true if at least one value of
expr
in a group is
true
.
Returns the sample standard deviation calculated from the values within the group.
Returns the sample standard deviation calculated from the values within the group.
Returns the population standard deviation calculated from values of a group.
Returns the sample standard deviation calculated from values of a group.
Returns the sum calculated from values of a group.
Returns the mean calculated from values of a group,
NULL
if there is an overflow.
Returns the sum calculated from values of a group,
NULL
if there is an overflow.
Returns the population variance calculated from values of a group.
Returns the sample variance calculated from values of a group.
Returns the sample variance calculated from values of a group.
Divides the rows for each window partition into n buckets ranging from 1 to at most
n
.
Computes the percentage ranking of a value within the partition.
Returns the rank of a value compared to all values in the partition.
Assigns a unique, sequential number to each row, starting with one, according to the ordering of rows within the window partition.
Returns the position of a value relative to all values in the partition.
Returns the value of
expr
from a preceding row within the partition.
Returns the value of
expr
from a subsequent row within the partition.
nth_value(expr, offset[, ignoreNulls])
Returns the value of
expr
at a specific
offset
in the window.
Returns element at position
indexExpr
of ARRAY
arrayExpr
.
aggregate(expr,start,merge[,finish])
Aggregates elements in an array using a custom aggregator.
Returns an array with the elements in
expr
.
Returns
array
appended by
elem
.
Removes NULL values from
array
.
Returns true if
array
contains
value
.
Removes duplicate values from
array
.
Returns an array of the elements in
array1
but not in
array2
.
array_insert(array, index, elem)
Returns an expanded
array
where
elem
is inserted at the
index
position.
array_intersect(array1,array2)
Returns an array of the elements in the intersection of
array1
and
array2
.
array_join(array,delimiter[,nullReplacement])
Concatenates the elements of
array
.
Returns the maximum value in
array
.
Returns the minimum value in
array
.
Returns the position of the first occurrence of
element
in
array
.
Returns
array
prepended by
elem
.
Removes all occurrences of
element
from
array
.
Returns an array containing
element
count
times.
Returns the number of elements in
array
.
Returns
array
sorted according to
func
.
Returns an array of the elements in the union of
array1
and
array2
without duplicates.
arrays_overlap(array1, array2)
Returns true if the intersection of
array1
and
array2
is not empty.
Returns a merged array of structs in which the nth struct contains all Nth values of input arrays.
Returns the size of
expr
.
Returns the concatenation of the arguments.
Returns the element of an
arrayExpr
at
index
.
Returns true if
pred
is true for any element in
expr
.
Returns rows by un-nesting
collection
.
Returns rows by un-nesting
collection
using outer semantics.
Filters the array in
expr
using the function
func
.
Transforms an array of arrays into a single array.
Tests whether
predFunc
holds for all elements in the array.
Returns the element of an
arrayExpr
at
index
, starting at
0
.
Explodes an array of structs into a table.
Explodes an array of structs into a table with outer semantics.
Returns rows by un-nesting the array with numbering of positions.
Returns rows by un-nesting the array with numbering of positions using
OUTER
semantics.
reduce(expr,start,merge[,finish])
Aggregates elements in an array using a custom aggregator.
Returns a reversed string or an array with reverse order of elements.
Generates an array of elements from
start
to
stop
(inclusive), incrementing by
step
.
Returns a random permutation of the array in
expr
.
Returns the cardinality of
expr
.
Returns a subset of an array.
sort_array(expr[,ascendingOrder])
Returns the array in
expr
in sorted order.
Transforms elements in an array in
expr
using the function
func
.
try_element_at(arrayExpr, index)
Returns the element of an
arrayExpr
at
index
, or
NULL
if
index
is out of bound.
Merges the arrays in
expr1
and
expr2
, element-wise, into a single array using
func
.
Filters entries in the map in
expr
using the function
func
.
Creates a map with a pair of the
keys
and
values
arrays.
Creates a map created from the specified array of entries.
Returns an unordered array containing the keys of
map
.
Returns an unordered array containing the values of
map
.
map_zip_with(map1, map2, func)
Merges
map1
and
map2
into a single map.
Returns the cardinality of
expr
.
str_to_map(expr[,pairDelim[,keyValueDelim]])
Returns a map after splitting
expr
into key-value pairs using delimiters.
Transforms keys in a map in
expr
using the function
func
.
Transforms values in a map in
expr
using the function
func
.
Returns the value of
mapExpr
for
key
, or
NULL
if
key
does not exist.
Returns the subtraction of
intervalExpr2
from
intervalExpr1
.
Returns the subtraction of
datetimeExpr2
from
datetimeExpr1
.
Returns the value of
intervalExpr
.
Returns the sum of
intervalExpr1
and
intervalExpr2
.
Returns
intervalExpr
multiplied by
multiplicand
.
Returns the absolute value of the interval value in
expr
.
add_months(startDate,numMonths)
Returns the date that is
numMonths
after
startDate
.
Returns the current date at the start of query evaluation.
Returns the current date at the start of query evaluation.
Returns the current timestamp at the start of query evaluation.
Returns the current session local timezone.
Casts the value
expr
to DATE.
Returns the date
numDays
after
startDate
.
Adds
value
unit
s to a timestamp
expr
.
Returns the difference between two timestamps measured in
unit
s.
Converts a timestamp to a string in the format
fmt
.
Creates a date from the number of days since
1970-01-01
.
Extracts a part of the date, timestamp, or interval.
Returns the date
numDays
before
startDate
.
Returns timestamp truncated to the unit specified in
unit
.
Returns the date
numDays
after
startDate
.
Adds
value
unit
s to a timestamp
expr
.
Returns the number of days from
startDate
to
endDate
.
Returns the difference between two timestamps measured in
unit
s.
Returns the day of month of the date or timestamp.
Returns the three-letter english acronym for the day of the week for the given date.
Returns the day of month of the date or timestamp.
Returns the day of week of the date or timestamp.
Returns the day of year of the date or timestamp.
Returns the integral part of the division of interval
divisor
by interval
dividend
.
Returns
field
of
source
.
Returns
unixTime
in
fmt
.
from_utc_timestamp(expr,timezone)
Returns the timestamp at
UTC
for a timestamp
expr
at
timeZone
.
Returns the current timestamp at the start of query evaluation.
Returns the hour component of a timestamp.
Returns the last day of the month that the date belongs to.
Creates a date from
year
,
month
, and
day
fields.
make_dt_interval([days[, hours[, mins[, secs]]]])
Creates an day-time interval from
days
,
hours
,
mins
and
secs
.
make_interval(years, months, weeks, days, hours, mins, secs)
Deprecated: Creates an interval from
years
,
months
,
weeks
,
days
,
hours
,
mins
and
secs
.
make_timestamp(year,month,day,hour,min,sec[,timezone])
Creates a timestamp from
year
,
month
,
day
,
hour
,
min
,
sec
, and
timezone
fields.
make_ym_interval([years[, months]])
Creates a year-month interval from
years
, and
months
.
Returns the minute component of the timestamp in
expr
.
Returns the month component of the timestamp in
expr
.
months_between(expr1,expr2[,roundOff])
Returns the number of months elapsed between dates or timestamps in
expr1
and
expr2
.
Returns the first date which is later than
expr
and named as in
dayOfWeek
.
Returns the current timestamp at the start of query evaluation.
Returns the quarter of the year for
expr
in the range 1 to 4.
Returns the second component of the timestamp in
expr
.
session_window(expr, gpDuration)
Creates a session-window over a timestamp expression.
Returns -1.0, 0.0, or 1.0 as interval
expr
is negative, 0, or positive.
Returns -1.0, 0.0, or 1.0 as interval
expr
is negative, 0, or positive.
Returns the difference between two timestamps measured in
unit
s.
Casts
expr
to
TIMESTAMP
.
Creates a timestamp
expr
microseconds since UTC epoch.
Creates a timestamp
expr
milliseconds since UTC epoch.
Creates timestamp
expr
seconds since UTC epoch.
timestampadd(unit, value, expr)
Adds
value
unit
s to a timestamp
expr
.
timestampdiff(unit, start, stop)
Returns the difference between two timestamps measured in
unit
s.
Returns
expr
cast to a date using an optional formatting.
Returns
expr
cast to a timestamp using an optional formatting.
Returns the timestamp in
expr
as a UNIX timestamp.
to_utc_timestamp(expr,timezone)
Returns the timestamp at
UTC
for a timestamp
expr
at
timezone
.
Returns a date with the a portion of the date truncated to the unit specified by the format model
fmt
.
Returns the sum of
expr1
and
expr2
, or NULL in case of error.
Returns
dividend
divided by
divisor
, or NULL if
divisor
is 0.
try_multiply(multiplier, multiplicand)
Returns
multiplier
multiplied by
multiplicand
, or
NULL
on overflow.
Returns the subtraction of
expr2
from
expr1
, or
NULL
on overflow.
Returns
expr
cast to a timestamp using an optional formatting, or
NULL
if the cast fails.
Returns the number of days since
1970-01-01
.
Returns the number of microseconds since
1970-01-01
00:00:00
UTC
.
Returns the number of milliseconds since
1970-01-01
00:00:00
UTC
.
Returns the number of seconds since
1970-01-01
00:00:00
UTC
.
eturns the UNIX timestamp of current or specified time.
Returns the day of the week of
expr
.
Returns the week of the year of
expr
.
Returns the year component of
expr
.
window(expr, width[, step[, start]])
Creates a hopping based sliding-window over a timestamp expression.
Returns the inclusive end time of a sliding-window produced by the window or session_window functions.
For information about H3 geospatial functions, see H3 geospatial functions .
For information on casting between types, see cast function and try_cast function .
Creates a date from
year
,
month
, and
day
fields.
make_dt_interval([days[, hours[, mins[, secs]]]])
Creates an day-time interval from
days
,
hours
,
mins
and
secs
.
make_interval(years, months, weeks, days, hours, mins, secs)
Creates an interval from
years
,
months
,
weeks
,
days
,
hours
,
mins
and
secs
.
make_timestamp(year,month,day,hour,min,sec[,timezone])
Creates a timestamp from
year
,
month
,
day
,
hour
,
min
,
sec
, and
timezone
fields.
make_ym_interval([years[, months]])
Creates a year-month interval from
years
, and
months
.
Creates a map with the specified key-value pairs.
named_struct({name1, val1} [, …])
Creates a struct with the specified field names and values.
Casts the value
expr
to
SMALLINT
.
Casts the value
expr
to
STRING
.
Creates a
STRUCT
with the specified field values.
Casts
expr
to
TINYINT
.
Casts
expr
to
TIMESTAMP
.
Returns
expr
cast to
STRING
using formatting
fmt
.”
Returns
expr
cast to a date using an optional formatting.
Returns
expr
cast to
DECIMA
L using formatting
fmt
.
Returns
expr
cast to a timestamp using an optional formatting.
Returns
expr
cast to
STRING
using formatting
fmt
.”
Casts the value
expr
to the target data type
type
safely.
Returns
expr
cast to
DECIMAL
using formatting
fmt
, or
NULL
if
expr
is not a valid.
from_avro(avroBin, jsonSchema[, options])
Returns a struct value based on
avroBin
and
jsonSchema
.
from_csv(csvStr, schema[, options])
Returns a struct value with the
csvStr
and
schema
.
Returns the schema of a CSV string in DDL format.
Returns an Avro binary value with the specified struct value.
Returns a CSV string with the specified struct value.
from_json(jsonStr, schema[, options])
Returns a struct value with the
jsonStr
and
schema
.
Extracts a
JSON
object from
path
.
Returns the number of elements in the outermost
JSON
array.
Returns all the keys of the outermost
JSON
object as an array.
json_tuple(jsonStr, path1 [, …])
Returns multiple
JSON
objects as a tuple.
Returns a
VARIANT
value from the
jsonStr
.
schema_of_json(jsonStr[, options])
Returns the schema of a
JSON
string in DDL format.
schema_of_json_agg(jsonStr[, options])
Returns the combined schema of
JSON
strings in a group in DDL format.
Returns a JSON string with the
STRUCT
or
VARIANT
specified in
expr
.
Returns fields extracted from the
variantExpr
using JSON path.
Tests whether
variantExpr
is a
VARIANT
-encoded
NULL
.
Returns a
VARIANT
value from the
jsonStr
.
schema_of_variant(variantExpr)
Returns the schema of a
VARIANT
expression in DDL format.
schema_of_variant_agg(variantExpr)
Returns the combined schema of all
VARIANT
values in a group in DDL format.
Returns a JSON string with the
STRUCT
or
VARIANT
specified in
expr
.
Returns a
VARIANT
value from the
jsonStr
if possible. If not possible,
NULL
is returned.
try_variant_get(variantExpr,path,type)
Extracts a value of
type
type from
variantExpr
, specified by
path
, or
NULL
if it is not possible to cast to the target type.
Returns a set of rows by un-nesting
input
.
Returns a set of rows by un-nesting
input
using outer semantics.
variant_get(variantExpr,path,type)
Extracts a value of
type
type from
variantExpr
, specified by
path
.
from_xml(xmlStr, schema[, options])
Returns a struct value parsed from the
xmlStr
using
schema
.
schema_of_xml(xmlStr[, options])
Returns the schema of a
XML
string in DDL format.
Returns values within the nodes of
xml
that match
xpath
.
Returns
true
if the
xpath
expression evaluates to
true
, or if a matching node in
xml
is found.
Returns a
DOUBLE
value from an XML document.
Returns a
FLOAT
value from an XML document.
Returns a
INTEGER
value from an XML document.
Returns a
BIGINT
value from an XML document.
Returns a
DOUBLE
value from an XML document.
Returns a
SHORT
value from an XML document.
Returns the contents of the first XML node that matches the XPath expression.
Classifies the provided content into one of the provided labels.
Extracts entities specified by labels from a given text.
Corrects grammatical errors in a given text.
ai_forecast(observed, time_col)
Extropolates time series data into the future.
Invokes a state-of-the-art generative AI model from Databricks Foundation Model APIs to answer the user-provided prompt.
ai_generate_text(prompt, modelName[, param1, value1] […])
Deprecated: Returns text generated by a selected large language model (LLM) given the prompt.
Masks specified entities within a given text.
ai_query(endpointName, request, returnType)
Invokes an existing Mosaic AI Model Serving endpoint and parses and returns its response.
ai_similarity(strExpr1, strExpr2)
Compares two strings and computes the semantic similarity score.
ai_summarize(content[, max_words])
Generates a summary of a given text.
ai_translate(content, to_lang)
Translates text to a specified target language.
vector_search(index, query, num_results)
Query a Mosaic AI Vector Search index using SQL.
read_files(path, [optionKey => optionValue] [, …])
Reads data files on cloud storage and returns it in tabular format.
read_kafka([optionKey => optionValue] [, …])
Reads records from an Apache Kafka cluster and returns it in tabular format.
read_kinesis({parameter => value} [, …])
Returns a table with records read from Kinesis from one or more streams.
read_pubsub([parameter => value] [, …])
A table valued function for reading records from Pub/Sub from a topic.
read_pulsar({optionKey => optionValue} [, …])
Returns a table with records read from Pulsar.
Returns a table with rows that represent the metadata of a streaming query state.
read_statestore(path [, option_key => option_value] […])
Returns records from the state store of streaming queries.
Returns an error if
expr
is not true.
CASE expr { WHEN opt1 THEN res1 } […] [ELSE def] END
Returns
resN
for the first
optN
that equals
expr
or
def
if none matches.
CASE { WHEN cond1 THEN res1 } […] [ELSE def] END
Returns
resN
for the first
condN
that evaluates to true, or
def
if none found.
cloud_files_state( { TABLE(table) | checkpoint } )
Returns the file-level state of an autoloader
cloud_files
source.
Returns the first non-null argument.
Returns the list of available collations.
Creates a multi-dimensional cube using the specified expression columns.
Returns the current catalog.
Returns the current schema.
Returns the current Unity Catalog Metastore id.
Returns a property for the current recipient in a view shared with Delta Sharing.
Returns the current schema.
Returns the user executing the statement.
Returns the current version of Databricks.
decode(expr, { key, value } [, …] [,defValue])
Returns the value matching the key.
Returns the nth expression.
Returns
true
if
expr1
equals
expr2
or both expressions are
NULL
, or
false
otherwise.
event_log( { TABLE(table) | pipeline_id } )
Returns a table of the refresh history for a materialized view, streaming table, or DLT pipeline.
Returns the largest value of all arguments, skipping null values.
Indicates whether a specified column in a
GROUPING
SET
,
ROLLUP
, or
CUBE
represents a subtotal.
Returns the level of grouping for a set of columns.
Returns a hashed value of the arguments.
Estimates number of distinct values collected in a HyperLogLog sketch.
hll_union(expr1, expr2 [,allowDifferentLgConfigK])
Combines two HyperLogLog sketches.
java_method(class, method[, arg1 [, …]])
Calls a method with reflection.
Returns
expr1
if
cond
is
true
, or
expr2
otherwise.
Returns
expr1
if
cond
is
true
, or
expr2
otherwise.
Returns
expr2
if
expr1
is
NULL
, or
expr1
otherwise.
Returns the length in bytes of the block being read.
Returns the start offset in bytes of the block being read.
Returns the name of the file being read, or empty string if not available.
is_account_group_member(group)
Returns true if the current user is a member of group at the account level.
Returns true if the current user is a member of group at the workspace level.
Returns
true
if
expr
is
NULL
.
Returns
true
if
expr
is not
NULL
.
Returns the smallest value of all arguments, skipping null values.
Returns the keys in all or one scope which the user is authorized to see from Databricks secret service .
Returns
true
if
numStr
passes the
Luhn algorithm
check.
Returns monotonically increasing 64-bit integers.
Returns
NULL
if
expr1
equals
expr2
, or
expr1
otherwise.
Returns
expr2
if
expr1
is
NULL
, or
expr1
otherwise.
Returns
expr2
if
expr1
is not
NULL
, or
expr3
otherwise.
Throws an exception with
expr
as the message.
Returns a table of values within a specified range.
range(start, end [, step [, numParts]])
Returns a table of values within a specified range.
reflect(class, method[, arg1 [, …]])
Calls a method with reflection.
Extracts a secret value with the given
scope
and
key
from
Databricks secret service
.
Returns the user connected to Databricks.
Returns the current partition ID.
Returns the set of SQL keywords in Databricks.
Separates
expr1
, …,
exprN
into
numRows
rows.
table_changes(table_str, start [, end])
Returns a log of changes to a Delta Lake table with Change Data Feed enabled.
try_reflect(class, method[, arg1 [, …]])
Calls a method with reflection, returning
NULL
if the method fails.
Extracts a secret value with the given
scope
and
key
from
Databricks secret service
, or
NULL
if the key cannot be retrieved.
Return a DDL-formatted type string for the data type of
expr
.
Returns the user executing the statement.
Returns an universally unique identifier (UUID) string.
window(expr, width[, step [, start]])
Creates a hopping based sliding-window over a timestamp expression.
Returns a 64-bit hashed value of the arguments.
Returns the Apache Spark version.
细心的桔子 · Error: Invalid string. Length must be a multiple of 4 · Issue #177 · CosmWasm/CosmWasmJS · GitHub 3 天前 |
想发财的火腿肠 · 香港艺人集体吸毒事件_百度百科 2 月前 |
酷酷的便当 · 每周招商动态(84)_周口市人民政府 3 月前 |
刚毅的火柴 · Angela Yuen 袁澧林的新生活卜口 4 月前 |