-
Notifications
You must be signed in to change notification settings - Fork 590
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
fix(frontend): support drop function
without arguments
#9561
Conversation
Signed-off-by: Runji Wang <wangrunji0408@163.com>
Signed-off-by: Runji Wang <wangrunji0408@163.com>
Signed-off-by: Runji Wang <wangrunji0408@163.com>
None => match reader.get_functions_by_name(db_name, schema_path, &function_name) { | ||
Ok((functions, schema_name)) => { | ||
if functions.len() > 1 { | ||
return Err(ErrorCode::CatalogError(format!("function name {function_name:?} is not unique\nHINT: Specify the argument list to select the function unambiguously.").into()).into()); | ||
} | ||
Ok(( | ||
functions.into_iter().next().expect("no functions"), | ||
schema_name, | ||
)) | ||
} | ||
Err(e) => Err(e), | ||
}, | ||
}; | ||
match res { |
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 looks a little spaghetti, but I don't have an immediate idea to improve it 🤪
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.
Agree. it's quick-and-dirty. 🤪
if functions.is_empty() { | ||
return None; | ||
} |
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 option unnecessary?
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 thought it might panic when this function returns a Some(vec![])
. So I added these lines to prevent it.
Codecov Report
@@ Coverage Diff @@
## main #9561 +/- ##
==========================================
- Coverage 70.74% 70.72% -0.03%
==========================================
Files 1234 1234
Lines 206718 206757 +39
==========================================
- Hits 146243 146228 -15
- Misses 60475 60529 +54
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 6 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
As title.
drop function foo;
will succeed only when there's exactly one function namedfoo
.Here are some examples:
This PR also improved the error message when function is not found.
Checklist For Contributors
./risedev check
(or alias,./risedev c
)Checklist For Reviewers
Documentation
Click here for Documentation
Types of user-facing changes
Please keep the types that apply to your changes, and remove the others.
Release note
If the function name is unique in its schema, it can be referred to without an argument list:
Note that this is different from
which refers to a function with zero arguments, whereas the first variant can refer to a function with any number of arguments, including zero, as long as the name is unique.