Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
expr-ir.cc
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 #include "exprs/expr.h"
16 #include "udf/udf.h"
17 
18 #ifdef IR_COMPILE
19 
20 // Compile ExprContext declaration to IR so we can use it in codegen'd functions
21 #include "exprs/expr-context.h"
22 
23 // Dummy function to force compilation of UDF types.
24 // The arguments are pointers to prevent Clang from lowering the struct types
25 // (e.g. IntVal={bool, i32} can be coerced to i64).
30 #endif
31 
32 // The following are compute functions that are cross-compiled to both native and IR
33 // libraries. In the interpreted path, these functions are executed as-is from the native
34 // code. In the codegen'd path, we load the IR functions and replace the Get*Val() calls
35 // with the appropriate child's codegen'd compute function.
36 
37 using namespace impala;
38 using namespace impala_udf;
39 // Static wrappers around Get*Val() functions. We'd like to be able to call these from
40 // directly from native code as well as from generated IR functions.
41 
43  return expr->GetBooleanVal(context, row);
44 }
46  return expr->GetTinyIntVal(context, row);
47 }
49  return expr->GetSmallIntVal(context, row);
50 }
52  return expr->GetIntVal(context, row);
53 }
55  return expr->GetBigIntVal(context, row);
56 }
58  return expr->GetFloatVal(context, row);
59 }
61  return expr->GetDoubleVal(context, row);
62 }
64  return expr->GetStringVal(context, row);
65 }
67  return expr->GetTimestampVal(context, row);
68 }
70  return expr->GetDecimalVal(context, row);
71 }
virtual IntVal GetIntVal(ExprContext *context, TupleRow *)
Definition: expr.cc:585
virtual TimestampVal GetTimestampVal(ExprContext *context, TupleRow *)
Definition: expr.cc:605
virtual SmallIntVal GetSmallIntVal(ExprContext *context, TupleRow *)
Definition: expr.cc:581
virtual BooleanVal GetBooleanVal(ExprContext *context, TupleRow *)
Definition: expr.cc:573
virtual DoubleVal GetDoubleVal(ExprContext *context, TupleRow *)
Definition: expr.cc:597
This object has a compatible storage format with boost::ptime.
Definition: udf.h:495
virtual StringVal GetStringVal(ExprContext *context, TupleRow *)
Definition: expr.cc:601
virtual DecimalVal GetDecimalVal(ExprContext *context, TupleRow *)
Definition: expr.cc:609
This is the superclass of all expr evaluation nodes.
Definition: expr.h:116
virtual FloatVal GetFloatVal(ExprContext *context, TupleRow *)
Definition: expr.cc:593
virtual BigIntVal GetBigIntVal(ExprContext *context, TupleRow *)
Definition: expr.cc:589
virtual TinyIntVal GetTinyIntVal(ExprContext *context, TupleRow *)
Definition: expr.cc:577