-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Enable segmentwise recompression for nullable order by columns with firstlast metadata index #9963
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,11 +27,15 @@ static bool create_segment_filter_scankey(Relation in_rel, char *segment_filter_ | |
| * | ||
| * Unlike HeapKeyTest, this function takes into account SK_ISNULL | ||
| * and works correctly when looking for null values. | ||
| * | ||
| * If slot attribute is NULL and key is NOT NULL, | ||
| * (key >= NULL) returns True for nulls_first | ||
| * and (key <= NULL) returns True for !nulls_first (i.e. for NULLS LAST). | ||
| */ | ||
| bool | ||
| slot_key_test(TupleTableSlot *compressed_slot, ScanKey key) | ||
| slot_key_test(TupleTableSlot *compressed_slot, ScanKey key, bool nulls_first) | ||
| { | ||
| /* No need to get the datum if we are only checking for NULLs */ | ||
| /* No need to get the datum if we are only checking for NULL key */ | ||
| if (key->sk_flags & SK_ISNULL) | ||
| { | ||
| return slot_attisnull(compressed_slot, key->sk_attno); | ||
|
|
@@ -43,6 +47,20 @@ slot_key_test(TupleTableSlot *compressed_slot, ScanKey key) | |
|
|
||
| if (is_null) | ||
| { | ||
| /* NULL < key i.e. NULL sorts before key argument */ | ||
| if (nulls_first && (key->sk_strategy == BTLessStrategyNumber || | ||
| key->sk_strategy == BTLessEqualStrategyNumber)) | ||
| { | ||
| return true; | ||
| } | ||
|
|
||
| /* NULL > key i.e. NULL sorts after key argument */ | ||
| if (!nulls_first && (key->sk_strategy == BTGreaterStrategyNumber || | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that you have this check here, is
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, because the change in We can now have But we still need to handle cases of key = NULL or boundary = NULL when |
||
| key->sk_strategy == BTGreaterEqualStrategyNumber)) | ||
| { | ||
| return true; | ||
| } | ||
|
|
||
| return false; | ||
| } | ||
|
|
||
|
|
||
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.
what is
(key <= NULL)?Uh oh!
There was an error while loading. Please reload this page.
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.
not-NULL key value sorts before NULL, the comment can be changed to be more accurate.