Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
compound-predicates.h
Go to the documentation of this file.
1 // Copyright 2012 Cloudera Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 
16 #ifndef IMPALA_EXPRS_COMPOUND_PREDICATES_H_
17 #define IMPALA_EXPRS_COMPOUND_PREDICATES_H_
18 
19 #include <string>
20 #include "exprs/predicate.h"
21 #include "gen-cpp/Exprs_types.h"
22 
23 using namespace impala_udf;
24 
25 namespace impala {
26 
28  public:
29  static BooleanVal Not(FunctionContext* context, const BooleanVal&);
30 
31  protected:
32  CompoundPredicate(const TExprNode& node) : Predicate(node) { }
33 
34  Status CodegenComputeFn(bool and_fn, RuntimeState* state, llvm::Function** fn);
35 };
36 
39  public:
40  virtual impala_udf::BooleanVal GetBooleanVal(ExprContext* context, TupleRow*);
41 
42  virtual Status GetCodegendComputeFn(RuntimeState* state, llvm::Function** fn) {
43  return CompoundPredicate::CodegenComputeFn(true, state, fn);
44  }
45 
46  protected:
47  friend class Expr;
48  AndPredicate(const TExprNode& node) : CompoundPredicate(node) { }
49 
50  virtual std::string DebugString() const {
51  std::stringstream out;
52  out << "AndPredicate(" << Expr::DebugString() << ")";
53  return out.str();
54  }
55 
56  private:
57  friend class OpcodeRegistry;
58 };
59 
62  public:
63  virtual impala_udf::BooleanVal GetBooleanVal(ExprContext* context, TupleRow*);
64 
65  virtual Status GetCodegendComputeFn(RuntimeState* state, llvm::Function** fn) {
66  return CompoundPredicate::CodegenComputeFn(false, state, fn);
67  }
68 
69  protected:
70  friend class Expr;
71  OrPredicate(const TExprNode& node) : CompoundPredicate(node) { }
72 
73  virtual std::string DebugString() const {
74  std::stringstream out;
75  out << "OrPredicate(" << Expr::DebugString() << ")";
76  return out.str();
77  }
78 
79  private:
80  friend class OpcodeRegistry;
81 };
82 
83 }
84 
85 #endif
AndPredicate(const TExprNode &node)
virtual std::string DebugString() const
CompoundPredicate(const TExprNode &node)
Expr for evaluating and (&&) operators.
virtual std::string DebugString() const
virtual Status GetCodegendComputeFn(RuntimeState *state, llvm::Function **fn)
virtual Status GetCodegendComputeFn(RuntimeState *state, llvm::Function **fn)
std::string DebugString(const T &val)
Definition: udf-debug.h:27
This is the superclass of all expr evaluation nodes.
Definition: expr.h:116
Expr for evaluating or (||) operators.
OrPredicate(const TExprNode &node)