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

fix(frontend): returning matches desired columns #9109

Closed
wants to merge 8 commits into from

Conversation

y-wei
Copy link
Contributor

@y-wei y-wei commented Apr 11, 2023

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

What's changed and what's your intention?

returning matches desired columns for vanilla table.

Please explain IN DETAIL what the changes are in this PR and why they are needed:

  • Summarize your change (mandatory)
    Let LogicalInsert's schema be the returning schema (rather than its input's schema, for which may misalign with the table's schema).
    This leads to a side effect that the projection afterwards becomes identity, and thus being subject to ProjectEliminationRule(credits to @broccoliSpicy, nice catch). Therefore the rule is banned for project -> dml cases.
  • Describe any limitations of the current code (optional)
    This PR FAILS to solve the problem when the table contains generated columns, and it's banned in the binder phase (it will be tracked by another issue).
  • Refer to a related PR or issue link (optional)
    returning fails matching specified target columns #9012

Checklist For Contributors

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
    - [ ] I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • I have demonstrated that backward compatibility is not broken by breaking changes and created issues to track deprecated features to be removed in the future. (Please refer to the issue)
  • All checks passed in ./risedev check (or alias, ./risedev c)

Checklist For Reviewers

  • I have requested macro/micro-benchmarks as this PR can affect performance substantially, and the results are shown.

Documentation

- [ ] My PR DOES NOT contain user-facing changes.

Click here for Documentation

Types of user-facing changes

Please keep the types that apply to your changes, and remove the others.

  • SQL commands, functions, and operators

Release note

insert with returning to a table with generated columns will be rejected at the binder phase.

@y-wei y-wei requested a review from BugenZhao April 11, 2023 17:36
@y-wei
Copy link
Contributor Author

y-wei commented Apr 11, 2023

@broccoliSpicy PTAL

@y-wei
Copy link
Contributor Author

y-wei commented Apr 11, 2023

I find the datachunk written to dml_manager in insert executor does not contain columns that will be generated, and thus I don't find a way to yield correct chunk for returning. Do you have any suggestions? @yuhao-su

@y-wei y-wei linked an issue Apr 11, 2023 that may be closed by this pull request
@y-wei y-wei added the user-facing-changes Contains changes that are visible to users label Apr 11, 2023
@y-wei
Copy link
Contributor Author

y-wei commented Apr 12, 2023

There's another and better design😇

@y-wei y-wei closed this Apr 12, 2023
@yuhao-su
Copy link
Contributor

and thus I don't find a way to yield the correct chunk for returning.

Good catch. Let's ban returning an insert with the generated column. After discussing with @st1page , returning may not be accurate when inserting a record that pk conflict with existing record.

@CharlieSYH CharlieSYH added the 📖✗ No user documentation is needed. label Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user-facing-changes Contains changes that are visible to users 📖✗ No user documentation is needed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

returning fails matching specified target columns
3 participants