Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
udf-test-harness.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-test-harness.h"
16 
17 #include <vector>
18 #include "udf/udf-internal.h"
19 
20 #include "common/names.h"
21 
22 using namespace impala_udf;
23 using namespace impala;
24 
26  const FunctionContext::TypeDesc& return_type,
27  const vector<FunctionContext::TypeDesc>& arg_types) {
28  return FunctionContextImpl::CreateContext(NULL, NULL, return_type, arg_types, 0, true);
29 }
30 
32  FunctionContext* context, const vector<AnyVal*>& constant_args) {
33  if (!context->impl()->debug()) {
34  context->SetError("SetConstantArgs() called on non-test FunctionContext");
35  return;
36  }
37  context->impl()->SetConstantArgs(constant_args);
38 }
39 
41  context->impl()->Close();
42 }
impala::FunctionContextImpl * impl()
TODO: Add mechanism for UDAs to update stats similar to runtime profile counters. ...
Definition: udf.h:202
static FunctionContext * CreateTestContext(const FunctionContext::TypeDesc &return_type, const std::vector< FunctionContext::TypeDesc > &arg_types)
void SetConstantArgs(const std::vector< impala_udf::AnyVal * > &constant_args)
Sets constant_args_. The AnyVal* values are owned by the caller.
Definition: udf.cc:414
static void SetConstantArgs(FunctionContext *context, const std::vector< AnyVal * > &constant_args)
The AnyVal* values are owned by the caller.
void SetError(const char *error_msg)
Definition: udf.cc:332
static void CloseContext(FunctionContext *context)