ExecExprVisitor.h 3.1 KB
Newer Older
F
FluorineDog 已提交
1 2 3 4 5 6 7 8 9 10 11
// Copyright (C) 2019-2020 Zilliz. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the License
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied. See the License for the specific language governing permissions and limitations under the License

N
neza2017 已提交
12 13 14 15
#pragma once
// Generated File
// DO NOT EDIT
#include <optional>
16
#include <boost/variant.hpp>
F
FluorineDog 已提交
17 18
#include <utility>
#include <deque>
19
#include "segcore/SegmentGrowingImpl.h"
G
GuoRentong 已提交
20
#include "query/ExprImpl.h"
N
neza2017 已提交
21 22 23
#include "ExprVisitor.h"

namespace milvus::query {
N
neza2017 已提交
24
class ExecExprVisitor : public ExprVisitor {
N
neza2017 已提交
25 26
 public:
    void
F
FluorineDog 已提交
27
    visit(LogicalUnaryExpr& expr) override;
N
neza2017 已提交
28 29

    void
F
FluorineDog 已提交
30
    visit(LogicalBinaryExpr& expr) override;
N
neza2017 已提交
31 32 33 34 35

    void
    visit(TermExpr& expr) override;

    void
36 37
    visit(UnaryRangeExpr& expr) override;

38 39 40
    void
    visit(BinaryArithOpEvalRangeExpr& expr) override;

41 42
    void
    visit(BinaryRangeExpr& expr) override;
N
neza2017 已提交
43

44 45 46
    void
    visit(CompareExpr& expr) override;

N
neza2017 已提交
47
 public:
Y
yah01 已提交
48 49 50
    ExecExprVisitor(const segcore::SegmentInternalInterface& segment,
                    int64_t row_count,
                    Timestamp timestamp)
F
FluorineDog 已提交
51
        : segment_(segment), row_count_(row_count), timestamp_(timestamp) {
N
neza2017 已提交
52
    }
53 54

    BitsetType
N
neza2017 已提交
55
    call_child(Expr& expr) {
56
        Assert(!bitset_opt_.has_value());
N
neza2017 已提交
57
        expr.accept(*this);
58 59 60
        Assert(bitset_opt_.has_value());
        auto res = std::move(bitset_opt_);
        bitset_opt_ = std::nullopt;
61
        return std::move(res.value());
N
neza2017 已提交
62 63
    }

G
GuoRentong 已提交
64
 public:
F
FluorineDog 已提交
65
    template <typename T, typename IndexFunc, typename ElementFunc>
G
GuoRentong 已提交
66
    auto
Y
yah01 已提交
67 68 69
    ExecRangeVisitorImpl(FieldId field_id,
                         IndexFunc func,
                         ElementFunc element_func) -> BitsetType;
70

71
    template <typename T, typename IndexFunc, typename ElementFunc>
72
    auto
Y
yah01 已提交
73 74 75
    ExecDataRangeVisitorImpl(FieldId field_id,
                             IndexFunc index_func,
                             ElementFunc element_func) -> BitsetType;
76

77 78
    template <typename T>
    auto
79
    ExecUnaryRangeVisitorDispatcher(UnaryRangeExpr& expr_raw) -> BitsetType;
G
GuoRentong 已提交
80

81 82
    template <typename T>
    auto
Y
yah01 已提交
83 84
    ExecBinaryArithOpEvalRangeVisitorDispatcher(
        BinaryArithOpEvalRangeExpr& expr_raw) -> BitsetType;
85

G
GuoRentong 已提交
86 87
    template <typename T>
    auto
88
    ExecBinaryRangeVisitorDispatcher(BinaryRangeExpr& expr_raw) -> BitsetType;
G
GuoRentong 已提交
89

S
sunby 已提交
90 91
    template <typename T>
    auto
92
    ExecTermVisitorImpl(TermExpr& expr_raw) -> BitsetType;
S
sunby 已提交
93

94 95 96 97
    template <typename T>
    auto
    ExecTermVisitorImplTemplate(TermExpr& expr_raw) -> BitsetType;

98 99
    template <typename CmpFunc>
    auto
Y
yah01 已提交
100 101
    ExecCompareExprDispatcher(CompareExpr& expr, CmpFunc cmp_func)
        -> BitsetType;
102

N
neza2017 已提交
103
 private:
104
    const segcore::SegmentInternalInterface& segment_;
F
FluorineDog 已提交
105
    Timestamp timestamp_;
106 107 108
    int64_t row_count_;

    BitsetTypeOpt bitset_opt_;
N
neza2017 已提交
109 110
};
}  // namespace milvus::query