-
Notifications
You must be signed in to change notification settings - Fork 336
Using validity bitmap as Arrow does #14409
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
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
d6a67ec
Using validity bit map as arrow does
JaroslavTulach c88bf32
Let's hope validity has been fixed
JaroslavTulach ea48d1d
Need to set validity bit when appending valid value
JaroslavTulach 08870e4
Missing ! in LongStorage.isNothing
JaroslavTulach d6f3888
Better validityMap handling in BoolBuilder and BoolStorage
JaroslavTulach 84b51ea
isNothingMap still useful in FillMissingOperation
JaroslavTulach 65f340c
LongStorageIterator also uses validityMap
JaroslavTulach 6f1da71
Iterate over clear bits of the validity bitmap
JaroslavTulach ffc465a
test/Table_Tests/src/In_Memory/Bool_Spec.enso is passing OK
JaroslavTulach 438864a
Success with --run test/Table_Tests should.support.is_blank
JaroslavTulach 6011c98
One ! fixes runEngineDistribution --run test/Table_Tests cast.to.Deci…
JaroslavTulach e23ae23
Cardinality of a map represents number of valid entries
JaroslavTulach 215b453
makeValidityMap in IsInOperation
JaroslavTulach bfa1c62
Keeping the original logic and just flipping the bits fixes all tests…
JaroslavTulach 01ad757
Empty valid map with non-empty storage must mean there is null value
JaroslavTulach 8a0e205
Keep sealed and permit InferredDoubleBuilder
JaroslavTulach c2676e8
Rewording comment
JaroslavTulach ab49b81
Reformatted by javafmtAll
JaroslavTulach 171cded
Nothing is present when validity cardinality isn't equal to size
JaroslavTulach ef972d5
Enforcing immutability of validity map by using ImmutableBitSet
JaroslavTulach 0621d6e
Sharing allTrue bitmap for all sizes
JaroslavTulach 4f78cd0
More of ImmutableBitSet
JaroslavTulach 0c07d60
Avoid allocating validityMap in the builder when all values are valid
JaroslavTulach 6b036af
Unit testing IsNothingOperation
JaroslavTulach 58fc873
Fixing CountNothing.allNothing for storages with validity map
JaroslavTulach 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ | |
| import org.enso.table.data.column.storage.ColumnBooleanStorage; | ||
| import org.enso.table.data.column.storage.ColumnStorage; | ||
| import org.enso.table.data.column.storage.ColumnStorageWithInferredStorage; | ||
| import org.enso.table.data.column.storage.ColumnStorageWithNothingMap; | ||
| import org.enso.table.data.column.storage.ColumnStorageWithValidityMap; | ||
| import org.enso.table.data.column.storage.type.AnyObjectType; | ||
| import org.enso.table.data.column.storage.type.BigDecimalType; | ||
| import org.enso.table.data.column.storage.type.BigIntegerType; | ||
|
|
@@ -28,6 +28,7 @@ | |
| import org.enso.table.data.column.storage.type.TimeOfDayType; | ||
| import org.enso.table.data.table.Column; | ||
| import org.enso.table.data.table.problems.MapOperationProblemAggregator; | ||
| import org.enso.table.util.ImmutableBitSet; | ||
|
|
||
| /** | ||
| * The IsInOperation class provides a way to check if a value is in a set of values. It checks if | ||
|
|
@@ -265,8 +266,8 @@ private static ColumnStorage<?> applyBooleanIsIn( | |
|
|
||
| // If had both true and false, then return all true when not nothing | ||
| if (flags.hadTrue && flags.hadFalse) { | ||
| var isNothing = makeIsNothingMap(boolStorage, checkedSize); | ||
| return new BoolStorage(new BitSet(), isNothing, checkedSize, true); | ||
| var validityMap = makeValidityMap(boolStorage, checkedSize); | ||
| return new BoolStorage(new BitSet(), validityMap, checkedSize, true); | ||
| } | ||
|
|
||
| // Only have one of true or false | ||
|
|
@@ -296,34 +297,41 @@ private static ColumnStorage<?> applyBooleanIsIn( | |
| private static ColumnStorage<?> applyBoolStorage( | ||
| boolean keepValue, BoolStorage boolStorage, int checkedSize) { | ||
| BitSet values = boolStorage.getValues(); | ||
| BitSet isNothing = boolStorage.getIsNothingMap(); | ||
| BitSet isNothing = boolStorage.getValidityMap().cloneBitSet(); | ||
| isNothing.flip(0, Math.toIntExact(boolStorage.getSize())); | ||
|
|
||
| if (keepValue) { | ||
| var newIsNothing = | ||
| boolStorage.isNegated() ? or(isNothing, values) : orNot(isNothing, values, checkedSize); | ||
| boolStorage.isNegated() | ||
| ? or(isNothing, values, checkedSize) | ||
| : orNot(isNothing, values, checkedSize); | ||
| newIsNothing.flip(0, checkedSize); | ||
| return new BoolStorage(values, newIsNothing, checkedSize, boolStorage.isNegated()); | ||
| } else { | ||
| var newIsNothing = | ||
| boolStorage.isNegated() ? orNot(isNothing, values, checkedSize) : or(isNothing, values); | ||
| boolStorage.isNegated() | ||
| ? orNot(isNothing, values, checkedSize) | ||
| : or(isNothing, values, checkedSize); | ||
| newIsNothing.flip(0, checkedSize); | ||
| return new BoolStorage(values, newIsNothing, checkedSize, !boolStorage.isNegated()); | ||
| } | ||
|
Comment on lines
303
to
317
Collaborator
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. DRY (although it has been like that before)
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.
|
||
| } | ||
|
|
||
| private static BitSet makeIsNothingMap(ColumnStorage<?> storage, int size) { | ||
| if (storage instanceof ColumnStorageWithNothingMap withNothingMap) { | ||
| return withNothingMap.getIsNothingMap(); | ||
| private static ImmutableBitSet makeValidityMap(ColumnStorage<?> storage, int size) { | ||
| if (storage instanceof ColumnStorageWithValidityMap withNothingMap) { | ||
| return withNothingMap.getValidityMap(); | ||
| } | ||
|
|
||
| BitSet isNothingMap = new BitSet(size); | ||
| BitSet validityMap = new BitSet(size); | ||
| for (int i = 0; i < size; i++) { | ||
| if (storage.isNothing(i)) { | ||
| isNothingMap.set(i); | ||
| if (!storage.isNothing(i)) { | ||
| validityMap.set(i); | ||
| } | ||
| } | ||
| return isNothingMap; | ||
| return new ImmutableBitSet(validityMap, size); | ||
| } | ||
|
|
||
| private static BitSet or(BitSet left, BitSet right) { | ||
| private static BitSet or(BitSet left, BitSet right, int sizeIsIgnored) { | ||
| BitSet result = (BitSet) left.clone(); | ||
| result.or(right); | ||
| return result; | ||
|
|
||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.