Skip to content

Commit

Permalink
feat(boolean columns): selection
Browse files Browse the repository at this point in the history
  • Loading branch information
pflanze committed Apr 11, 2024
1 parent f0aa3e8 commit e52f2dc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/silo/query_engine/operators/selection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,21 @@
#include <utility>
#include <vector>

#include <fmt/format.h>
#include <boost/algorithm/string/join.hpp>
#include <roaring/roaring.hh>

#include "silo/common/date.h"
#include "silo/common/optional_bool.h"
#include "silo/common/string.h"
#include "silo/query_engine/operator_result.h"
#include "silo/query_engine/operators/complement.h"
#include "silo/query_engine/operators/operator.h"

namespace silo::query_engine::operators {

using silo::common::OptionalBool;

Selection::Selection(
std::unique_ptr<Operator>&& child_operator,
std::vector<std::unique_ptr<Predicate>>&& predicates,
Expand Down Expand Up @@ -208,6 +212,11 @@ template <typename T>
return std::make_unique<CompareToValueSelection<T>>(column, negated_comparator, value);
}

template <>
[[nodiscard]] std::string CompareToValueSelection<OptionalBool>::toString() const {
return fmt::format("$bool {} {}", displayComparator(comparator), value.asStr());
}

template <>
[[nodiscard]] std::string CompareToValueSelection<int32_t>::toString() const {
return "$int " + displayComparator(comparator) + " " + std::to_string(value);
Expand Down Expand Up @@ -235,6 +244,7 @@ template <>
return "$double " + displayComparator(comparator) + " " + std::to_string(value);
}

template class CompareToValueSelection<OptionalBool>;
template class CompareToValueSelection<int32_t>;
template class CompareToValueSelection<common::SiloString>;
template class CompareToValueSelection<silo::common::Date>;
Expand Down

0 comments on commit e52f2dc

Please sign in to comment.