17 using namespace impala_udf;
47 int result =
string.len +
boolean.
val + tiny_int.
val + small_int.
val + int_val.
val
48 + big_int.
val +
static_cast<int64_t
>(float_val.
val)
49 + static_cast<int64_t>(double_val.
val) + decimal.
val4;
54 const char* result =
"string";
60 for (
int i = 0; i < strlen(result); ++i) ret.
ptr[i] = result[i];
66 for (
int i = 0; i < n; ++i) {
68 result &= args[i].
val;
76 for (
int i = 0; i < n; ++i) {
77 if (args[i].is_null)
continue;
78 result += args[i].
val;
88 for (
int i = 0; i < n; ++i) {
89 if (args[i].is_null)
continue;
90 result += args[i].
val;
101 for (
int i = 0; i < n; ++i) {
102 if (args[i].is_null)
continue;
103 total_len += args[i].
len;
112 for (
int i = 0; i < n; ++i) {
115 context->
SetError(
"VarSum() only accepts Decimal4Value (precison <= 9)");
118 if (args[i].is_null)
continue;
119 result += args[i].
val4;
132 for (
int i = 0; i < n; ++i) {
133 if (args[i].is_null)
continue;
134 result += args[i].
val;
142 context->
SetError(
"test UDF error");
143 context->
SetError(
"this shouldn't show up");
192 context->
Free(reinterpret_cast<uint8_t*>(state));
221 context->
Free(reinterpret_cast<uint8_t*>(state));
231 uint8_t* state = context->
Allocate(100);
245 context->
Free(reinterpret_cast<uint8_t*>(state));
254 reinterpret_cast<int64_t*
>(context->
Allocate(
sizeof(int64_t)));
261 int64_t* total =
reinterpret_cast<int64_t*
>(
270 int64_t* total =
reinterpret_cast<int64_t*
>(
272 context->
Free(*total);
273 context->
Free(reinterpret_cast<uint8_t*>(total));
BigIntVal MemTest(FunctionContext *context, const BigIntVal &bytes)
int precision
Only valid if type == TYPE_DECIMAL.
BigIntVal Count(FunctionContext *context)
BooleanVal TestWarnings(FunctionContext *context)
TimestampVal ConstantTimestamp(FunctionContext *context)
void MemTestPrepare(FunctionContext *context, FunctionContext::FunctionStateScope scope)
BooleanVal Identity(FunctionContext *context, const BooleanVal &arg)
IntVal Fn2(FunctionContext *, const IntVal &)
BooleanVal ValidateArgType(FunctionContext *context, const StringVal &dummy)
This object has a compatible storage format with boost::ptime.
IntVal ConstantArg(FunctionContext *context, const IntVal &const_val)
bool AddWarning(const char *warning_msg)
IntVal VarSum(FunctionContext *context, int n, const IntVal *args)
IntVal FiveArgs(FunctionContext *context, const IntVal &v1, const IntVal &v2, const IntVal &v3, const IntVal &v4, const IntVal &v5)
const TypeDesc * GetArgType(int arg_idx) const
void * GetFunctionState(FunctionStateScope scope) const
void Free(uint8_t *buffer)
Frees a buffer returned from Allocate() or Reallocate()
DoubleVal VarSumMultiply(FunctionContext *context, const DoubleVal &d, int n, const IntVal *args)
IntVal AllTypes(FunctionContext *context, const StringVal &string, const BooleanVal &boolean, const TinyIntVal &tiny_int, const SmallIntVal &small_int, const IntVal &int_val, const BigIntVal &big_int, const FloatVal &float_val, const DoubleVal &double_val, const DecimalVal &decimal)
IntVal SevenArgs(FunctionContext *context, const IntVal &v1, const IntVal &v2, const IntVal &v3, const IntVal &v4, const IntVal &v5, const IntVal &v6, const IntVal &v7)
bool IsArgConstant(int arg_idx) const
void SetFunctionState(FunctionStateScope scope, void *ptr)
void ConstantArgPrepare(FunctionContext *context, FunctionContext::FunctionStateScope scope)
BooleanVal TestError(FunctionContext *context)
void CountPrepare(FunctionContext *context, FunctionContext::FunctionStateScope scope)
void CountClose(FunctionContext *context, FunctionContext::FunctionStateScope scope)
BigIntVal UnmangledSymbol(FunctionContext *context)
IntVal EightArgs(FunctionContext *context, const IntVal &v1, const IntVal &v2, const IntVal &v3, const IntVal &v4, const IntVal &v5, const IntVal &v6, const IntVal &v7, const IntVal &v8)
void ValidateOpenClose(FunctionContext *context, FunctionContext::FunctionStateScope scope)
uint8_t * Allocate(int byte_size)
IntVal FourArgs(FunctionContext *context, const IntVal &v1, const IntVal &v2, const IntVal &v3, const IntVal &v4)
void TrackAllocation(int64_t byte_size)
BooleanVal VarAnd(FunctionContext *context, int n, const BooleanVal *args)
StringVal NoArgs(FunctionContext *context)
void MemTestClose(FunctionContext *context, FunctionContext::FunctionStateScope scope)
void ValidateOpenPrepare(FunctionContext *context, FunctionContext::FunctionStateScope scope)
void SetError(const char *error_msg)
BigIntVal DoubleFreeTest(FunctionContext *context, BigIntVal bytes)
AnyVal * GetConstantArg(int arg_idx) const
IntVal Fn(FunctionContext *)
void ConstantArgClose(FunctionContext *context, FunctionContext::FunctionStateScope scope)
IntVal SixArgs(FunctionContext *context, const IntVal &v1, const IntVal &v2, const IntVal &v3, const IntVal &v4, const IntVal &v5, const IntVal &v6)
BooleanVal ValidateOpen(FunctionContext *context, const IntVal &dummy)