]>
Commit | Line | Data |
---|---|---|
1d09f67e TL |
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 | #pragma once | |
19 | ||
20 | #include <cmath> | |
21 | #include <string> | |
22 | ||
23 | #include "arrow/util/logging.h" | |
24 | #include "gandiva/decimal_scalar.h" | |
25 | #include "gandiva/visibility.h" | |
26 | ||
27 | namespace gandiva { | |
28 | ||
29 | class VectorReadValidityDex; | |
30 | class VectorReadFixedLenValueDex; | |
31 | class VectorReadVarLenValueDex; | |
32 | class LocalBitMapValidityDex; | |
33 | class LiteralDex; | |
34 | class TrueDex; | |
35 | class FalseDex; | |
36 | class NonNullableFuncDex; | |
37 | class NullableNeverFuncDex; | |
38 | class NullableInternalFuncDex; | |
39 | class IfDex; | |
40 | class BooleanAndDex; | |
41 | class BooleanOrDex; | |
42 | template <typename Type> | |
43 | class InExprDexBase; | |
44 | ||
45 | /// \brief Visitor for decomposed expression. | |
46 | class GANDIVA_EXPORT DexVisitor { | |
47 | public: | |
48 | virtual ~DexVisitor() = default; | |
49 | ||
50 | virtual void Visit(const VectorReadValidityDex& dex) = 0; | |
51 | virtual void Visit(const VectorReadFixedLenValueDex& dex) = 0; | |
52 | virtual void Visit(const VectorReadVarLenValueDex& dex) = 0; | |
53 | virtual void Visit(const LocalBitMapValidityDex& dex) = 0; | |
54 | virtual void Visit(const TrueDex& dex) = 0; | |
55 | virtual void Visit(const FalseDex& dex) = 0; | |
56 | virtual void Visit(const LiteralDex& dex) = 0; | |
57 | virtual void Visit(const NonNullableFuncDex& dex) = 0; | |
58 | virtual void Visit(const NullableNeverFuncDex& dex) = 0; | |
59 | virtual void Visit(const NullableInternalFuncDex& dex) = 0; | |
60 | virtual void Visit(const IfDex& dex) = 0; | |
61 | virtual void Visit(const BooleanAndDex& dex) = 0; | |
62 | virtual void Visit(const BooleanOrDex& dex) = 0; | |
63 | virtual void Visit(const InExprDexBase<int32_t>& dex) = 0; | |
64 | virtual void Visit(const InExprDexBase<int64_t>& dex) = 0; | |
65 | virtual void Visit(const InExprDexBase<float>& dex) = 0; | |
66 | virtual void Visit(const InExprDexBase<double>& dex) = 0; | |
67 | virtual void Visit(const InExprDexBase<gandiva::DecimalScalar128>& dex) = 0; | |
68 | virtual void Visit(const InExprDexBase<std::string>& dex) = 0; | |
69 | }; | |
70 | ||
71 | /// Default implementation with only DCHECK(). | |
72 | #define VISIT_DCHECK(DEX_CLASS) \ | |
73 | void Visit(const DEX_CLASS& dex) override { DCHECK(0); } | |
74 | ||
75 | class GANDIVA_EXPORT DexDefaultVisitor : public DexVisitor { | |
76 | VISIT_DCHECK(VectorReadValidityDex) | |
77 | VISIT_DCHECK(VectorReadFixedLenValueDex) | |
78 | VISIT_DCHECK(VectorReadVarLenValueDex) | |
79 | VISIT_DCHECK(LocalBitMapValidityDex) | |
80 | VISIT_DCHECK(TrueDex) | |
81 | VISIT_DCHECK(FalseDex) | |
82 | VISIT_DCHECK(LiteralDex) | |
83 | VISIT_DCHECK(NonNullableFuncDex) | |
84 | VISIT_DCHECK(NullableNeverFuncDex) | |
85 | VISIT_DCHECK(NullableInternalFuncDex) | |
86 | VISIT_DCHECK(IfDex) | |
87 | VISIT_DCHECK(BooleanAndDex) | |
88 | VISIT_DCHECK(BooleanOrDex) | |
89 | VISIT_DCHECK(InExprDexBase<int32_t>) | |
90 | VISIT_DCHECK(InExprDexBase<int64_t>) | |
91 | VISIT_DCHECK(InExprDexBase<float>) | |
92 | VISIT_DCHECK(InExprDexBase<double>) | |
93 | VISIT_DCHECK(InExprDexBase<gandiva::DecimalScalar128>) | |
94 | VISIT_DCHECK(InExprDexBase<std::string>) | |
95 | }; | |
96 | ||
97 | } // namespace gandiva |