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: predicate shall use real schema to create physical exprs #2642

Merged

Conversation

v0y4g3r
Copy link
Contributor

@v0y4g3r v0y4g3r commented Oct 23, 2023

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

This PR fixes the incorrect behavior when pruning memtable time series using the schema from RegionMetadata.

The bug originates from how Predicate used for pruning generates physical expr, because the indices for primary keys in primary key record batch may differ from the indices defined in RegionMetadata. Instead, in this fix we postpone the generation of physical exprs until evaluation and explicitly requires callers to provide a schema for physical expr generation so that those physical expr will have the save schema as record batch evaluated.

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.

Refer to a related PR or issue link (optional)

@v0y4g3r v0y4g3r changed the title fix: prune predicate show use real schema to create physical exprs fix: predicate shall use real schema to create physical exprs Oct 23, 2023
@v0y4g3r v0y4g3r requested review from evenyag and killme2008 October 23, 2023 14:01
@codecov
Copy link

codecov bot commented Oct 23, 2023

Codecov Report

Merging #2642 (42126c6) into develop (1fc42a6) will decrease coverage by 0.42%.
The diff coverage is 89.47%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2642      +/-   ##
===========================================
- Coverage    84.95%   84.54%   -0.42%     
===========================================
  Files          743      743              
  Lines       120609   120672      +63     
===========================================
- Hits        102469   102027     -442     
- Misses       18140    18645     +505     

src/table/src/predicate.rs Outdated Show resolved Hide resolved
src/mito2/src/engine/prune_test.rs Show resolved Hide resolved
@killme2008 killme2008 added C-bug Category Bugs A-storage Involves code in storage engines priority:high labels Oct 23, 2023
@v0y4g3r v0y4g3r requested a review from killme2008 October 24, 2023 02:21
Copy link
Contributor

@killme2008 killme2008 left a comment

Choose a reason for hiding this comment

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

LGTM

@v0y4g3r v0y4g3r requested a review from waynexia October 24, 2023 02:24
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.

LGTM

src/table/src/predicate.rs Show resolved Hide resolved
src/table/src/predicate.rs Outdated Show resolved Hide resolved
@evenyag evenyag marked this pull request as draft October 24, 2023 03:13
@evenyag evenyag marked this pull request as ready for review October 24, 2023 03:13
@evenyag evenyag enabled auto-merge October 24, 2023 03:14
@evenyag evenyag added this pull request to the merge queue Oct 24, 2023
@v0y4g3r v0y4g3r removed this pull request from the merge queue due to a manual request Oct 24, 2023
@v0y4g3r v0y4g3r added this pull request to the merge queue Oct 24, 2023
Merged via the queue into GreptimeTeam:develop with commit 97897aa Oct 24, 2023
12 checks passed
@v0y4g3r v0y4g3r deleted the fix/predicate-prune-schema-mismatch branch October 24, 2023 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-storage Involves code in storage engines C-bug Category Bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants