22 explicit MaskData(uint64_t size, uint8_t defaultVal = 0) : size{size} {
23 dataBuffer = std::make_unique<uint8_t[]>(size);
24 data = dataBuffer.get();
25 std::fill(
data,
data + size, defaultVal);
28 inline void setMask(uint64_t pos, uint8_t maskValue)
const {
data[pos] = maskValue; }
29 inline bool isMasked(uint64_t pos, uint8_t trueMaskVal)
const {
30 return data[pos] == trueMaskVal;
33 inline uint64_t
getSize()
const {
return size; }
36 std::unique_ptr<uint8_t[]> dataBuffer;
46 std::unique_lock lck{mtx};
47 if (maskData !=
nullptr) {
52 maskData = std::make_unique<MaskData>(maxOffset + 1);
57 auto offset = startOffset;
59 while (offset <= endOffset) {
60 numMasked += maskData->isMasked(offset++, numMasks);
69 if (offset >= maskData->getSize()) [[unlikely]] {
72 if (maskData->isMasked(offset, currentMaskValue)) {
73 maskData->setMask(offset, currentMaskValue + 1);
82 std::unique_ptr<MaskData> maskData;
uint8_t getNumMasks() const
Definition mask.h:77
MaskCollection()
Definition mask.h:43
bool isMasked(common::offset_t startOffset, common::offset_t endOffset) const
Definition mask.h:56
void incrementMaskValue(common::offset_t offset, uint8_t currentMaskValue)
Definition mask.h:68
void incrementNumMasks()
Definition mask.h:78
void init(common::offset_t maxOffset)
Definition mask.h:45
void incrementMaskValue(common::offset_t nodeOffset, uint8_t currentMaskValue) override
Definition mask.h:122
bool isMasked(common::offset_t startNodeOffset, common::offset_t endNodeOffset) override
Definition mask.h:126
NodeOffsetLevelSemiMask(common::table_id_t tableID, common::offset_t maxOffset)
Definition mask.h:112
void init() override
Definition mask.h:115
uint8_t getNumMasks() const
Definition mask.h:101
bool isEnabled() const
Definition mask.h:100
void incrementNumMasks()
Definition mask.h:102
virtual void incrementMaskValue(common::offset_t nodeOffset, uint8_t currentMaskValue)=0
common::offset_t getMaxOffset() const
Definition mask.h:93
common::table_id_t tableID
Definition mask.h:105
virtual bool isMasked(common::offset_t startNodeOffset, common::offset_t endNodeOffset)=0
virtual ~NodeSemiMask()=default
MaskCollection maskCollection
Definition mask.h:107
common::table_id_t getTableID() const
Definition mask.h:92
NodeSemiMask(common::table_id_t tableID, common::offset_t maxOffset)
Definition mask.h:88
common::offset_t maxOffset
Definition mask.h:106
bool isMasked(common::offset_t startNodeOffset, common::offset_t endNodeOffset) override
Definition mask.h:147
void incrementMaskValue(uint64_t nodeOffset, uint8_t currentMaskValue) override
Definition mask.h:143
NodeVectorLevelSemiMask(common::table_id_t tableID, common::offset_t maxOffset)
Definition mask.h:133
void init() override
Definition mask.h:136
constexpr offset_t INVALID_OFFSET
Definition internal_id_t.h:23
uint64_t table_id_t
Definition internal_id_t.h:14
uint64_t offset_t
Definition internal_id_t.h:22
constexpr uint64_t DEFAULT_VECTOR_CAPACITY_LOG_2
Definition constants.h:11
Definition alter_type.h:5
uint8_t * data
Definition mask.h:20
uint8_t getMaskValue(uint64_t pos) const
Definition mask.h:32
void setMask(uint64_t pos, uint8_t maskValue) const
Definition mask.h:28
uint64_t getSize() const
Definition mask.h:33
bool isMasked(uint64_t pos, uint8_t trueMaskVal) const
Definition mask.h:29
MaskData(uint64_t size, uint8_t defaultVal=0)
Definition mask.h:22
static common::offset_t getVectorIdx(common::offset_t offset)
Definition mask.h:14