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: Adds RegionScanner trait #3948

Merged
merged 16 commits into from
May 20, 2024
Merged

Conversation

evenyag
Copy link
Contributor

@evenyag evenyag commented May 15, 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?

This PR adds the RegionScanner trait mentioned in #3886

pub trait RegionScanner: Debug + DisplayAs + Send + Sync {
    fn properties(&self) -> &ScannerProperties;
    fn schema(&self) -> SchemaRef;
    fn scan_partition(&self, partition: usize) -> Result<SendableRecordBatchStream, BoxedError>;
}

It allows us to split rows to scan into multiple partitions and increase scan parallelism. The RegionEngine has a new method handle_partitioned_query() to get the RegionScanner. It removes the old handle_query() method from the trait and only exposes it in the MitoEngine.

Since most region engines don't support partitioning, this PR adds a SinglePartitionScanner to turn a stream into a region scanner.

The execution plan returned by the dummy table provider now becomes the ReadFromRegion plan. This plan adapts a RegionScanner to the ExecutionPlan trait.

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 May 15, 2024
@evenyag evenyag marked this pull request as ready for review May 20, 2024 06:27
@evenyag evenyag requested review from waynexia, v0y4g3r and a team as code owners May 20, 2024 06:27
Copy link

codecov bot commented May 20, 2024

Codecov Report

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

Project coverage is 85.18%. Comparing base (11ad5b3) to head (e400c17).
Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3948      +/-   ##
==========================================
- Coverage   85.40%   85.18%   -0.22%     
==========================================
  Files         978      977       -1     
  Lines      169100   169323     +223     
==========================================
- Hits       144427   144245     -182     
- Misses      24673    25078     +405     

src/datanode/src/tests.rs Outdated Show resolved Hide resolved
src/mito2/src/read/unordered_scan.rs Show resolved Hide resolved
src/store-api/src/region_engine.rs Outdated Show resolved Hide resolved
src/store-api/src/region_engine.rs Outdated Show resolved Hide resolved
src/store-api/src/region_engine.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@v0y4g3r v0y4g3r left a comment

Choose a reason for hiding this comment

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

LGTM

@evenyag evenyag requested a review from waynexia May 20, 2024 11:30
@waynexia waynexia enabled auto-merge May 20, 2024 11:41
@waynexia waynexia added this pull request to the merge queue May 20, 2024
Merged via the queue into GreptimeTeam:main with commit 179c8c7 May 20, 2024
20 checks passed
WenyXu pushed a commit to WenyXu/greptimedb that referenced this pull request May 21, 2024
* feat: define region scanner

* feat: single partition scanner

* feat: use single partition scanner

* feat: implement ExecutionPlan wip

* feat: mito engine returns single partition scanner

* feat: implement DisplayAs for region server

* feat: dummy table provider use handle_partitioned_query()

* test: update sqlness test

* feat: table provider use ReadFromRegion

* refactor: remove StreamScanAdapter

* chore: update lock

* style: fix clippy

* refactor: remove handle_query from the RegionEngine trait

* chore: address CR comments

* refactor: rename methods

* refactor: rename ReadFromRegion to RegionScanExec
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.

3 participants