diff --git a/docs/source/user-guide/sql/aggregate_functions.md b/docs/source/user-guide/sql/aggregate_functions.md index fe6a61e74e62..ecd0cb5b79b6 100644 --- a/docs/source/user-guide/sql/aggregate_functions.md +++ b/docs/source/user-guide/sql/aggregate_functions.md @@ -24,9 +24,6 @@ Aggregate functions operate on a set of values to compute a single result. ## General - [avg](#avg) -- [bit_and](#bit_and) -- [bit_or](#bit_or) -- [bit_xor](#bit_xor) - [bool_and](#bool_and) - [bool_or](#bool_or) - [count](#count) @@ -56,45 +53,6 @@ avg(expression) - `mean` -### `bit_and` - -Computes the bitwise AND of all non-null input values. - -``` -bit_and(expression) -``` - -#### Arguments - -- **expression**: Expression to operate on. - Can be a constant, column, or function, and any combination of arithmetic operators. - -### `bit_or` - -Computes the bitwise OR of all non-null input values. - -``` -bit_or(expression) -``` - -#### Arguments - -- **expression**: Expression to operate on. - Can be a constant, column, or function, and any combination of arithmetic operators. - -### `bit_xor` - -Computes the bitwise exclusive OR of all non-null input values. - -``` -bit_xor(expression) -``` - -#### Arguments - -- **expression**: Expression to operate on. - Can be a constant, column, or function, and any combination of arithmetic operators. - ### `bool_and` Returns true if all non-null input values are true, otherwise false. diff --git a/docs/source/user-guide/sql/scalar_functions.md b/docs/source/user-guide/sql/scalar_functions.md index 3e481db90c22..de15b3dd33d8 100644 --- a/docs/source/user-guide/sql/scalar_functions.md +++ b/docs/source/user-guide/sql/scalar_functions.md @@ -42,7 +42,6 @@ - [iszero](#iszero) - [lcm](#lcm) - [ln](#ln) -- [log](#log) - [log10](#log10) - [log2](#log2) - [nanvl](#nanvl) @@ -339,23 +338,6 @@ ln(numeric_expression) - **numeric_expression**: Numeric expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators. -### `log` - -Returns the base-x logarithm of a number. -Can either provide a specified base, or if omitted then takes the base-10 of a number. - -``` -log(base, numeric_expression) -log(numeric_expression) -``` - -#### Arguments - -- **base**: Base numeric expression to operate on. - Can be a constant, column, or function, and any combination of arithmetic operators. -- **numeric_expression**: Numeric expression to operate on. - Can be a constant, column, or function, and any combination of arithmetic operators. - ### `log10` Returns the base-10 logarithm of a number. @@ -567,29 +549,11 @@ trunc(numeric_expression[, decimal_places]) ## Conditional Functions -- [coalesce](#coalesce) - [nullif](#nullif) - [nvl](#nvl) - [nvl2](#nvl2) - [ifnull](#ifnull) -### `coalesce` - -Returns the first of its arguments that is not _null_. -Returns _null_ if all arguments are _null_. -This function is often used to substitute a default value for _null_ values. - -``` -coalesce(expression1[, ..., expression_n]) -``` - -#### Arguments - -- **expression1, expression_n**: - Expression to use if previous expressions are _null_. - Can be a constant, column, or function, and any combination of arithmetic operators. - Pass as many expression arguments as necessary. - ### `nullif` Returns _null_ if _expression1_ equals _expression2_; otherwise it returns _expression1_. @@ -646,102 +610,18 @@ _Alias of [nvl](#nvl)._ See the new documentation [`here`](https://datafusion.apache.org/user-guide/sql/scalar_functions_new.html) -## Binary String Functions - -- [decode](#decode) -- [encode](#encode) - -### `encode` - -Encode binary data into a textual representation. - -``` -encode(expression, format) -``` - -#### Arguments - -- **expression**: Expression containing string or binary data - -- **format**: Supported formats are: `base64`, `hex` - -**Related functions**: -[decode](#decode) - -### `decode` - -Decode binary data from textual representation in string. - -``` -decode(expression, format) -``` - -#### Arguments - -- **expression**: Expression containing encoded string data - -- **format**: Same arguments as [encode](#encode) - -**Related functions**: -[encode](#encode) - ## Regular Expression Functions Apache DataFusion uses a [PCRE-like] regular expression [syntax] (minus support for several features including look-around and backreferences). The following regular expression functions are supported: -- [regexp_like](#regexp_like) - [regexp_match](#regexp_match) - [regexp_replace](#regexp_replace) [pcre-like]: https://en.wikibooks.org/wiki/Regular_Expressions/Perl-Compatible_Regular_Expressions [syntax]: https://docs.rs/regex/latest/regex/#syntax -### `regexp_like` - -Returns true if a [regular expression] has at least one match in a string, -false otherwise. - -[regular expression]: https://docs.rs/regex/latest/regex/#syntax - -``` -regexp_like(str, regexp[, flags]) -``` - -#### Arguments - -- **str**: String expression to operate on. - Can be a constant, column, or function, and any combination of string operators. -- **regexp**: Regular expression to test against the string expression. - Can be a constant, column, or function. -- **flags**: Optional regular expression flags that control the behavior of the - regular expression. The following flags are supported: - - **i**: case-insensitive: letters match both upper and lower case - - **m**: multi-line mode: ^ and $ match begin/end of line - - **s**: allow . to match \n - - **R**: enables CRLF mode: when multi-line mode is enabled, \r\n is used - - **U**: swap the meaning of x* and x*? - -#### Example - -```sql -select regexp_like('Köln', '[a-zA-Z]ö[a-zA-Z]{2}'); -+--------------------------------------------------------+ -| regexp_like(Utf8("Köln"),Utf8("[a-zA-Z]ö[a-zA-Z]{2}")) | -+--------------------------------------------------------+ -| true | -+--------------------------------------------------------+ -SELECT regexp_like('aBc', '(b|d)', 'i'); -+--------------------------------------------------+ -| regexp_like(Utf8("aBc"),Utf8("(b|d)"),Utf8("i")) | -+--------------------------------------------------+ -| true | -+--------------------------------------------------+ -``` - -Additional examples can be found [here](https://github.com/apache/datafusion/blob/main/datafusion-examples/examples/regexp.rs) - ### `regexp_match` Returns a list of [regular expression](https://docs.rs/regex/latest/regex/#syntax) matches in a string. @@ -855,7 +735,6 @@ position(substr in origstr) - [today](#today) - [make_date](#make_date) - [to_char](#to_char) -- [to_date](#to_date) - [to_local_time](#to_local_time) - [to_timestamp](#to_timestamp) - [to_timestamp_millis](#to_timestamp_millis) @@ -1103,49 +982,6 @@ Additional examples can be found [here] - date_format -### `to_date` - -Converts a value to a date (`YYYY-MM-DD`). -Supports strings, integer and double types as input. -Strings are parsed as YYYY-MM-DD (e.g. '2023-07-20') if no [Chrono format]s are provided. -Integers and doubles are interpreted as days since the unix epoch (`1970-01-01T00:00:00Z`). -Returns the corresponding date. - -Note: `to_date` returns Date32, which represents its values as the number of days since unix epoch(`1970-01-01`) stored as signed 32 bit value. The largest supported date value is `9999-12-31`. - -``` -to_date(expression[, ..., format_n]) -``` - -#### Arguments - -- **expression**: Expression to operate on. - Can be a constant, column, or function, and any combination of arithmetic operators. -- **format_n**: Optional [Chrono format] strings to use to parse the expression. Formats will be tried in the order - they appear with the first successful one being returned. If none of the formats successfully parse the expression - an error will be returned. - -[chrono format]: https://docs.rs/chrono/latest/chrono/format/strftime/index.html - -#### Example - -``` -> select to_date('2023-01-31'); -+-----------------------------+ -| to_date(Utf8("2023-01-31")) | -+-----------------------------+ -| 2023-01-31 | -+-----------------------------+ -> select to_date('2023/01/31', '%Y-%m-%d', '%Y/%m/%d'); -+---------------------------------------------------------------+ -| to_date(Utf8("2023/01/31"),Utf8("%Y-%m-%d"),Utf8("%Y/%m/%d")) | -+---------------------------------------------------------------+ -| 2023-01-31 | -+---------------------------------------------------------------+ -``` - -Additional examples can be found [here](https://github.com/apache/datafusion/blob/main/datafusion-examples/examples/to_date.rs) - ### `to_local_time` Converts a timestamp with a timezone to a timestamp without a timezone (with no offset or @@ -3226,7 +3062,6 @@ select map_values(map([100, 5], [42,43])); - [digest](#digest) - [md5](#md5) -- [sha224](#sha224) - [sha256](#sha256) - [sha384](#sha384) - [sha512](#sha512) @@ -3265,19 +3100,6 @@ md5(expression) #### Arguments -- **expression**: String expression to operate on. - Can be a constant, column, or function, and any combination of string operators. - -### `sha224` - -Computes the SHA-224 hash of a binary string. - -``` -sha224(expression) -``` - -#### Arguments - - **expression**: String expression to operate on. Can be a constant, column, or function, and any combination of string operators. diff --git a/docs/source/user-guide/sql/window_functions.md b/docs/source/user-guide/sql/window_functions.md index 4d9d2557249f..3246a87bb193 100644 --- a/docs/source/user-guide/sql/window_functions.md +++ b/docs/source/user-guide/sql/window_functions.md @@ -140,19 +140,10 @@ All [aggregate functions](aggregate_functions.md) can be used as window function ## Ranking functions -- [row_number](#row_number) - [rank](#rank) - [dense_rank](#dense_rank) - [ntile](#ntile) -### `row_number` - -Number of the current row within its partition, counting from 1. - -```sql -row_number() -``` - ### `rank` Rank of the current row with gaps; same as row_number of its first peer.