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(sqlsmith): updates and deletes #9985

Merged
merged 23 commits into from
May 29, 2023
Merged

Conversation

kwannoel
Copy link
Contributor

@kwannoel kwannoel commented May 24, 2023

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

What's changed and what's your intention?

Around ~500 lines are from the snapshot tests.

Sqlsmith currently does the following:

  1. Generates base tables.
  2. Generate inserts
  3. Generates mviews on top of these base tables.
  4. Test batch + stream query.

After this PR:

  1. Generates base tables.
  2. Generate inserts
  3. Generates mviews on top of these base tables.
  4. +++ Generate updates (if have pk) / delete + inserts (if no pk)
  5. Test batch + stream query.

I found that interleaving inserts, updates and deletes between stream queries is complicated to debug. I have left it out for now. It can be done in the future.

Updates and deletes are generated by:

  1. Finding PK of tables.
  2. Selecting a subset of inserts.
  3. Selecting their PK, and generating new values for these rows.
  4. If they do not have PK, just delete some rows, generate some new inserts.

Closes #9824.

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.

  • Installation and deployment
  • Connector (sources & sinks)
  • SQL commands, functions, and operators
  • RisingWave cluster configuration changes
  • Other (please specify in the release note below)

Release note

@kwannoel kwannoel marked this pull request as ready for review May 25, 2023 07:33
@codecov
Copy link

codecov bot commented May 25, 2023

Codecov Report

Merging #9985 (64d233b) into main (121e5a1) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main    #9985      +/-   ##
==========================================
- Coverage   71.09%   71.09%   -0.01%     
==========================================
  Files        1230     1230              
  Lines      210331   210334       +3     
==========================================
  Hits       149536   149536              
- Misses      60795    60798       +3     
Flag Coverage Δ
rust 71.09% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/sqlparser/src/ast/mod.rs 85.65% <0.00%> (-0.21%) ⬇️

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@kwannoel kwannoel requested a review from lmatz May 25, 2023 09:41
@@ -1,59 +0,0 @@
// Copyright 2023 RisingWave Labs
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to dml.rs

@@ -0,0 +1,233 @@
// Copyright 2023 RisingWave Labs
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This contains the update and delete generation logic.

@kwannoel kwannoel force-pushed the kwannoel/sqlsmith-update-insert branch from 2760064 to 64d233b Compare May 29, 2023 07:19
@kwannoel
Copy link
Contributor Author

kwannoel commented May 29, 2023

New commits are solely from rebasing.

@kwannoel kwannoel enabled auto-merge May 29, 2023 07:21
@kwannoel kwannoel added this pull request to the merge queue May 29, 2023
Merged via the queue into main with commit 9151a82 May 29, 2023
@kwannoel kwannoel deleted the kwannoel/sqlsmith-update-insert branch May 29, 2023 07:46
lmatz pushed a commit that referenced this pull request May 29, 2023
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.

Sqlsmith: updates and deletes
2 participants