ExecExprVisitor.h 2.8 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:
F
FluorineDog 已提交
48 49
    ExecExprVisitor(const segcore::SegmentInternalInterface& segment, int64_t row_count, Timestamp timestamp)
        : segment_(segment), row_count_(row_count), timestamp_(timestamp) {
N
neza2017 已提交
50
    }
51 52

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

G
GuoRentong 已提交
62
 public:
F
FluorineDog 已提交
63
    template <typename T, typename IndexFunc, typename ElementFunc>
G
GuoRentong 已提交
64
    auto
65
    ExecRangeVisitorImpl(FieldId field_id, IndexFunc func, ElementFunc element_func) -> BitsetType;
66

67
    template <typename T, typename IndexFunc, typename ElementFunc>
68
    auto
69
    ExecDataRangeVisitorImpl(FieldId field_id, IndexFunc index_func, ElementFunc element_func) -> BitsetType;
70

71 72
    template <typename T>
    auto
73
    ExecUnaryRangeVisitorDispatcher(UnaryRangeExpr& expr_raw) -> BitsetType;
G
GuoRentong 已提交
74

75 76 77 78
    template <typename T>
    auto
    ExecBinaryArithOpEvalRangeVisitorDispatcher(BinaryArithOpEvalRangeExpr& expr_raw) -> BitsetType;

G
GuoRentong 已提交
79 80
    template <typename T>
    auto
81
    ExecBinaryRangeVisitorDispatcher(BinaryRangeExpr& expr_raw) -> BitsetType;
G
GuoRentong 已提交
82

S
sunby 已提交
83 84
    template <typename T>
    auto
85
    ExecTermVisitorImpl(TermExpr& expr_raw) -> BitsetType;
S
sunby 已提交
86

87 88
    template <typename CmpFunc>
    auto
89
    ExecCompareExprDispatcher(CompareExpr& expr, CmpFunc cmp_func) -> BitsetType;
90

N
neza2017 已提交
91
 private:
92
    const segcore::SegmentInternalInterface& segment_;
F
FluorineDog 已提交
93
    Timestamp timestamp_;
94 95 96
    int64_t row_count_;

    BitsetTypeOpt bitset_opt_;
N
neza2017 已提交
97 98
};
}  // namespace milvus::query