-
Notifications
You must be signed in to change notification settings - Fork 633
feat(expr): support VARIADIC function arguments #14753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
format
and concat_ws
Signed-off-by: Runji Wang <[email protected]>
f74254e
to
4cb34e1
Compare
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
proto/expr.proto
Outdated
JSONB_EXTRACT_PATH = 613; | ||
JSONB_EXTRACT_PATH = 626; | ||
JSONB_EXTRACT_PATH_VARIADIC = 613; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain the safety of this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Previously we implemented variadic form in backend, but only accepted non-variadic form in frontend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still a little confused about why we need 2 exprs. Isn't variadic version converted to the variadic version? 🤔
Could you add some planner tests to help understand?
@@ -612,6 +612,24 @@ impl Debug for ListRef<'_> { | |||
} | |||
} | |||
|
|||
impl Row for ListRef<'_> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a little confusing 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to allow arguments of list type to be accepted as impl Row
in Rust functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with this as I cannot come up with another way to interpret ARRAY
as rows to form an ambiguousness. If there's one, making a newtype on ListRef
then impl Row
on that will work.
proto/expr.proto
Outdated
JSONB_EXTRACT_PATH = 613; | ||
JSONB_EXTRACT_PATH = 626; | ||
JSONB_EXTRACT_PATH_VARIADIC = 613; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// abcde222 | ||
/// ``` | ||
#[function("concat(variadic anyarray) -> varchar")] | ||
fn concat(vals: impl Row, writer: &mut impl Write) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering what the possible receiver types are here for impl Row
. 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is RowRef
for non-variadic version, and ListRef
for variadic version.
They are physically different. Converting either form to the other will introduce overhead. So for performance reason, I decided to generate separate code for each version in backend. |
|
GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
---|---|---|---|---|---|
9425213 | Triggered | Generic Password | 9bf4913 | ci/scripts/regress-test.sh | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Our GitHub checks need improvements? Share your feedbacks!
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
resolve #14705
This PR adds VARIADIC argument support for the following functions:
It adds new functions
format_variadic
,concat_ws_variadic
... on the backend, which take a fixedanyarray
as the last argument. On the frontend, we rewrite the variadic calls into new functions.Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
support VARIADIC arguments for the following functions:
The VARIADIC keyword expands the array parameter into one or more occurrences of its element type. See postgres documentation for more details.
Add a new function
concat
: