-
Notifications
You must be signed in to change notification settings - Fork 409
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
Storages: Add whether has null in the result of MinMaxIndex #9288
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about
class RSResult
{
private:
enum class HitState : UInt8
{
Unknown = 0,
None = 1,
Some = 2,
All = 3,
};
bool has_null;
public:
HitState hit_state;
RSResult()
: has_null(false)
, hit_state(HitState::Unknown)
{}
RSResult(HitState hit_state_, bool has_null_)
: has_null(has_null_)
, hit_state(hit_state_)
{}
// NOLINTBEGIN (readability-identifier-naming)
static RSResult None() { return RSResult(HitState::None, false); }
static RSResult Some() { return RSResult(HitState::Some, false); }
static RSResult All() { return RSResult(HitState::All, false); }
static RSResult NoneWithNull() { return RSResult(HitState::None, true); }
static RSResult SomeWithNull() { return RSResult(HitState::Some, true); }
static RSResult AllWithNull() { return RSResult(HitState::All, true); }
// NOLINTEND
RSResult operator||(const RSResult & other) const
{
if (hit_state == HitState::All || other.hit_state == HitState::All)
return RSResult(HitState::All, false);
auto result
= (hit_state == HitState::Some || other.hit_state == HitState::Some) ? HitState::Some : HitState::None;
return RSResult(result, has_null || other.has_null);
}
RSResult operator&&(const RSResult & other) const
{
if (hit_state == HitState::None || other.hit_state == HitState::None)
return RSResult(HitState::None, false);
auto result = (hit_state == HitState::All && other.hit_state == HitState::All) ? HitState::All : HitState::Some;
return RSResult(result, has_null || other.has_null);
}
RSResult operator!() const
{
switch (hit_state)
{
case HitState::Some:
return RSResult(HitState::Some, has_null);
case HitState::None:
return RSResult(HitState::All, has_null);
case HitState::All:
return RSResult(HitState::None, has_null);
default:
throw Exception("Unknow RSResult: {}", static_cast<UInt8>(hit_state));
}
}
bool needToRead() const { return hit_state != HitState::None; }
bool needToFilter() const { return hit_state == HitState::All && !has_null; }
};
@Lloyd-Pottiger I have implemented a similar version before. It affetcs too many code including the tests. It is better to write another PR to refine |
@JinheLin JinheLin#3 seems the size of the changes is acceptable |
bed7cc9
to
3352754
Compare
@@ -169,6 +169,14 @@ static_assert( | |||
|
|||
static constexpr bool DM_RUN_CHECK = true; | |||
|
|||
struct Attr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move struct Attr
from RSResult.h
to DeltaMergeDefines.h
for simplifing the headers that RSResult.h
included.
@@ -634,8 +634,8 @@ bool shouldCompactStableWithTooMuchDataOutOfSegmentRange( | |||
"GC - shouldCompactStableWithTooMuchDataOutOfSegmentRange checked false " | |||
"because segment DTFile is shared with a neighbor segment, " | |||
"first_pack_inc={} last_pack_inc={} prev_seg_files=[{}] next_seg_files=[{}] my_files=[{}] segment={}", | |||
magic_enum::enum_name(at_least_result.first_pack_intersection), | |||
magic_enum::enum_name(at_least_result.last_pack_intersection), | |||
at_least_result.first_pack_intersection, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RSResult
is a class now, and formatter has beed implemented in RSResult.h
.
@Lloyd-Pottiger @JaySon-Huang PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
/retest |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: JaySon-Huang, Lloyd-Pottiger The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
What problem does this PR solve?
Issue Number: ref #9103
Problem Summary:
In the current implementation, the filtering results returned by
MinMaxIndex
do not take into account the presence of null values. That is to say, ifRSResult:: All
is returned, it is still necessary to filter null values instead of skipping this filtering calculation directly.What is changed and how it works?
This PR adds information about whether there is a null value in a pack in the filtering results returned by the
MinMaxIndex
.Check List
Tests
Side effects
Documentation
Release note