Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
udf-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 "udf/udf-internal.h"
16 
17 using namespace impala;
18 using namespace impala_udf;
19 
20 bool FunctionContext::IsArgConstant(int i) const {
21  if (i < 0 || i >= impl_->constant_args_.size()) return false;
22  return impl_->constant_args_[i] != NULL;
23 }
24 
26  if (i < 0 || i >= impl_->constant_args_.size()) return NULL;
27  return impl_->constant_args_[i];
28 }
29 
31  return impl_->arg_types_.size();
32 }
33 
35  return impl_->return_type_;
36 }
37 
39  assert(!impl_->closed_);
40  switch (scope) {
41  case THREAD_LOCAL:
43  break;
44  case FRAGMENT_LOCAL:
46  break;
47  default:
48  // TODO: signal error somehow
49  return NULL;
50  }
51 }
std::vector< impala_udf::FunctionContext::TypeDesc > arg_types_
Type descriptors for each argument of the function.
Definition: udf-internal.h:156
const TypeDesc & GetReturnType() const
Definition: udf-ir.cc:34
void * thread_local_fn_state_
The function state accessed via FunctionContext::Get/SetFunctionState()
Definition: udf-internal.h:140
impala_udf::FunctionContext::TypeDesc return_type_
Type descriptor for the return type of the function.
Definition: udf-internal.h:153
bool closed_
Indicates whether this context has been closed. Used for verification/debugging.
Definition: udf-internal.h:170
std::vector< impala_udf::AnyVal * > constant_args_
Definition: udf-internal.h:161
void * GetFunctionState(FunctionStateScope scope) const
Definition: udf-ir.cc:38
bool IsArgConstant(int arg_idx) const
Definition: udf-ir.cc:20
impala::FunctionContextImpl * impl_
Definition: udf.h:214
int GetNumArgs() const
Definition: udf-ir.cc:30
AnyVal * GetConstantArg(int arg_idx) const
Definition: udf-ir.cc:25