Skip to content

Commit

Permalink
Update column_in_predicate.cpp
Browse files Browse the repository at this point in the history
Signed-off-by: stdpain <[email protected]>
  • Loading branch information
stdpain authored Nov 21, 2024
1 parent 920e404 commit 78fd261
Showing 1 changed file with 0 additions and 83 deletions.
83 changes: 0 additions & 83 deletions be/src/storage/column_in_predicate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,89 +334,6 @@ class BinaryColumnInPredicate : public ColumnPredicate {
ItemHashSet<Slice> _slices;
};

<<<<<<< HEAD
=======
class DictionaryCodeInPredicate : public ColumnPredicate {
private:
enum LogicOp { ASSIGN, AND, OR };

public:
DictionaryCodeInPredicate(const TypeInfoPtr& type_info, ColumnId id, const std::vector<int32_t>& operands,
size_t size)
: ColumnPredicate(type_info, id), _bit_mask(size) {
for (auto item : operands) {
DCHECK(item < size);
_bit_mask[item] = 1;
}
}

~DictionaryCodeInPredicate() override = default;

template <LogicOp Op>
inline void t_evaluate(const Column* column, uint8_t* sel, uint16_t from, uint16_t to) const {
const Int32Column* dict_code_column = down_cast<const Int32Column*>(ColumnHelper::get_data_column(column));
const auto& data = dict_code_column->get_data();
Filter filter(to - from, 1);

if (column->has_null()) {
const NullColumn* null_column = down_cast<const NullableColumn*>(column)->null_column().get();
const auto& null_data = null_column->get_data();
for (auto i = from; i < to; i++) {
auto index = data[i] >= _bit_mask.size() ? 0 : data[i];
filter[i - from] = (!null_data[i]) & _bit_mask[index];
}
} else {
for (auto i = from; i < to; i++) {
filter[i - from] = _bit_mask[data[i]];
}
}

for (auto i = from; i < to; i++) {
if constexpr (Op == ASSIGN) {
sel[i] = filter[i - from];
} else if constexpr (Op == AND) {
sel[i] &= filter[i - from];
} else {
sel[i] |= filter[i - from];
}
}
}

Status evaluate(const Column* column, uint8_t* selection, uint16_t from, uint16_t to) const override {
t_evaluate<ASSIGN>(column, selection, from, to);
return Status::OK();
}

Status evaluate_and(const Column* column, uint8_t* selection, uint16_t from, uint16_t to) const override {
t_evaluate<AND>(column, selection, from, to);
return Status::OK();
}

Status evaluate_or(const Column* column, uint8_t* selection, uint16_t from, uint16_t to) const override {
t_evaluate<OR>(column, selection, from, to);
return Status::OK();
}

bool can_vectorized() const override { return false; }

PredicateType type() const override { return PredicateType::kInList; }

Status convert_to(const ColumnPredicate** output, const TypeInfoPtr& target_type_info,
ObjectPool* obj_pool) const override {
const auto to_type = target_type_info->type();
if (to_type == LogicalType::TYPE_INT) {
*output = this;
return Status::OK();
}
CHECK(false) << "Not support, from_type=" << LogicalType::TYPE_INT << ", to_type=" << to_type;
return Status::OK();
}

private:
std::vector<uint8_t> _bit_mask;
};

>>>>>>> 9aeb07ce0d ([BugFix] Fix Unexpected memory copy (#53052))
template <template <typename, size_t...> typename Set, size_t... Args>
ColumnPredicate* new_column_in_predicate_generic(const TypeInfoPtr& type_info, ColumnId id,
const std::vector<std::string>& strs) {
Expand Down

0 comments on commit 78fd261

Please sign in to comment.