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: create view #3807

Merged
merged 20 commits into from
May 14, 2024
Merged

feat: create view #3807

merged 20 commits into from
May 14, 2024

Conversation

killme2008
Copy link
Contributor

@killme2008 killme2008 commented Apr 26, 2024

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

What's changed and what's your intention?

Impl CREATE [OR REPLACE] [IF NOT EXISTS] VIEW name AS query statement, main changes:

The core design of CreateViewProcedure:

  • It saves the view's table info metadata(like normal table but the table type is View) and encoded logical plan as __view_info/{view_id} item in backend.
  • If or_replace is true which means replacing the exists view, it will do the updating operation of metadata.

Remaining tasks:

  • Query from views.
  • DROP VIEW name statement.

Todo:

  • Writing a procedure can be painful due to the complexity of gRPC and key/value serialization code. Improvements can be made in the future.

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR does not require documentation updates.

@github-actions github-actions bot added the docs-not-required This change does not impact docs. label Apr 26, 2024
@killme2008 killme2008 force-pushed the create-view branch 7 times, most recently from 54b509c to 3b8b072 Compare May 12, 2024 14:55
@github-actions github-actions bot added docs-required This change requires docs update. and removed docs-not-required This change does not impact docs. labels May 13, 2024
@killme2008 killme2008 marked this pull request as ready for review May 13, 2024 10:36
@killme2008 killme2008 requested review from WenyXu, waynexia and fengjiachun and removed request for a team, MichaelScofield and evenyag May 13, 2024 10:36
@killme2008
Copy link
Contributor Author

Lots of changes related to common/meta and procedure, so please take a look @WenyXu @fengjiachun

Cargo.toml Show resolved Hide resolved
src/operator/src/statement/ddl.rs Outdated Show resolved Hide resolved
src/operator/src/statement/ddl.rs Show resolved Hide resolved
src/frontend/src/instance/grpc.rs Outdated Show resolved Hide resolved
src/operator/src/metrics.rs Show resolved Hide resolved
Copy link

codecov bot commented May 13, 2024

Codecov Report

Attention: Patch coverage is 60.91825% with 349 lines in your changes are missing coverage. Please review.

Project coverage is 85.35%. Comparing base (f16ce3c) to head (0d6a891).

❗ Current head 0d6a891 differs from pull request most recent head 5650c40. Consider uploading reports for the commit 5650c40 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3807      +/-   ##
==========================================
- Coverage   85.79%   85.35%   -0.45%     
==========================================
  Files         965      966       +1     
  Lines      165107   165879     +772     
==========================================
- Hits       141654   141580      -74     
- Misses      23453    24299     +846     

Copy link
Collaborator

@fengjiachun fengjiachun left a comment

Choose a reason for hiding this comment

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

Almost LGTM

src/common/meta/src/key/view_info.rs Show resolved Hide resolved
src/common/meta/src/ddl/create_view.rs Show resolved Hide resolved
@killme2008 killme2008 enabled auto-merge May 14, 2024 07:46
@killme2008 killme2008 added this pull request to the merge queue May 14, 2024
Merged via the queue into GreptimeTeam:main with commit efd3f04 May 14, 2024
21 checks passed
@killme2008 killme2008 deleted the create-view branch May 14, 2024 08:22
@killme2008 killme2008 mentioned this pull request May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-required This change requires docs update.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants