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: querying from view works #3952

Merged
merged 23 commits into from
May 30, 2024
Merged

Conversation

killme2008
Copy link
Contributor

@killme2008 killme2008 commented May 15, 2024

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

#3729

What's changed and what's your intention?

Make querying view works.

Main changes:

  1. Adds ViewInfoCache for caching ViewValueInfo. @WenyXu
  2. Destroy view metadata in DropDatabaseCursor .
  3. Extract and rewrite all table names in view logical plan. Saves the table names into view info.
  4. Add SubstraitPlanDecoder trait and implement it in the query crate, which decodes the logical plan from bytes, takes care of the session state, etc.
  5. Resolve view in DfTableSourceProvider. It queries the view info and tries to decode it, then wraps the logical plan into ViewTable.
  6. Some refactoring: move the PromQL planner to the query crate, and remove some unused errors, etc.

Todo:

  1. Supports column names(alias) for view.
  2. Save the optimized logical plan for view. There are some serialization issues when saving the optimized plan. @waynexia

Checklist

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

@github-actions github-actions bot added the docs-not-required This change does not impact docs. label May 15, 2024
@killme2008 killme2008 force-pushed the query-view branch 2 times, most recently from 51a42c0 to 2669c3f Compare May 21, 2024 14:13
@killme2008 killme2008 marked this pull request as ready for review May 21, 2024 14:45
@killme2008 killme2008 requested review from WenyXu and fengjiachun May 21, 2024 14:45
Cargo.toml Outdated Show resolved Hide resolved
Copy link

codecov bot commented May 21, 2024

Codecov Report

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

Project coverage is 85.02%. Comparing base (85a2318) to head (1999314).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3952      +/-   ##
==========================================
- Coverage   85.37%   85.02%   -0.35%     
==========================================
  Files         987      991       +4     
  Lines      172141   172822     +681     
==========================================
- Hits       146965   146943      -22     
- Misses      25176    25879     +703     

Copy link
Contributor

@zhongzc zhongzc left a comment

Choose a reason for hiding this comment

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

I checked, basic LGTM

@fengjiachun
Copy link
Collaborator

fengjiachun commented May 23, 2024

@WenyXu Could you please take a look at the cache section?

@WenyXu
Copy link
Member

WenyXu commented May 24, 2024

@WenyXu Could please take a look at the cache section?

The cache part, LGTM

@killme2008
Copy link
Contributor Author

@waynexia Please take a look.

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.

Rest LGTM, @waynexia PTAL

src/query/src/error.rs Show resolved Hide resolved
src/query/src/query_engine/context.rs Outdated Show resolved Hide resolved
src/query/src/query_engine/default_serializer.rs Outdated Show resolved Hide resolved
Copy link
Member

@waynexia waynexia left a comment

Choose a reason for hiding this comment

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

we should not depend on test-integration. where is it used?

src/common/meta/src/key/view_info.rs Outdated Show resolved Hide resolved
src/query/src/query_engine/context.rs Show resolved Hide resolved
src/common/query/src/logical_plan.rs Outdated Show resolved Hide resolved
src/common/query/src/logical_plan.rs Show resolved Hide resolved
@killme2008 killme2008 enabled auto-merge May 30, 2024 21:32
@killme2008 killme2008 added this pull request to the merge queue May 30, 2024
Merged via the queue into GreptimeTeam:main with commit 24612f6 May 30, 2024
28 checks passed
@killme2008 killme2008 deleted the query-view branch May 30, 2024 22:01
@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-not-required This change does not impact docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants