-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement relational NULL semantics for Nothing for in-memory Column …
…operations (#8816) Updates in-memory table column operations to treat Nothing as a relational NULL. This PR does not include changes to Table.join.
- Loading branch information
1 parent
23d6fcd
commit 5eb3f3b
Showing
16 changed files
with
444 additions
and
115 deletions.
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
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
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
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
83 changes: 83 additions & 0 deletions
83
std-bits/table/src/main/java/org/enso/table/util/ImmutableBitSet.java
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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package org.enso.table.util; | ||
|
||
import java.util.BitSet; | ||
|
||
/** | ||
* A wrapper around BitSet that implements boolean operations conveniently. Unlike BitSet, | ||
* ImmutableBitSet takes a size parameter, which allows .not to be implemented. | ||
*/ | ||
public class ImmutableBitSet { | ||
private BitSet bitSet; | ||
private int size; | ||
|
||
public ImmutableBitSet(BitSet bitSet, int size) { | ||
this.bitSet = bitSet; | ||
this.size = size; | ||
} | ||
|
||
public BitSet toBitSet() { | ||
return bitSet; | ||
} | ||
|
||
public ImmutableBitSet and(ImmutableBitSet other) { | ||
assert size == other.size; | ||
BitSet result = (BitSet) bitSet.clone(); | ||
result.and(other.bitSet); | ||
return new ImmutableBitSet(result, size); | ||
} | ||
|
||
public ImmutableBitSet or(ImmutableBitSet other) { | ||
assert size == other.size; | ||
BitSet result = (BitSet) bitSet.clone(); | ||
result.or(other.bitSet); | ||
return new ImmutableBitSet(result, size); | ||
} | ||
|
||
public ImmutableBitSet andNot(ImmutableBitSet other) { | ||
assert size == other.size; | ||
BitSet result = (BitSet) bitSet.clone(); | ||
result.andNot(other.bitSet); | ||
return new ImmutableBitSet(result, size); | ||
} | ||
|
||
public ImmutableBitSet not() { | ||
BitSet result = (BitSet) bitSet.clone(); | ||
result.flip(0, size); | ||
return new ImmutableBitSet(result, size); | ||
} | ||
|
||
public ImmutableBitSet notAnd(ImmutableBitSet other) { | ||
assert size == other.size; | ||
BitSet result = (BitSet) bitSet.clone(); | ||
result.flip(0, size); | ||
result.and(other.bitSet); | ||
return new ImmutableBitSet(result, size); | ||
} | ||
|
||
public ImmutableBitSet notAndNot(ImmutableBitSet other) { | ||
assert size == other.size; | ||
BitSet result = (BitSet) bitSet.clone(); | ||
result.flip(0, size); | ||
result.andNot(other.bitSet); | ||
return new ImmutableBitSet(result, size); | ||
} | ||
|
||
public ImmutableBitSet orNot(ImmutableBitSet other) { | ||
// Doing an extra operation to avoid doing an extra allocation. | ||
// a || !b => !(!a && b) | ||
assert size == other.size; | ||
BitSet result = (BitSet) bitSet.clone(); | ||
result.flip(0, size); | ||
result.and(other.bitSet); | ||
result.flip(0, size); | ||
return new ImmutableBitSet(result, size); | ||
} | ||
|
||
public static ImmutableBitSet allFalse(int size) { | ||
return new ImmutableBitSet(new BitSet(), size); | ||
} | ||
|
||
public static ImmutableBitSet allTrue(int size) { | ||
return new ImmutableBitSet(new BitSet(), size).not(); | ||
} | ||
} |
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
Oops, something went wrong.