ExecExprVisitor.h 1.9 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 19
#include <boost/dynamic_bitset.hpp>
#include <utility>
#include <deque>
#include "segcore/SegmentSmallIndex.h"
G
GuoRentong 已提交
20
#include "query/ExprImpl.h"
N
neza2017 已提交
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
#include "ExprVisitor.h"

namespace milvus::query {
class ExecExprVisitor : ExprVisitor {
 public:
    void
    visit(BoolUnaryExpr& expr) override;

    void
    visit(BoolBinaryExpr& expr) override;

    void
    visit(TermExpr& expr) override;

    void
    visit(RangeExpr& expr) override;

 public:
39
    using RetType = std::deque<boost::dynamic_bitset<>>;
G
GuoRentong 已提交
40
    explicit ExecExprVisitor(segcore::SegmentSmallIndex& segment) : segment_(segment) {
N
neza2017 已提交
41 42 43 44 45 46 47 48 49 50 51
    }
    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 已提交
52
 public:
F
FluorineDog 已提交
53
    template <typename T, typename IndexFunc, typename ElementFunc>
G
GuoRentong 已提交
54
    auto
F
FluorineDog 已提交
55
    ExecRangeVisitorImpl(RangeExprImpl<T>& expr, IndexFunc func, ElementFunc element_func) -> RetType;
G
GuoRentong 已提交
56 57 58 59 60

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

N
neza2017 已提交
61
 private:
G
GuoRentong 已提交
62
    segcore::SegmentSmallIndex& segment_;
N
neza2017 已提交
63 64 65
    std::optional<RetType> ret_;
};
}  // namespace milvus::query