diff --git a/be/src/exec/olap_common.h b/be/src/exec/olap_common.h index dfb85d0f0eb0d0..11be8ab288b145 100644 --- a/be/src/exec/olap_common.h +++ b/be/src/exec/olap_common.h @@ -101,13 +101,9 @@ class ColumnValueRange { ColumnValueRange(); - ColumnValueRange(std::string col_name); - ColumnValueRange(std::string col_name, const CppType& min, const CppType& max, bool contain_null); - ColumnValueRange(std::string col_name, int precision, int scale); - ColumnValueRange(std::string col_name, bool is_nullable_col, int precision, int scale); ColumnValueRange(std::string col_name, const CppType& min, const CppType& max, @@ -131,8 +127,6 @@ class ColumnValueRange { bool is_range_value_convertible() const; - void convert_to_fixed_value(); - void convert_to_range_value(); bool convert_to_avg_range_value(std::vector& begin_scan_keys, @@ -145,8 +139,6 @@ class ColumnValueRange { constexpr bool is_reject_split_type() const { return _is_reject_split_type; } - bool has_intersection(ColumnValueRange& range); - void intersection(ColumnValueRange& range); void set_empty_value_range() { @@ -172,12 +164,8 @@ class ColumnValueRange { bool is_low_value_minimum() const { return Compare::equal(_low_value, TYPE_MIN); } - bool is_low_value_maximum() const { return Compare::equal(_low_value, TYPE_MAX); } - bool is_high_value_maximum() const { return Compare::equal(_high_value, TYPE_MAX); } - bool is_high_value_minimum() const { return Compare::equal(_high_value, TYPE_MIN); } - bool is_begin_include() const { return _low_op == FILTER_LARGER_OR_EQUAL; } bool is_end_include() const { return _high_op == FILTER_LESS_OR_EQUAL; } @@ -186,99 +174,10 @@ class ColumnValueRange { const std::string& column_name() const { return _column_name; } - bool is_nullable_col() const { return _is_nullable_col; } - bool contain_null() const { return _contain_null; } size_t get_fixed_value_size() const { return _fixed_values.size(); } - void to_olap_filter(std::vector>& filters) const { - if (is_fixed_value_range()) { - // 1. convert to in filter condition - to_in_condition(filters, true); - } else if (Compare::less(_low_value, _high_value)) { - // 2. convert to min max filter condition - TCondition null_pred; - if (Compare::equal(TYPE_MAX, _high_value) && _high_op == FILTER_LESS_OR_EQUAL && - Compare::equal(TYPE_MIN, _low_value) && _low_op == FILTER_LARGER_OR_EQUAL && - _is_nullable_col && !contain_null()) { - null_pred.__set_column_name(_column_name); - null_pred.__set_condition_op("is"); - null_pred.condition_values.emplace_back("not null"); - } - - if (null_pred.condition_values.size() != 0) { - filters.emplace_back(_column_name, null_pred, _runtime_filter_id, - _predicate_filtered_rows_counter, - _predicate_input_rows_counter, - _predicate_always_true_rows_counter); - return; - } - - TCondition low; - if (Compare::not_equal(TYPE_MIN, _low_value) || FILTER_LARGER_OR_EQUAL != _low_op) { - low.__set_column_name(_column_name); - low.__set_condition_op((_low_op == FILTER_LARGER_OR_EQUAL ? ">=" : ">>")); - low.condition_values.push_back( - cast_to_string(_low_value, _scale)); - } - - if (low.condition_values.size() != 0) { - filters.emplace_back( - _column_name, low, _runtime_filter_id, _predicate_filtered_rows_counter, - _predicate_input_rows_counter, _predicate_always_true_rows_counter); - } - - TCondition high; - if (Compare::not_equal(TYPE_MAX, _high_value) || FILTER_LESS_OR_EQUAL != _high_op) { - high.__set_column_name(_column_name); - high.__set_condition_op((_high_op == FILTER_LESS_OR_EQUAL ? "<=" : "<<")); - high.condition_values.push_back( - cast_to_string(_high_value, _scale)); - } - - if (high.condition_values.size() != 0) { - filters.emplace_back( - _column_name, high, _runtime_filter_id, _predicate_filtered_rows_counter, - _predicate_input_rows_counter, _predicate_always_true_rows_counter); - } - } else { - // 3. convert to is null and is not null filter condition - TCondition null_pred; - if (Compare::equal(TYPE_MAX, _low_value) && Compare::equal(TYPE_MIN, _high_value) && - _is_nullable_col && contain_null()) { - null_pred.__set_column_name(_column_name); - null_pred.__set_condition_op("is"); - null_pred.condition_values.emplace_back("null"); - } - - if (null_pred.condition_values.size() != 0) { - filters.emplace_back(_column_name, null_pred, _runtime_filter_id, - _predicate_filtered_rows_counter, - _predicate_input_rows_counter, - _predicate_always_true_rows_counter); - } - } - } - - void to_in_condition(std::vector>& filters, - bool is_in = true) const { - TCondition condition; - condition.__set_column_name(_column_name); - condition.__set_condition_op(is_in ? "*=" : "!*="); - - for (const auto& value : _fixed_values) { - condition.condition_values.push_back( - cast_to_string(value, _scale)); - } - - if (condition.condition_values.size() != 0) { - filters.emplace_back(_column_name, condition, _runtime_filter_id, - _predicate_filtered_rows_counter, _predicate_input_rows_counter, - _predicate_always_true_rows_counter); - } - } - void set_whole_value_range() { _fixed_values.clear(); _low_value = TYPE_MIN; @@ -355,14 +254,8 @@ class ColumnValueRange { static ColumnValueRange create_empty_column_value_range(bool is_nullable_col, int precision, int scale) { - return ColumnValueRange::create_empty_column_value_range( - "", is_nullable_col, precision, scale); - } - - static ColumnValueRange create_empty_column_value_range( - const std::string& col_name, bool is_nullable_col, int precision, int scale) { - return ColumnValueRange(col_name, TYPE_MAX, TYPE_MIN, is_nullable_col, - false, precision, scale); + return ColumnValueRange("", TYPE_MAX, TYPE_MIN, is_nullable_col, false, + precision, scale); } protected: @@ -457,23 +350,8 @@ class OlapScanKeys { return _begin_scan_keys.size(); } - void set_begin_include(bool begin_include) { _begin_include = begin_include; } - - bool begin_include() const { return _begin_include; } - - void set_end_include(bool end_include) { _end_include = end_include; } - - bool end_include() const { return _end_include; } - void set_is_convertible(bool is_convertible) { _is_convertible = is_convertible; } - // now, only use in UT - static std::string to_print_key(const OlapTuple& scan_keys) { - std::stringstream sstream; - sstream << scan_keys; - return sstream.str(); - } - private: std::vector _begin_scan_keys; std::vector _end_scan_keys; @@ -508,10 +386,6 @@ template ColumnValueRange::ColumnValueRange() : _column_type(INVALID_TYPE), _precision(-1), _scale(-1) {} -template -ColumnValueRange::ColumnValueRange(std::string col_name) - : ColumnValueRange(std::move(col_name), TYPE_MIN, TYPE_MAX, true) {} - template ColumnValueRange::ColumnValueRange(std::string col_name, const CppType& min, const CppType& max, bool contain_null) @@ -541,10 +415,6 @@ ColumnValueRange::ColumnValueRange(std::string col_name, const C _precision(precision), _scale(scale) {} -template -ColumnValueRange::ColumnValueRange(std::string col_name, int precision, int scale) - : ColumnValueRange(std::move(col_name), TYPE_MIN, TYPE_MAX, true, true, precision, scale) {} - template ColumnValueRange::ColumnValueRange(std::string col_name, bool is_nullable_col, int precision, int scale) @@ -973,77 +843,6 @@ void ColumnValueRange::intersection(ColumnValueRange -bool ColumnValueRange::has_intersection(ColumnValueRange& range) { - // 1. return false if column type not match - if (_column_type != range._column_type) { - return false; - } - - // 2. return false if any range is empty - if (is_empty_value_range() || range.is_empty_value_range()) { - return false; - } - - // 3.1 return false if two int fixedRange has no intersection - if (is_fixed_value_range() && range.is_fixed_value_range()) { - SetType result_values; - set_intersection(_fixed_values.begin(), _fixed_values.end(), range._fixed_values.begin(), - range._fixed_values.end(), - std::inserter(result_values, result_values.begin())); - - if (result_values.size() != 0) { - return true; - } else { - return false; - } - } // 3.2 - else if (is_fixed_value_range() && !range.is_fixed_value_range()) { - IteratorType iter = _fixed_values.begin(); - - while (iter != _fixed_values.end()) { - if (range.is_in_range(*iter)) { - return true; - } - - ++iter; - } - - return false; - } else if (!is_fixed_value_range() && range.is_fixed_value_range()) { - IteratorType iter = range._fixed_values.begin(); - - while (iter != range._fixed_values.end()) { - if (this->is_in_range(*iter)) { - return true; - } - - ++iter; - } - - return false; - } else { - if (Compare::greater(_low_value, range._high_value) || - Compare::greater(range._low_value, _high_value)) { - return false; - } else if (Compare::equal(_low_value, range._high_value)) { - if (FILTER_LARGER_OR_EQUAL == _low_op && FILTER_LESS_OR_EQUAL == range._high_op) { - return true; - } else { - return false; - } - } else if (Compare::equal(range._low_value, _high_value)) { - if (FILTER_LARGER_OR_EQUAL == range._low_op && FILTER_LESS_OR_EQUAL == _high_op) { - return true; - } else { - return false; - } - } else { - return true; - } - } -} - template Status OlapScanKeys::extend_scan_key(ColumnValueRange& range, int32_t max_scan_key_num, bool* exact_value, bool* eos, @@ -1198,10 +997,5 @@ Status OlapScanKeys::extend_scan_key(ColumnValueRange& range, return Status::OK(); } -struct ScanPredicate { - TCondition condition; - PrimitiveType primitiveType; -}; - #include "common/compile_check_end.h" } // namespace doris diff --git a/be/src/pipeline/exec/olap_scan_operator.cpp b/be/src/pipeline/exec/olap_scan_operator.cpp index f96f372d26c01a..f8407b48745b00 100644 --- a/be/src/pipeline/exec/olap_scan_operator.cpp +++ b/be/src/pipeline/exec/olap_scan_operator.cpp @@ -887,7 +887,7 @@ Status OlapScanLocalState::_build_key_ranges_and_filters() { break; } DCHECK(_slot_id_to_predicates.count(iter->first) > 0); - const auto& value_range = iter->second.second; + const auto& value_range = iter->second; RETURN_IF_ERROR(std::visit( [&](auto&& range) { diff --git a/be/src/pipeline/exec/scan_operator.cpp b/be/src/pipeline/exec/scan_operator.cpp index 54f652af0f7480..fa7ad6c6d5a8ee 100644 --- a/be/src/pipeline/exec/scan_operator.cpp +++ b/be/src/pipeline/exec/scan_operator.cpp @@ -197,7 +197,7 @@ Status ScanLocalState::_normalize_conjuncts(RuntimeState* state) { ColumnValueRange range(slot->col_name(), slot->is_nullable(), \ cast_set(type_desc->get_precision()), \ cast_set(type_desc->get_scale())); \ - _slot_id_to_value_range[slot->id()] = std::pair {slot, range}; \ + _slot_id_to_value_range[slot->id()] = std::move(range); \ break; \ } #define APPLY_FOR_PRIMITIVE_TYPE(M) \ @@ -289,7 +289,7 @@ Status ScanLocalState::_normalize_conjuncts(RuntimeState* state) { _scan_dependency->set_ready(); } }, - it.second.second); + it.second); } return Status::OK(); @@ -542,7 +542,7 @@ bool ScanLocalState::_is_predicate_acting_on_slot( if (_slot_id_to_value_range.end() == sid_to_range) { return false; } - *range = &(sid_to_range->second.second); + *range = &(sid_to_range->second); SlotDescriptor* src_slot_desc = p._slot_id_to_slot_desc[slot_ref->slot_id()]; DCHECK(child_contains_slot != nullptr); if (child_contains_slot->data_type()->get_primitive_type() != diff --git a/be/src/pipeline/exec/scan_operator.h b/be/src/pipeline/exec/scan_operator.h index 32506b7b110b24..f1c54efa80aa9e 100644 --- a/be/src/pipeline/exec/scan_operator.h +++ b/be/src/pipeline/exec/scan_operator.h @@ -324,8 +324,7 @@ class ScanLocalState : public ScanLocalStateBase { // slot id -> ColumnValueRange // Parsed from conjuncts - phmap::flat_hash_map> - _slot_id_to_value_range; + phmap::flat_hash_map _slot_id_to_value_range; phmap::flat_hash_map>> _slot_id_to_predicates; std::atomic _eos = false; diff --git a/be/test/pipeline/operator/scan_normalize_predicate_test.cpp b/be/test/pipeline/operator/scan_normalize_predicate_test.cpp index 809e08581702bd..1e1041b407e069 100644 --- a/be/test/pipeline/operator/scan_normalize_predicate_test.cpp +++ b/be/test/pipeline/operator/scan_normalize_predicate_test.cpp @@ -176,9 +176,9 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot1) { PrimitiveType::TYPE_BIGINT, false); ColumnValueRange range("mock", false, 0, 0); - local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range); + local_state->_slot_id_to_value_range[SlotId] = range; local_state->_slot_id_to_predicates[SlotId] = std::vector>(); - op->_slot_id_to_slot_desc[SlotId] = local_state->_slot_id_to_value_range[SlotId].first; + op->_slot_id_to_slot_desc[SlotId] = &slot_desc; { auto slot_ref = std::make_shared(0, std::make_shared()); @@ -205,7 +205,7 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot1) { EXPECT_TRUE(local_state->_slot_id_to_value_range.contains(SlotId)); - auto& output_range = local_state->_slot_id_to_value_range[SlotId].second; + auto& output_range = local_state->_slot_id_to_value_range[SlotId]; std::visit( [](auto&& arg) { @@ -234,9 +234,9 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot2) { PrimitiveType::TYPE_BIGINT, false); ColumnValueRange range("mock", false, 0, 0); - local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range); + local_state->_slot_id_to_value_range[SlotId] = range; local_state->_slot_id_to_predicates[SlotId] = std::vector>(); - op->_slot_id_to_slot_desc[SlotId] = local_state->_slot_id_to_value_range[SlotId].first; + op->_slot_id_to_slot_desc[SlotId] = &slot_desc; { auto slot_ref = std::make_shared(0, std::make_shared()); @@ -286,7 +286,7 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot2) { EXPECT_TRUE(local_state->_slot_id_to_value_range.contains(SlotId)); - auto& output_range = local_state->_slot_id_to_value_range[SlotId].second; + auto& output_range = local_state->_slot_id_to_value_range[SlotId]; std::visit( [](auto&& arg) { @@ -314,9 +314,9 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot3) { PrimitiveType::TYPE_BIGINT, false); ColumnValueRange range("mock", false, 0, 0); - local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range); + local_state->_slot_id_to_value_range[SlotId] = range; local_state->_slot_id_to_predicates[SlotId] = std::vector>(); - op->_slot_id_to_slot_desc[SlotId] = local_state->_slot_id_to_value_range[SlotId].first; + op->_slot_id_to_slot_desc[SlotId] = &slot_desc; local_state->_scan_dependency = Dependency::create_shared(0, 0, "DEPENDENCY"); @@ -359,9 +359,9 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot4) { PrimitiveType::TYPE_BIGINT, false); ColumnValueRange range("mock", false, 0, 0); - local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range); + local_state->_slot_id_to_value_range[SlotId] = range; local_state->_slot_id_to_predicates[SlotId] = std::vector>(); - op->_slot_id_to_slot_desc[SlotId] = local_state->_slot_id_to_value_range[SlotId].first; + op->_slot_id_to_slot_desc[SlotId] = &slot_desc; { auto slot_ref = std::make_shared(0, std::make_shared()); @@ -383,7 +383,7 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot4) { EXPECT_TRUE(local_state->_slot_id_to_value_range.contains(SlotId)); - auto& output_range = local_state->_slot_id_to_value_range[SlotId].second; + auto& output_range = local_state->_slot_id_to_value_range[SlotId]; std::visit( [](auto&& arg) { @@ -416,9 +416,9 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot5) { PrimitiveType::TYPE_BIGINT, false); ColumnValueRange range("mock", false, 0, 0); - local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range); + local_state->_slot_id_to_value_range[SlotId] = range; local_state->_slot_id_to_predicates[SlotId] = std::vector>(); - op->_slot_id_to_slot_desc[SlotId] = local_state->_slot_id_to_value_range[SlotId].first; + op->_slot_id_to_slot_desc[SlotId] = &slot_desc; { auto slot_ref = std::make_shared(0, std::make_shared()); @@ -440,7 +440,7 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot5) { EXPECT_TRUE(local_state->_slot_id_to_value_range.contains(SlotId)); - auto& output_range = local_state->_slot_id_to_value_range[SlotId].second; + auto& output_range = local_state->_slot_id_to_value_range[SlotId]; std::visit( [](auto&& arg) { @@ -473,9 +473,9 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot6) { PrimitiveType::TYPE_BIGINT, false); ColumnValueRange range("mock", false, 0, 0); - local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range); + local_state->_slot_id_to_value_range[SlotId] = range; local_state->_slot_id_to_predicates[SlotId] = std::vector>(); - op->_slot_id_to_slot_desc[SlotId] = local_state->_slot_id_to_value_range[SlotId].first; + op->_slot_id_to_slot_desc[SlotId] = &slot_desc; { auto slot_ref = std::make_shared(0, std::make_shared()); @@ -503,7 +503,7 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot6) { EXPECT_TRUE(local_state->_slot_id_to_value_range.contains(SlotId)); - auto& output_range = local_state->_slot_id_to_value_range[SlotId].second; + auto& output_range = local_state->_slot_id_to_value_range[SlotId]; std::visit( [](auto&& arg) { @@ -530,9 +530,9 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot7) { PrimitiveType::TYPE_BIGINT, false); ColumnValueRange range("mock", false, 0, 0); - local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range); + local_state->_slot_id_to_value_range[SlotId] = range; local_state->_slot_id_to_predicates[SlotId] = std::vector>(); - op->_slot_id_to_slot_desc[SlotId] = local_state->_slot_id_to_value_range[SlotId].first; + op->_slot_id_to_slot_desc[SlotId] = &slot_desc; { auto slot_ref = std::make_shared(0, std::make_shared()); @@ -587,9 +587,9 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot8) { EXPECT_TRUE(range.add_fixed_value(100)); EXPECT_TRUE(range.add_fixed_value(1000)); - local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range); + local_state->_slot_id_to_value_range[SlotId] = range; local_state->_slot_id_to_predicates[SlotId] = std::vector>(); - op->_slot_id_to_slot_desc[SlotId] = local_state->_slot_id_to_value_range[SlotId].first; + op->_slot_id_to_slot_desc[SlotId] = &slot_desc; { auto slot_ref = std::make_shared(0, std::make_shared()); @@ -609,7 +609,7 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot8) { EXPECT_TRUE(local_state->_normalize_predicate(conjunct_expr_root.get(), new_root)); } - auto& output_range = local_state->_slot_id_to_value_range[SlotId].second; + auto& output_range = local_state->_slot_id_to_value_range[SlotId]; std::visit( [](auto&& arg) { using T = std::decay_t; @@ -639,9 +639,9 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot10) { ColumnValueRange range("mock", false, 0, 0); - local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range); + local_state->_slot_id_to_value_range[SlotId] = range; local_state->_slot_id_to_predicates[SlotId] = std::vector>(); - op->_slot_id_to_slot_desc[SlotId] = local_state->_slot_id_to_value_range[SlotId].first; + op->_slot_id_to_slot_desc[SlotId] = &slot_desc; { auto slot_ref = std::make_shared(0, std::make_shared()); @@ -677,9 +677,9 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot11) { ColumnValueRange range("mock", false, 0, 0); - local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range); + local_state->_slot_id_to_value_range[SlotId] = range; local_state->_slot_id_to_predicates[SlotId] = std::vector>(); - op->_slot_id_to_slot_desc[SlotId] = local_state->_slot_id_to_value_range[SlotId].first; + op->_slot_id_to_slot_desc[SlotId] = &slot_desc; { auto slot_ref = std::make_shared(0, std::make_shared()); @@ -721,9 +721,9 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot12) { EXPECT_TRUE(range.add_fixed_value(10)); EXPECT_TRUE(range.add_fixed_value(100)); - local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range); + local_state->_slot_id_to_value_range[SlotId] = range; local_state->_slot_id_to_predicates[SlotId] = std::vector>(); - op->_slot_id_to_slot_desc[SlotId] = local_state->_slot_id_to_value_range[SlotId].first; + op->_slot_id_to_slot_desc[SlotId] = &slot_desc; { auto slot_ref = std::make_shared(0, std::make_shared()); @@ -746,7 +746,7 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot12) { EXPECT_TRUE(local_state->_normalize_predicate(conjunct_expr_root.get(), new_root)); } - auto& output_range = local_state->_slot_id_to_value_range[SlotId].second; + auto& output_range = local_state->_slot_id_to_value_range[SlotId]; std::visit( [](auto&& arg) { using T = std::decay_t; @@ -777,9 +777,9 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot13) { EXPECT_TRUE(range.add_fixed_value(10)); EXPECT_TRUE(range.add_fixed_value(100)); - local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range); + local_state->_slot_id_to_value_range[SlotId] = range; local_state->_slot_id_to_predicates[SlotId] = std::vector>(); - op->_slot_id_to_slot_desc[SlotId] = local_state->_slot_id_to_value_range[SlotId].first; + op->_slot_id_to_slot_desc[SlotId] = &slot_desc; { auto slot_ref = std::make_shared(0, std::make_shared()); @@ -802,7 +802,7 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot13) { EXPECT_TRUE(local_state->_normalize_predicate(conjunct_expr_root.get(), new_root)); } - auto& output_range = local_state->_slot_id_to_value_range[SlotId].second; + auto& output_range = local_state->_slot_id_to_value_range[SlotId]; std::visit( [](auto&& arg) { using T = std::decay_t; @@ -833,9 +833,9 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot14) { EXPECT_TRUE(range.add_fixed_value(10)); EXPECT_TRUE(range.add_fixed_value(100)); - local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range); + local_state->_slot_id_to_value_range[SlotId] = range; local_state->_slot_id_to_predicates[SlotId] = std::vector>(); - op->_slot_id_to_slot_desc[SlotId] = local_state->_slot_id_to_value_range[SlotId].first; + op->_slot_id_to_slot_desc[SlotId] = &slot_desc; { auto slot_ref = std::make_shared(0, std::make_shared()); @@ -858,7 +858,7 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot14) { EXPECT_TRUE(local_state->_normalize_predicate(conjunct_expr_root.get(), new_root)); } - auto& output_range = local_state->_slot_id_to_value_range[SlotId].second; + auto& output_range = local_state->_slot_id_to_value_range[SlotId]; std::visit( [](auto&& arg) { using T = std::decay_t; @@ -893,9 +893,9 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot15) { EXPECT_TRUE(range.add_fixed_value(10)); EXPECT_TRUE(range.add_fixed_value(100)); - local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range); + local_state->_slot_id_to_value_range[SlotId] = range; local_state->_slot_id_to_predicates[SlotId] = std::vector>(); - op->_slot_id_to_slot_desc[SlotId] = local_state->_slot_id_to_value_range[SlotId].first; + op->_slot_id_to_slot_desc[SlotId] = &slot_desc; { auto slot_ref = std::make_shared(0, std::make_shared()); @@ -918,7 +918,7 @@ TEST_F(ScanNormalizePredicate, test_is_predicate_acting_on_slot15) { EXPECT_TRUE(local_state->_normalize_predicate(conjunct_expr_root.get(), new_root)); } - auto& output_range = local_state->_slot_id_to_value_range[SlotId].second; + auto& output_range = local_state->_slot_id_to_value_range[SlotId]; std::visit( [](auto&& arg) { using T = std::decay_t; @@ -958,10 +958,10 @@ TEST_F(ScanNormalizePredicate, test_double_predicate) { for (auto const_v : test_values) { auto local_state = std::make_shared(state.get(), op.get()); ColumnValueRange range("mock", false, 0, 0); - local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range); + local_state->_slot_id_to_value_range[SlotId] = range; local_state->_slot_id_to_predicates[SlotId] = std::vector>(); - op->_slot_id_to_slot_desc[SlotId] = local_state->_slot_id_to_value_range[SlotId].first; + op->_slot_id_to_slot_desc[SlotId] = &slot_desc; auto slot_ref = std::make_shared(0, std::make_shared()); auto fn_eq = MockFnCall::create("eq"); @@ -985,7 +985,7 @@ TEST_F(ScanNormalizePredicate, test_double_predicate) { EXPECT_EQ(new_root, nullptr); EXPECT_TRUE(local_state->_slot_id_to_value_range.contains(SlotId)); - const auto& output_range = local_state->_slot_id_to_value_range[SlotId].second; + const auto& output_range = local_state->_slot_id_to_value_range[SlotId]; std::visit( [&](auto&& arg) { using T = std::decay_t; @@ -1003,10 +1003,10 @@ TEST_F(ScanNormalizePredicate, test_double_predicate) { { auto local_state = std::make_shared(state.get(), op.get()); ColumnValueRange range("mock", false, 0, 0); - local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range); + local_state->_slot_id_to_value_range[SlotId] = range; local_state->_slot_id_to_predicates[SlotId] = std::vector>(); - op->_slot_id_to_slot_desc[SlotId] = local_state->_slot_id_to_value_range[SlotId].first; + op->_slot_id_to_slot_desc[SlotId] = &slot_desc; auto slot_ref = std::make_shared(0, std::make_shared()); auto ctx = MockInExpr::create_with_ctx( ColumnHelper::create_column(test_values)); @@ -1026,7 +1026,7 @@ TEST_F(ScanNormalizePredicate, test_double_predicate) { EXPECT_EQ(new_root, nullptr); EXPECT_TRUE(local_state->_slot_id_to_value_range.contains(SlotId)); - auto& output_range = local_state->_slot_id_to_value_range[SlotId].second; + auto& output_range = local_state->_slot_id_to_value_range[SlotId]; std::visit( [&](auto&& arg) { using T = std::decay_t; @@ -1042,10 +1042,10 @@ TEST_F(ScanNormalizePredicate, test_double_predicate) { for (auto const_v : test_values) { auto local_state = std::make_shared(state.get(), op.get()); ColumnValueRange range("mock", false, 0, 0); - local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range); + local_state->_slot_id_to_value_range[SlotId] = range; local_state->_slot_id_to_predicates[SlotId] = std::vector>(); - op->_slot_id_to_slot_desc[SlotId] = local_state->_slot_id_to_value_range[SlotId].first; + op->_slot_id_to_slot_desc[SlotId] = &slot_desc; auto slot_ref = std::make_shared(0, std::make_shared()); auto fn_eq = MockFnCall::create("ne"); auto const_val = std::make_shared( @@ -1071,10 +1071,10 @@ TEST_F(ScanNormalizePredicate, test_double_predicate) { { auto local_state = std::make_shared(state.get(), op.get()); ColumnValueRange range("mock", false, 0, 0); - local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range); + local_state->_slot_id_to_value_range[SlotId] = range; local_state->_slot_id_to_predicates[SlotId] = std::vector>(); - op->_slot_id_to_slot_desc[SlotId] = local_state->_slot_id_to_value_range[SlotId].first; + op->_slot_id_to_slot_desc[SlotId] = &slot_desc; auto slot_ref = std::make_shared(0, std::make_shared()); auto ctx = MockInExpr::create_with_ctx( ColumnHelper::create_column(test_values), true); @@ -1098,7 +1098,7 @@ TEST_F(ScanNormalizePredicate, test_double_predicate) { { auto local_state = std::make_shared(state.get(), op.get()); ColumnValueRange range("mock", true, 0, 0); - local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&nullable_slot_desc, range); + local_state->_slot_id_to_value_range[SlotId] = range; auto slot_ref = std::make_shared( 0, std::make_shared(std::make_shared())); auto fn_eq = MockFnCall::create("is_null_pred"); @@ -1115,7 +1115,7 @@ TEST_F(ScanNormalizePredicate, test_double_predicate) { vectorized::VExprSPtr new_root; auto conjunct_expr_root = ctx; EXPECT_TRUE(local_state->_normalize_predicate(conjunct_expr_root.get(), new_root)); - auto& output_range = local_state->_slot_id_to_value_range[SlotId].second; + auto& output_range = local_state->_slot_id_to_value_range[SlotId]; std::visit( [](auto&& arg) { using T = std::decay_t; @@ -1150,7 +1150,7 @@ TEST_F(ScanNormalizePredicate, test_double_predicate) { // vectorized::VExprSPtr new_root; // auto conjunct_expr_root = ctx; // EXPECT_TRUE(local_state->_normalize_predicate(conjunct_expr_root.get(), new_root)); - // auto& output_range = local_state->_slot_id_to_value_range[SlotId].second; + // auto& output_range = local_state->_slot_id_to_value_range[SlotId]; // std::visit( // [](auto&& arg) { // using T = std::decay_t; @@ -1168,10 +1168,10 @@ TEST_F(ScanNormalizePredicate, test_double_predicate) { // std::cout << "test less const_v=" << const_v << std::endl; auto local_state = std::make_shared(state.get(), op.get()); ColumnValueRange range("mock", false, 0, 0); - local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range); + local_state->_slot_id_to_value_range[SlotId] = range; local_state->_slot_id_to_predicates[SlotId] = std::vector>(); - op->_slot_id_to_slot_desc[SlotId] = local_state->_slot_id_to_value_range[SlotId].first; + op->_slot_id_to_slot_desc[SlotId] = &slot_desc; auto slot_ref = std::make_shared(0, std::make_shared()); auto fn_eq = MockFnCall::create("lt"); @@ -1195,7 +1195,7 @@ TEST_F(ScanNormalizePredicate, test_double_predicate) { EXPECT_EQ(new_root, nullptr); EXPECT_TRUE(local_state->_slot_id_to_value_range.contains(SlotId)); - const auto& output_range = local_state->_slot_id_to_value_range[SlotId].second; + const auto& output_range = local_state->_slot_id_to_value_range[SlotId]; /* _low_value = -inf, _high_value = 90, @@ -1227,10 +1227,10 @@ TEST_F(ScanNormalizePredicate, test_double_predicate) { // std::cout << "test less or equal const_v=" << const_v << std::endl; auto local_state = std::make_shared(state.get(), op.get()); ColumnValueRange range("mock", false, 0, 0); - local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range); + local_state->_slot_id_to_value_range[SlotId] = range; local_state->_slot_id_to_predicates[SlotId] = std::vector>(); - op->_slot_id_to_slot_desc[SlotId] = local_state->_slot_id_to_value_range[SlotId].first; + op->_slot_id_to_slot_desc[SlotId] = &slot_desc; auto slot_ref = std::make_shared(0, std::make_shared()); auto fn_eq = MockFnCall::create("le"); @@ -1254,7 +1254,7 @@ TEST_F(ScanNormalizePredicate, test_double_predicate) { EXPECT_EQ(new_root, nullptr); EXPECT_TRUE(local_state->_slot_id_to_value_range.contains(SlotId)); - const auto& output_range = local_state->_slot_id_to_value_range[SlotId].second; + const auto& output_range = local_state->_slot_id_to_value_range[SlotId]; std::visit( [&](auto&& arg) { using T = std::decay_t; @@ -1283,10 +1283,10 @@ TEST_F(ScanNormalizePredicate, test_double_predicate) { // std::cout << "test greater const_v=" << const_v << std::endl; auto local_state = std::make_shared(state.get(), op.get()); ColumnValueRange range("mock", false, 0, 0); - local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range); + local_state->_slot_id_to_value_range[SlotId] = range; local_state->_slot_id_to_predicates[SlotId] = std::vector>(); - op->_slot_id_to_slot_desc[SlotId] = local_state->_slot_id_to_value_range[SlotId].first; + op->_slot_id_to_slot_desc[SlotId] = &slot_desc; auto slot_ref = std::make_shared(0, std::make_shared()); auto fn_eq = MockFnCall::create("gt"); @@ -1310,7 +1310,7 @@ TEST_F(ScanNormalizePredicate, test_double_predicate) { EXPECT_EQ(new_root, nullptr); EXPECT_TRUE(local_state->_slot_id_to_value_range.contains(SlotId)); - const auto& output_range = local_state->_slot_id_to_value_range[SlotId].second; + const auto& output_range = local_state->_slot_id_to_value_range[SlotId]; /* _low_value = 90, _high_value = nan, @@ -1342,10 +1342,10 @@ TEST_F(ScanNormalizePredicate, test_double_predicate) { // std::cout << "test greater or equal const_v=" << const_v << std::endl; auto local_state = std::make_shared(state.get(), op.get()); ColumnValueRange range("mock", false, 0, 0); - local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range); + local_state->_slot_id_to_value_range[SlotId] = range; local_state->_slot_id_to_predicates[SlotId] = std::vector>(); - op->_slot_id_to_slot_desc[SlotId] = local_state->_slot_id_to_value_range[SlotId].first; + op->_slot_id_to_slot_desc[SlotId] = &slot_desc; auto slot_ref = std::make_shared(0, std::make_shared()); auto fn_eq = MockFnCall::create("ge"); @@ -1369,7 +1369,7 @@ TEST_F(ScanNormalizePredicate, test_double_predicate) { EXPECT_EQ(new_root, nullptr); EXPECT_TRUE(local_state->_slot_id_to_value_range.contains(SlotId)); - const auto& output_range = local_state->_slot_id_to_value_range[SlotId].second; + const auto& output_range = local_state->_slot_id_to_value_range[SlotId]; std::visit( [&](auto&& arg) { using T = std::decay_t;