Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
literal.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_LITERAL_H_
17 #define IMPALA_EXPRS_LITERAL_H_
18 
19 #include <string>
20 #include "exprs/expr.h"
21 #include "exprs/expr-value.h"
22 #include "runtime/string-value.h"
23 
24 namespace impala {
25 
26 class TExprNode;
27 
28 class Literal: public Expr {
29  public:
31  Literal(ColumnType type, bool v);
32  Literal(ColumnType type, int8_t v);
33  Literal(ColumnType type, int16_t v);
34  Literal(ColumnType type, int32_t v);
35  Literal(ColumnType type, int64_t v);
36  Literal(ColumnType type, float v);
37  Literal(ColumnType type, double v);
38  Literal(ColumnType type, const std::string& v);
39  Literal(ColumnType type, const StringValue& v);
40 
43  static Literal* CreateLiteral(const ColumnType& type, const std::string& str);
44 
45  virtual Status GetCodegendComputeFn(RuntimeState* state, llvm::Function** fn);
46 
56 
57  protected:
58  friend class Expr;
59 
60  Literal(const TExprNode& node);
61 
62  virtual std::string DebugString() const;
63 
64  private:
66 };
67 
68 }
69 
70 #endif
virtual impala_udf::IntVal GetIntVal(ExprContext *, TupleRow *)
Definition: literal.cc:257
ExprValue value_
Definition: literal.h:65
The materialized value returned by ExprContext::GetValue().
Definition: expr-value.h:25
virtual impala_udf::StringVal GetStringVal(ExprContext *, TupleRow *)
Definition: literal.cc:277
virtual impala_udf::SmallIntVal GetSmallIntVal(ExprContext *, TupleRow *)
Definition: literal.cc:252
static Literal * CreateLiteral(const ColumnType &type, const std::string &str)
Definition: literal.cc:190
virtual Status GetCodegendComputeFn(RuntimeState *state, llvm::Function **fn)
Definition: literal.cc:356
virtual std::string DebugString() const
Definition: literal.cc:300
virtual impala_udf::DecimalVal GetDecimalVal(ExprContext *, TupleRow *)
Definition: literal.cc:284
virtual impala_udf::BigIntVal GetBigIntVal(ExprContext *, TupleRow *)
Definition: literal.cc:262
This is the superclass of all expr evaluation nodes.
Definition: expr.h:116
virtual impala_udf::BooleanVal GetBooleanVal(ExprContext *, TupleRow *)
Definition: literal.cc:242
virtual impala_udf::FloatVal GetFloatVal(ExprContext *, TupleRow *)
Definition: literal.cc:267
const ColumnType & type() const
Definition: expr.h:145
virtual impala_udf::TinyIntVal GetTinyIntVal(ExprContext *, TupleRow *)
Definition: literal.cc:247
virtual impala_udf::DoubleVal GetDoubleVal(ExprContext *, TupleRow *)
Definition: literal.cc:272
Literal(ColumnType type, bool v)
Test ctors.
Definition: literal.cc:124