Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
hive-udf-call.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_HIVE_UDF_CALL_H
17 #define IMPALA_EXPRS_HIVE_UDF_CALL_H
18 
19 #include <string>
20 #include <boost/scoped_ptr.hpp>
21 
22 #include "exprs/expr.h"
23 
24 using namespace impala_udf;
25 
26 namespace impala {
27 
28 class TExprNode;
29 class RuntimeState;
30 
33 //
39 //
46 //
50 //
55 //
57 class HiveUdfCall : public Expr {
58  public:
59  virtual Status Prepare(RuntimeState* state, const RowDescriptor& row_desc,
60  ExprContext* ctx);
61  virtual Status Open(RuntimeState* state, ExprContext* context,
63  virtual void Close(RuntimeState* state, ExprContext* context,
65 
66  virtual BooleanVal GetBooleanVal(ExprContext* ctx, TupleRow*);
67  virtual TinyIntVal GetTinyIntVal(ExprContext* ctx, TupleRow*);
68  virtual SmallIntVal GetSmallIntVal(ExprContext* ctx, TupleRow*);
69  virtual IntVal GetIntVal(ExprContext* ctx, TupleRow*);
70  virtual BigIntVal GetBigIntVal(ExprContext* ctx, TupleRow*);
71  virtual FloatVal GetFloatVal(ExprContext* ctx, TupleRow*);
72  virtual DoubleVal GetDoubleVal(ExprContext* ctx, TupleRow*);
73  virtual StringVal GetStringVal(ExprContext* ctx, TupleRow*);
74  virtual TimestampVal GetTimestampVal(ExprContext* ctx, TupleRow*);
75  virtual DecimalVal GetDecimalVal(ExprContext* ctx, TupleRow*);
76 
77  virtual Status GetCodegendComputeFn(RuntimeState* state, llvm::Function** fn);
78 
79  protected:
80  friend class Expr;
81  friend class StringFunctions;
82 
83  HiveUdfCall(const TExprNode& node);
84  virtual std::string DebugString() const;
85 
86  private:
90  AnyVal* Evaluate(ExprContext* ctx, TupleRow* row);
91 
93  std::string local_location_;
94 
97  std::vector<int> input_byte_offsets_;
98 
101 };
102 
103 }
104 
105 #endif
If the UDF ran into an error, the FE throws an exception.
Definition: hive-udf-call.h:57
This object has a compatible storage format with boost::ptime.
Definition: udf.h:495
std::string DebugString(const T &val)
Definition: udf-debug.h:27
std::vector< int > input_byte_offsets_
Definition: hive-udf-call.h:97
This is the superclass of all expr evaluation nodes.
Definition: expr.h:116
const RowDescriptor & row_desc() const
std::string local_location_
The path on the local FS to the UDF's jar.
Definition: hive-udf-call.h:93
int input_buffer_size_
The size of the buffer for passing in input arguments.