Skip to content
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

feat(sql-udf): add hint display for non-existent functions #15188

Merged
merged 27 commits into from
Feb 29, 2024

Conversation

xzhseh
Copy link
Contributor

@xzhseh xzhseh commented Feb 21, 2024

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

image.png

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

Copy link
Contributor Author

xzhseh commented Feb 21, 2024

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

@xzhseh xzhseh changed the title add hint display for non-existent function feat(sql-udf): add hint display for non-existent function Feb 21, 2024
@xzhseh xzhseh changed the title feat(sql-udf): add hint display for non-existent function feat(sql-udf): add hint display for non-existent functions Feb 21, 2024
@xzhseh xzhseh marked this pull request as ready for review February 21, 2024 20:56
@xzhseh xzhseh self-assigned this Feb 21, 2024
@xzhseh xzhseh requested a review from xxchan February 21, 2024 21:21
@xzhseh xzhseh force-pushed the xzhseh/sql-udf-creation-better-funciton-hint-display branch from 474d9c9 to 60e90b0 Compare February 21, 2024 21:31
@xzhseh xzhseh force-pushed the xzhseh/sql-udf-creation-better-funciton-hint-display branch from 60e90b0 to ce30232 Compare February 21, 2024 21:36
Copy link
Contributor

@wangrunji0408 wangrunji0408 left a comment

Choose a reason for hiding this comment

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

LGTM.
Having a highlight of invalid tokens is definitely cool. But the implementation looks more and more hacky to me. I think we should start investigating on the span-based solutions. 🥵

ErrMsgType::Parameter => invalid_msg.split_whitespace().last(),
// e.g., function <target name> does not exist
ErrMsgType::Function => {
let func = invalid_msg.split_whitespace().nth(1).unwrap_or("null");
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to extract targets directly from error types, instead of relying on formatted error messages?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Error type can not indicate [function / invalid parameter] name I'm assuming, so it seems impossible? 🥵

Comment on lines +38 to +40
enum ErrMsgType {
Parameter,
Function,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we associate identifier names in this enum? This way, validate_err_msg and extract_hint_display_target can be merged into one.

Suggested change
enum ErrMsgType {
Parameter,
Function,
enum ErrMsgType {
Parameter(String),
Function(String),

Copy link
Contributor Author

@xzhseh xzhseh Feb 26, 2024

Choose a reason for hiding this comment

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

Actually I don't think this two could merge. 🤔
Without prior context on what the error message is for, we can't simply retrieve the hint target from the input message.

Base automatically changed from xzhseh/sql-udf-creation-better-hint-display to main February 26, 2024 22:08
@xzhseh xzhseh requested a review from a team as a code owner February 26, 2024 22:08
@xzhseh xzhseh added this pull request to the merge queue Feb 29, 2024
Merged via the queue into main with commit 463cfaf Feb 29, 2024
27 of 28 checks passed
@xzhseh xzhseh deleted the xzhseh/sql-udf-creation-better-funciton-hint-display branch February 29, 2024 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants