ExecExprVisitor.h 2.3 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>
F
FluorineDog 已提交
16 17 18
#include <boost/dynamic_bitset.hpp>
#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 36 37

    void
    visit(TermExpr& expr) override;

    void
    visit(RangeExpr& expr) override;

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

N
neza2017 已提交
41
 public:
42
    using RetType = std::deque<boost::dynamic_bitset<>>;
F
FluorineDog 已提交
43 44
    ExecExprVisitor(const segcore::SegmentInternalInterface& segment, int64_t row_count, Timestamp timestamp)
        : segment_(segment), row_count_(row_count), timestamp_(timestamp) {
N
neza2017 已提交
45 46 47 48 49 50 51 52 53 54 55
    }
    RetType
    call_child(Expr& expr) {
        Assert(!ret_.has_value());
        expr.accept(*this);
        Assert(ret_.has_value());
        auto ret = std::move(ret_);
        ret_ = std::nullopt;
        return std::move(ret.value());
    }

G
GuoRentong 已提交
56
 public:
F
FluorineDog 已提交
57
    template <typename T, typename IndexFunc, typename ElementFunc>
G
GuoRentong 已提交
58
    auto
F
FluorineDog 已提交
59
    ExecRangeVisitorImpl(RangeExprImpl<T>& expr, IndexFunc func, ElementFunc element_func) -> RetType;
G
GuoRentong 已提交
60 61 62 63 64

    template <typename T>
    auto
    ExecRangeVisitorDispatcher(RangeExpr& expr_raw) -> RetType;

S
sunby 已提交
65 66 67 68
    template <typename T>
    auto
    ExecTermVisitorImpl(TermExpr& expr_raw) -> RetType;

69 70 71 72
    template <typename CmpFunc>
    auto
    ExecCompareExprDispatcher(CompareExpr& expr, CmpFunc cmp_func) -> RetType;

N
neza2017 已提交
73
 private:
74 75
    const segcore::SegmentInternalInterface& segment_;
    int64_t row_count_;
N
neza2017 已提交
76
    std::optional<RetType> ret_;
F
FluorineDog 已提交
77
    Timestamp timestamp_;
N
neza2017 已提交
78 79
};
}  // namespace milvus::query