Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
Utility class to help test UDFs. More...
#include <udf-test-harness.h>
Static Public Member Functions | |
static FunctionContext * | CreateTestContext (const FunctionContext::TypeDesc &return_type, const std::vector< FunctionContext::TypeDesc > &arg_types) |
static void | SetConstantArgs (FunctionContext *context, const std::vector< AnyVal * > &constant_args) |
The AnyVal* values are owned by the caller. More... | |
static void | CloseContext (FunctionContext *context) |
template<typename RET > | |
static bool | ValidateUdf (boost::function< RET(FunctionContext *)> fn, const RET &expected, UdfPrepare init_fn=NULL, UdfClose close_fn=NULL, const std::vector< AnyVal * > &constant_args=std::vector< AnyVal * >()) |
template<typename RET , typename A1 > | |
static bool | ValidateUdf (boost::function< RET(FunctionContext *, const A1 &)> fn, const A1 &a1, const RET &expected, UdfPrepare init_fn=NULL, UdfClose close_fn=NULL, const std::vector< AnyVal * > &constant_args=std::vector< AnyVal * >()) |
template<typename RET , typename A1 > | |
static bool | ValidateUdf (boost::function< RET(FunctionContext *, int, const A1 *)> fn, const std::vector< A1 > &a1, const RET &expected, UdfPrepare init_fn=NULL, UdfClose close_fn=NULL, const std::vector< AnyVal * > &constant_args=std::vector< AnyVal * >()) |
template<typename RET , typename A1 , typename A2 > | |
static bool | ValidateUdf (boost::function< RET(FunctionContext *, const A1 &, const A2 &)> fn, const A1 &a1, const A2 &a2, const RET &expected, UdfPrepare init_fn=NULL, UdfClose close_fn=NULL, const std::vector< AnyVal * > &constant_args=std::vector< AnyVal * >()) |
template<typename RET , typename A1 , typename A2 > | |
static bool | ValidateUdf (boost::function< RET(FunctionContext *, const A1 &, int, const A2 *)> fn, const A1 &a1, const std::vector< A2 > &a2, const RET &expected, UdfPrepare init_fn=NULL, UdfClose close_fn=NULL, const std::vector< AnyVal * > &constant_args=std::vector< AnyVal * >()) |
template<typename RET , typename A1 , typename A2 , typename A3 > | |
static bool | ValidateUdf (boost::function< RET(FunctionContext *, const A1 &, const A2 &, const A3 &)> fn, const A1 &a1, const A2 &a2, const A3 &a3, const RET &expected, UdfPrepare init_fn=NULL, UdfClose close_fn=NULL, const std::vector< AnyVal * > &constant_args=std::vector< AnyVal * >()) |
template<typename RET , typename A1 , typename A2 , typename A3 > | |
static bool | ValidateUdf (boost::function< RET(FunctionContext *, const A1 &, const A2 &, int, const A3 *)> fn, const A1 &a1, const A2 &a2, const std::vector< A3 > &a3, const RET &expected, UdfPrepare init_fn=NULL, UdfClose close_fn=NULL, const std::vector< AnyVal * > &constant_args=std::vector< AnyVal * >()) |
template<typename RET , typename A1 , typename A2 , typename A3 , typename A4 > | |
static bool | ValidateUdf (boost::function< RET(FunctionContext *, const A1 &, const A2 &, const A3 &, const A4 &)> fn, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const RET &expected, UdfPrepare init_fn=NULL, UdfClose close_fn=NULL, const std::vector< AnyVal * > &constant_args=std::vector< AnyVal * >()) |
template<typename RET , typename A1 , typename A2 , typename A3 , typename A4 > | |
static bool | ValidateUdf (boost::function< RET(FunctionContext *, const A1 &, const A2 &, const A3 &, int, const A4 *)> fn, const A1 &a1, const A2 &a2, const A3 &a3, const std::vector< A4 > &a4, const RET &expected, UdfPrepare init_fn=NULL, UdfClose close_fn=NULL, const std::vector< AnyVal * > &constant_args=std::vector< AnyVal * >()) |
template<typename RET , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 > | |
static bool | ValidateUdf (boost::function< RET(FunctionContext *, const A1 &, const A2 &, const A3 &, const A4 &, const A5 &)> fn, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const RET &expected, UdfPrepare init_fn=NULL, UdfClose close_fn=NULL, const std::vector< AnyVal * > &constant_args=std::vector< AnyVal * >()) |
template<typename RET , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 > | |
static bool | ValidateUdf (boost::function< RET(FunctionContext *, const A1 &, const A2 &, const A3 &, const A4 &, const A5 &, const A6 &)> fn, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const RET &expected, UdfPrepare init_fn=NULL, UdfClose close_fn=NULL, const std::vector< AnyVal * > &constant_args=std::vector< AnyVal * >()) |
template<typename RET , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 > | |
static bool | ValidateUdf (boost::function< RET(FunctionContext *, const A1 &, const A2 &, const A3 &, const A4 &, const A5 &, const A6 &, const A7 &)> fn, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7, const RET &expected, UdfPrepare init_fn=NULL, UdfClose close_fn=NULL, const std::vector< AnyVal * > &constant_args=std::vector< AnyVal * >()) |
template<typename RET , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 > | |
static bool | ValidateUdf (boost::function< RET(FunctionContext *, const A1 &, const A2 &, const A3 &, const A4 &, const A5 &, const A6 &, const A7 &)> fn, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7, const A8 &a8, const RET &expected, UdfPrepare init_fn=NULL, UdfClose close_fn=NULL, const std::vector< AnyVal * > &constant_args=std::vector< AnyVal * >()) |
Static Private Member Functions | |
static bool | ValidateError (FunctionContext *context) |
template<typename RET > | |
static bool | Validate (FunctionContext *context, const RET &expected, const RET &actual) |
static bool | RunPrepareFn (UdfPrepare prepare_fn, FunctionContext *context) |
static void | RunCloseFn (UdfClose close_fn, FunctionContext *context) |
Utility class to help test UDFs.
Definition at line 30 of file udf-test-harness.h.
|
static |
Test contexts should be closed in order to check for UDF memory leaks. Leaks cause the error to be set on context.
Definition at line 40 of file udf-test-harness.cc.
References impala::FunctionContextImpl::Close(), and impala_udf::FunctionContext::impl().
Referenced by Validate(), and impala_udf::UdaTestHarnessBase< RESULT, INTERMEDIATE >::ScopedFunctionContext::~ScopedFunctionContext().
|
static |
Create a test FunctionContext object. 'arg_types' should contain a TypeDesc for each argument of the UDF not including the FunctionContext*. The caller is responsible for calling delete on it. This context has additional debugging validation enabled.
Definition at line 25 of file udf-test-harness.cc.
Referenced by impala_udf::UdaTestHarnessBase< RESULT, INTERMEDIATE >::Execute(), impala_udf::UdaTestHarnessBase< RESULT, INTERMEDIATE >::ExecuteOneLevel(), impala_udf::UdaTestHarnessBase< RESULT, INTERMEDIATE >::ExecuteTwoLevel(), and ValidateUdf().
|
inlinestaticprivate |
Definition at line 311 of file udf-test-harness.h.
References impala_udf::FunctionContext::THREAD_LOCAL.
Referenced by ValidateUdf().
|
inlinestaticprivate |
Definition at line 302 of file udf-test-harness.h.
References impala_udf::FunctionContext::THREAD_LOCAL, and ValidateError().
Referenced by ValidateUdf().
|
static |
The AnyVal* values are owned by the caller.
Use with test contexts to test use of IsArgConstant() and GetConstantArg(). constant_args should contain an AnyVal* for each argument of the UDF not including the FunctionContext*; constant_args[i] corresponds to the i-th argument. Non-constant arguments should be set to NULL, and constant arguments should be set to the constant value.Can only be called on contexts created by CreateTestContext().
Definition at line 31 of file udf-test-harness.cc.
References impala::FunctionContextImpl::debug(), impala_udf::FunctionContext::impl(), impala::FunctionContextImpl::SetConstantArgs(), and impala_udf::FunctionContext::SetError().
Referenced by ValidateUdf().
|
inlinestaticprivate |
Definition at line 289 of file udf-test-harness.h.
References CloseContext(), impala_udf::DebugString(), impala_udf::FunctionContext::has_error(), and ValidateError().
Referenced by ValidateUdf().
|
inlinestaticprivate |
Definition at line 280 of file udf-test-harness.h.
References impala_udf::FunctionContext::error_msg(), and impala_udf::FunctionContext::has_error().
Referenced by RunPrepareFn(), and Validate().
|
inlinestatic |
Template function to execute a UDF and validate the result. They should be used like: ValidateUdf(udf_fn, arg1, arg2, ..., expected_result); Only functions with up to 8 arguments are supported For variable argument udfs, the variable arguments should be passed as a std::vector: ValidateUdf(udf_fn, arg1, arg2, const vector<arg3>& args, expected_result);
Definition at line 63 of file udf-test-harness.h.
References CreateTestContext(), RunCloseFn(), RunPrepareFn(), SetConstantArgs(), and Validate().
|
inlinestatic |
Definition at line 77 of file udf-test-harness.h.
References CreateTestContext(), RunCloseFn(), RunPrepareFn(), SetConstantArgs(), and Validate().
|
inlinestatic |
Definition at line 92 of file udf-test-harness.h.
References CreateTestContext(), RunCloseFn(), RunPrepareFn(), SetConstantArgs(), and Validate().
|
inlinestatic |
Definition at line 107 of file udf-test-harness.h.
References CreateTestContext(), RunCloseFn(), RunPrepareFn(), SetConstantArgs(), and Validate().
|
inlinestatic |
Definition at line 123 of file udf-test-harness.h.
References CreateTestContext(), RunCloseFn(), RunPrepareFn(), SetConstantArgs(), and Validate().
|
inlinestatic |
Definition at line 139 of file udf-test-harness.h.
References CreateTestContext(), RunCloseFn(), RunPrepareFn(), SetConstantArgs(), and Validate().
|
inlinestatic |
Definition at line 155 of file udf-test-harness.h.
References CreateTestContext(), RunCloseFn(), RunPrepareFn(), SetConstantArgs(), and Validate().
|
inlinestatic |
Definition at line 171 of file udf-test-harness.h.
References CreateTestContext(), RunCloseFn(), RunPrepareFn(), SetConstantArgs(), and Validate().
|
inlinestatic |
Definition at line 188 of file udf-test-harness.h.
References CreateTestContext(), RunCloseFn(), RunPrepareFn(), SetConstantArgs(), and Validate().
|
inlinestatic |
Definition at line 206 of file udf-test-harness.h.
References CreateTestContext(), RunCloseFn(), RunPrepareFn(), SetConstantArgs(), and Validate().
|
inlinestatic |
Definition at line 224 of file udf-test-harness.h.
References CreateTestContext(), RunCloseFn(), RunPrepareFn(), SetConstantArgs(), and Validate().
|
inlinestatic |
Definition at line 243 of file udf-test-harness.h.
References CreateTestContext(), RunCloseFn(), RunPrepareFn(), SetConstantArgs(), and Validate().
|
inlinestatic |
Definition at line 262 of file udf-test-harness.h.
References CreateTestContext(), RunCloseFn(), RunPrepareFn(), SetConstantArgs(), and Validate().