-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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: Replace columnHasNulls with row stats #11841
Draft
zation99
wants to merge
1
commit into
facebookincubator:main
Choose a base branch
from
zation99:jiaqizhang_t1052320929975217_merge_hasnull_rowstats
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+8
−19
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -823,7 +823,8 @@ class RowContainer { | |
|
||
/// Returns true if specified column may have nulls, false otherwise. | ||
inline bool columnHasNulls(int32_t columnIndex) const { | ||
return columnHasNulls_[columnIndex]; | ||
return columnStats(columnIndex).has_value() && | ||
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.
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. As @tanjialiang suggested, I'll separate the nullCount when invalidating columnStats, so that we don't need to check it here. |
||
columnStats(columnIndex)->nullCount() > 0; | ||
} | ||
|
||
const std::vector<Accumulator>& accumulators() const { | ||
|
@@ -1015,7 +1016,6 @@ class RowContainer { | |
// Do not leave an uninitialized value in the case of a | ||
// null. This is an error with valgrind/asan. | ||
*reinterpret_cast<T*>(row + offset) = T(); | ||
updateColumnHasNulls(columnIndex, true); | ||
return; | ||
} | ||
if constexpr (std::is_same_v<T, StringView>) { | ||
|
@@ -1056,6 +1056,7 @@ class RowContainer { | |
for (int32_t i = 0; i < rows.size(); ++i) { | ||
storeWithNulls<Kind>( | ||
decoded, i, isKey, rows[i], offset, nullByte, nullMask, column); | ||
updateColumnStats(decoded, i, rows[i], column); | ||
} | ||
} | ||
|
||
|
@@ -1064,9 +1065,11 @@ class RowContainer { | |
const DecodedVector& decoded, | ||
folly::Range<char**> rows, | ||
bool isKey, | ||
int32_t offset) { | ||
int32_t offset, | ||
int32_t column) { | ||
for (int32_t i = 0; i < rows.size(); ++i) { | ||
storeNoNulls<Kind>(decoded, i, isKey, rows[i], offset); | ||
updateColumnStats(decoded, i, rows[i], column); | ||
} | ||
} | ||
|
||
|
@@ -1467,12 +1470,6 @@ class RowContainer { | |
// method is called whenever a row is erased. | ||
void invalidateColumnStats(); | ||
|
||
// Updates the specific column's columnHasNulls_ flag, if 'hasNulls' is true. | ||
// columnHasNulls_ flag is false by default. | ||
inline void updateColumnHasNulls(int32_t columnIndex, bool hasNulls) { | ||
columnHasNulls_[columnIndex] = columnHasNulls_[columnIndex] || hasNulls; | ||
} | ||
|
||
const std::vector<TypePtr> keyTypes_; | ||
const bool nullableKeys_; | ||
const bool isJoinBuild_; | ||
|
@@ -1481,8 +1478,6 @@ class RowContainer { | |
|
||
const std::unique_ptr<HashStringAllocator> stringAllocator_; | ||
|
||
std::vector<bool> columnHasNulls_; | ||
|
||
// Indicates if we can add new row to this row container. It is set to false | ||
// after user calls 'getRowPartitions()' to create 'rowPartitions' object for | ||
// parallel join build. | ||
|
@@ -1637,7 +1632,6 @@ inline void RowContainer::storeWithNulls<TypeKind::HUGEINT>( | |
if (decoded.isNullAt(rowIndex)) { | ||
row[nullByte] |= nullMask; | ||
memset(row + offset, 0, sizeof(int128_t)); | ||
updateColumnHasNulls(columnIndex, true); | ||
return; | ||
} | ||
HugeInt::serialize(decoded.valueAt<int128_t>(rowIndex), row + offset); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is also change in #11527, FYI.
Thanks.
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.
Thanks for the information. I see it's already merged. Let me rebase.