Coverage Report

Created: 2026-03-25 23:36

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/storage/olap_scan_common.cpp
Line
Count
Source
1
// Licensed to the Apache Software Foundation (ASF) under one
2
// or more contributor license agreements.  See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership.  The ASF licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License.  You may obtain a copy of the License at
8
//
9
//   http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied.  See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
#include "storage/olap_scan_common.h"
19
20
#include <utility>
21
#include <vector>
22
23
#include "storage/olap_utils.h"
24
25
namespace doris {
26
template <>
27
const typename ColumnValueRange<TYPE_FLOAT>::CppType ColumnValueRange<TYPE_FLOAT>::TYPE_MIN =
28
        -std::numeric_limits<float>::infinity();
29
template <>
30
const typename ColumnValueRange<TYPE_FLOAT>::CppType ColumnValueRange<TYPE_FLOAT>::TYPE_MAX =
31
        std::numeric_limits<float>::quiet_NaN();
32
template <>
33
const typename ColumnValueRange<TYPE_DOUBLE>::CppType ColumnValueRange<TYPE_DOUBLE>::TYPE_MIN =
34
        -std::numeric_limits<double>::infinity();
35
template <>
36
const typename ColumnValueRange<TYPE_DOUBLE>::CppType ColumnValueRange<TYPE_DOUBLE>::TYPE_MAX =
37
        std::numeric_limits<double>::quiet_NaN();
38
39
/// Convert the internal scan key pairs (_begin_scan_keys / _end_scan_keys)
40
/// into a vector of OlapScanRange objects that the scanner / tablet reader can consume.
41
///
42
/// Each pair (_begin_scan_keys[i], _end_scan_keys[i]) becomes one OlapScanRange with
43
/// has_lower_bound = true and has_upper_bound = true, because these tuples always
44
/// carry real typed boundary values produced by extend_scan_key().
45
///
46
/// If _begin_scan_keys is empty (no key predicates were pushed down), the caller
47
/// (_init_scanners) will create a single default-constructed OlapScanRange with
48
/// has_lower_bound = false / has_upper_bound = false to represent a full table scan.
49
///
50
/// Example – two scan key pairs from "k1 IN (1, 2) AND k2 = 10":
51
///   _begin_scan_keys = [ (1, 10),  (2, 10)  ]
52
///   _end_scan_keys   = [ (1, 10),  (2, 10)  ]
53
///   => two OlapScanRange objects, both with has_lower_bound=true, has_upper_bound=true.
54
0
Status OlapScanKeys::get_key_range(std::vector<std::unique_ptr<OlapScanRange>>* key_range) {
55
0
    key_range->clear();
56
57
0
    for (int i = 0; i < _begin_scan_keys.size(); ++i) {
58
0
        std::unique_ptr<OlapScanRange> range(new OlapScanRange());
59
0
        range->begin_scan_range = _begin_scan_keys[i];
60
0
        range->end_scan_range = _end_scan_keys[i];
61
0
        range->has_lower_bound = true;
62
0
        range->has_upper_bound = true;
63
0
        range->begin_include = _begin_include;
64
0
        range->end_include = _end_include;
65
0
        key_range->emplace_back(std::move(range));
66
0
    }
67
68
0
    return Status::OK();
69
0
}
70
71
} // namespace doris
72
73
/* vim: set expandtab ts=4 sw=4 sts=4 tw=100: */