Skip to content

Conversation

@izveigor
Copy link
Contributor

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?

@github-actions github-actions bot added the logical-expr Logical plan and expressions label Apr 12, 2023
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 | |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

select struct('soo');
+---------------------+
| struct(Utf8("soo")) |
+---------------------+
| {c0: soo}           |
+---------------------+

Wow that is a wild funtion 🤔

@alamb alamb merged commit 1646bf6 into apache:main Apr 13, 2023
@alamb
Copy link
Contributor

alamb commented Apr 13, 2023

Thanks @izveigor !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

logical-expr Logical plan and expressions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve expressions.md

2 participants