Coverage Report

Created: 2024-11-21 10:56

/root/doris/be/src/olap/match_predicate.h
Line
Count
Source (jump to first uncovered line)
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
#ifndef DORIS_BE_SRC_QUERY_EXPRS_MATCH_PREDICATE_H
19
#define DORIS_BE_SRC_QUERY_EXPRS_MATCH_PREDICATE_H
20
21
#include <glog/logging.h>
22
#include <stdint.h>
23
24
#include <ostream>
25
#include <string>
26
27
#include "common/status.h"
28
#include "olap/column_predicate.h"
29
#include "olap/schema.h"
30
31
namespace roaring {
32
class Roaring;
33
} // namespace roaring
34
35
namespace doris {
36
37
enum class MatchType;
38
39
namespace segment_v2 {
40
class BitmapIndexIterator;
41
class InvertedIndexIterator;
42
enum class InvertedIndexQueryType;
43
} // namespace segment_v2
44
45
class MatchPredicate : public ColumnPredicate {
46
public:
47
    MatchPredicate(uint32_t column_id, const std::string& value, MatchType match_type);
48
49
    virtual PredicateType type() const override;
50
51
0
    const std::string& get_value() const { return _value; }
52
53
0
    bool support_zonemap() const override { return false; }
54
55
    //evaluate predicate on Bitmap
56
    Status evaluate(BitmapIndexIterator* iterator, uint32_t num_rows,
57
0
                    roaring::Roaring* roaring) const override {
58
0
        LOG(FATAL) << "Not Implemented MatchPredicate::evaluate";
59
0
        __builtin_unreachable();
60
0
    }
61
62
    //evaluate predicate on inverted
63
    Status evaluate(const vectorized::IndexFieldNameAndTypePair& name_with_type,
64
                    InvertedIndexIterator* iterator, uint32_t num_rows,
65
                    roaring::Roaring* bitmap) const override;
66
67
0
    bool can_do_apply_safely(PrimitiveType input_type, bool is_null) const override {
68
0
        return is_string_type(input_type);
69
0
    }
70
71
private:
72
    uint16_t _evaluate_inner(const vectorized::IColumn& column, uint16_t* sel,
73
0
                             uint16_t size) const override {
74
0
        return size;
75
0
    }
76
77
    InvertedIndexQueryType _to_inverted_index_query_type(MatchType match_type) const;
78
0
    std::string _debug_string() const override {
79
0
        std::string info = "MatchPredicate";
80
0
        return info;
81
0
    }
82
    bool _check_evaluate(InvertedIndexIterator* iterator) const;
83
84
private:
85
    std::string _value;
86
    MatchType _match_type;
87
};
88
89
} // namespace doris
90
91
#endif