docs: improve expressions.md#5978
Merged
alamb merged 4 commits intoapache:mainfrom Apr 13, 2023
izveigor:expressions
Merged
Conversation
alamb
approved these changes
Apr 12, 2023
Contributor
alamb
left a comment
There was a problem hiding this comment.
Thank you @izveigor ❤️
I am not sure if you are interested or have time, but I wonder if you are interested in a project like #3092
(basically I think it would require some non trivial rearrangement of the function definitions so the metadata was defined in a struct rather than a bunch of match statements).
| | left(text, number) | Returns a certain number (`number`) of first characters (`text`). Example: `left('like', 2) -> li` | | ||
| | length(text) | Returns number of characters in the string (`text`). The same as `character_length` and `char_length`. Example: `length('lion') -> 4` | | ||
| | lower(text) | Converts all characters in the string (`text`) into lower case. Example: `lower('HELLO') -> hello` | | ||
| | lpad(text, length, [, fill]) | Extends the string to length (`lenght`) by prepending the characters (`fill`) (a space by default). Example: `lpad('bb', 5, 'a') → aaabb` | |
Contributor
There was a problem hiding this comment.
Suggested change
| | lpad(text, length, [, fill]) | Extends the string to length (`lenght`) by prepending the characters (`fill`) (a space by default). Example: `lpad('bb', 5, 'a') → aaabb` | | |
| | lpad(text, length, [, fill]) | Extends the string to length (`length`) by prepending the characters (`fill`) (a space by default). Example: `lpad('bb', 5, 'a') → aaabb` | |
| | upper | | | ||
| | Function | Notes | | ||
| | ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | ascii(character) | Returns a numeric representation of the character (`character`). Example: `ascii('a') -> 97` | |
Contributor
There was a problem hiding this comment.
At least some of these functions are already covered in https://arrow.apache.org/datafusion/user-guide/sql/scalar_functions.html#string-functions
However, I see this is for the expression syntax. 🤔
| | sha256(text) | Computes the SHA256 hash of the argument (`text`). | | ||
| | sha384(text) | Computes the SHA384 hash of the argument (`text`). | | ||
| | sha512(text) | Computes the SHA512 hash of the argument (`text`). | | ||
| | struct | | |
Contributor
There was a problem hiding this comment.
❯ select struct('soo');
+---------------------+
| struct(Utf8("soo")) |
+---------------------+
| {c0: soo} |
+---------------------+Wow that is a wild funtion 🤔
Contributor
|
Thanks @izveigor ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #5977
Rationale for this change
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?