Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
#include <udf-builtins.h>
Static Public Member Functions | |
static DoubleVal | Abs (FunctionContext *context, const DoubleVal &val) |
static DoubleVal | Pi (FunctionContext *context) |
static StringVal | Lower (FunctionContext *context, const StringVal &str) |
static IntVal | MaxInt (FunctionContext *context) |
static TinyIntVal | MaxTinyInt (FunctionContext *context) |
static SmallIntVal | MaxSmallInt (FunctionContext *context) |
static BigIntVal | MaxBigInt (FunctionContext *context) |
static IntVal | MinInt (FunctionContext *context) |
static TinyIntVal | MinTinyInt (FunctionContext *context) |
static SmallIntVal | MinSmallInt (FunctionContext *context) |
static BigIntVal | MinBigInt (FunctionContext *context) |
static BooleanVal | IsNan (FunctionContext *context, const DoubleVal &val) |
static BooleanVal | IsInf (FunctionContext *context, const DoubleVal &val) |
static TimestampVal | Trunc (FunctionContext *context, const TimestampVal &date, const StringVal &unit_str) |
static void | TruncPrepare (FunctionContext *context, FunctionContext::FunctionStateScope scope) |
static void | TruncClose (FunctionContext *context, FunctionContext::FunctionStateScope scope) |
static IntVal | Extract (FunctionContext *context, const StringVal &field_str, const TimestampVal &date) |
This is used by the DATE_PART function. More... | |
static IntVal | Extract (FunctionContext *context, const TimestampVal &date, const StringVal &field_str) |
static void | ExtractPrepare (FunctionContext *context, FunctionContext::FunctionStateScope scope) |
This is used by the DATE_PART function. More... | |
static void | SwappedExtractPrepare (FunctionContext *context, FunctionContext::FunctionStateScope scope) |
static void | ExtractClose (FunctionContext *context, FunctionContext::FunctionStateScope scope) |
This is used by both EXTRACT and DATE_PART. More... | |
static StringVal | ToVector (FunctionContext *context, int n, const DoubleVal *values) |
static StringVal | PrintVector (FunctionContext *context, const StringVal &arr) |
Converts a double[] stored as a StringVal into a human readable string. More... | |
static DoubleVal | VectorGet (FunctionContext *context, const BigIntVal &n, const StringVal &arr) |
Returns the n-th (0-indexed) element of a double[] stored as a StringVal. More... | |
static StringVal | EncodeVector (FunctionContext *context, const StringVal &arr) |
static StringVal | DecodeVector (FunctionContext *context, const StringVal &arr) |
Converts a printable ascii encoding of a vector to a double[] stored as a StringVal. More... | |
Static Private Member Functions | |
static void | ExtractPrepare (FunctionContext *context, FunctionContext::FunctionStateScope scope, int unit_idx) |
Builtins written against the UDF interface. The builtins in the other files should be replaced to the UDF interface as well. This is just to illustrate how builtins against the UDF interface will be implemented.
Definition at line 28 of file udf-builtins.h.
|
static |
Definition at line 37 of file udf-builtins.cc.
References impala_udf::AnyVal::is_null, and impala_udf::DoubleVal::val.
|
static |
Converts a printable ascii encoding of a vector to a double[] stored as a StringVal.
Definition at line 555 of file udf-builtins.cc.
References InplaceDoubleDecode(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, and impala_udf::StringVal::ptr.
|
static |
Converts a double[] stored as a StringVal to an printable ascii encoding MADlib operates on binary strings but the Impala shell is not friendly to binary data. We offer these functions to the user to allow them to copy-paste vectors to/from the impala shell. Note: this loses precision (converts from double to float)
Definition at line 545 of file udf-builtins.cc.
References InplaceDoubleEncode(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, and impala_udf::StringVal::ptr.
|
static |
This is used by the DATE_PART function.
Returns a single field from a timestamp Fields: YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, MILLISECOND, EPOCH Reference: http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions050.htm
Definition at line 344 of file udf-builtins.cc.
References impala_udf::TimestampVal::date, EPOCH, impala_udf::FunctionContext::GetFunctionState(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, impala_udf::StringVal::ptr, impala_udf::FunctionContext::SetError(), StrToExtractField(), impala_udf::TimestampVal::time_of_day, and impala::YEAR.
|
static |
This is for the EXTRACT(Timestamp, String) and EXTRACT(Timeunit FROM Timestamp) functions.
Definition at line 420 of file udf-builtins.cc.
|
static |
This is used by both EXTRACT and DATE_PART.
Definition at line 453 of file udf-builtins.cc.
References impala_udf::FunctionContext::Free(), impala_udf::FunctionContext::GetFunctionState(), and impala_udf::FunctionContext::SetFunctionState().
|
static |
This is used by the DATE_PART function.
Definition at line 443 of file udf-builtins.cc.
|
staticprivate |
Does the preparation for EXTRACT. The unit_idx parameter should indicate which parameter of the EXTRACT call is the time unit param. DATE_PART will also use this with a different unit_idx than EXTRACT.
Definition at line 425 of file udf-builtins.cc.
References impala_udf::FunctionContext::Allocate(), impala_udf::FunctionContext::GetConstantArg(), impala_udf::FunctionContext::IsArgConstant(), impala_udf::StringVal::len, impala_udf::StringVal::ptr, impala_udf::FunctionContext::SetError(), impala_udf::FunctionContext::SetFunctionState(), and StrToExtractField().
|
static |
Definition at line 92 of file udf-builtins.cc.
References impala_udf::AnyVal::is_null, and impala_udf::DoubleVal::val.
|
static |
Definition at line 87 of file udf-builtins.cc.
References impala_udf::AnyVal::is_null, and impala_udf::DoubleVal::val.
|
static |
Definition at line 46 of file udf-builtins.cc.
References impala_udf::AnyVal::is_null, impala_udf::StringVal::len, and impala_udf::StringVal::ptr.
Referenced by StrToExtractField(), and StrToTruncUnit().
|
static |
Definition at line 67 of file udf-builtins.cc.
|
static |
Definition at line 55 of file udf-builtins.cc.
|
static |
Definition at line 63 of file udf-builtins.cc.
|
static |
Definition at line 59 of file udf-builtins.cc.
|
static |
Definition at line 83 of file udf-builtins.cc.
|
static |
Definition at line 71 of file udf-builtins.cc.
|
static |
Definition at line 79 of file udf-builtins.cc.
|
static |
Definition at line 75 of file udf-builtins.cc.
|
static |
Definition at line 42 of file udf-builtins.cc.
Referenced by impala::Expr::InitBuiltinsDummy().
|
static |
Converts a double[] stored as a StringVal into a human readable string.
Definition at line 488 of file udf-builtins.cc.
References impala_udf::StringVal::len, impala_udf::StringVal::ptr, and ValidateMADlibVector().
|
static |
This is for the EXTRACT(Timestamp, String) and EXTRACT(Timeunit FROM Timestamp) functions.
Definition at line 448 of file udf-builtins.cc.
|
static |
Converts a set of doubles to double[] stored as a StringVal Stored as a StringVal with each double value encoded in IEEE back to back The returned StringVal ptr can be casted to a double*
Definition at line 475 of file udf-builtins.cc.
References impala_udf::StringVal::ptr, impala_udf::FunctionContext::SetError(), and impala_udf::DoubleVal::val.
|
static |
Rounds (truncating down) a Timestamp to the specified unit. Units: CC, SCC : One greater than the first two digits of a four-digit year SYYYY, YYYY, YEAR, SYEAR, YYY, YY, Y : Current Year Q : Quarter MONTH, MON, MM, RM : Month WW : Same day of the week as the first day of the year W : Same day of the week as the first day of the month DDD, DD, J : Day DAY, DY, D : Starting day of the week HH, HH12, HH24 : Hour MI : Minute Reference: http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions201.htm
Definition at line 220 of file udf-builtins.cc.
References impala::TimestampValue::date(), TruncUnit::DAY, TruncUnit::DAY_OF_WEEK, impala::TimestampValue::FromTimestampVal(), impala_udf::FunctionContext::GetFunctionState(), TruncUnit::HOUR, impala_udf::AnyVal::is_null, impala_udf::StringVal::len, TruncUnit::MINUTE, TruncUnit::MONTH, impala_udf::StringVal::ptr, TruncUnit::QUARTER, impala_udf::FunctionContext::SetError(), StrToTruncUnit(), impala::TimestampValue::time(), impala::TimestampValue::ToTimestampVal(), TruncDay(), TruncDayOfWeek(), TruncHour(), TruncMinute(), TruncMonth(), TruncQuarter(), TruncW(), TruncWW(), TruncYear(), TruncUnit::UNIT_INVALID, TruncUnit::W, TruncUnit::WW, and TruncUnit::YEAR.
|
static |
Definition at line 320 of file udf-builtins.cc.
References impala_udf::FunctionContext::Free(), impala_udf::FunctionContext::GetFunctionState(), and impala_udf::FunctionContext::SetFunctionState().
|
static |
Definition at line 302 of file udf-builtins.cc.
References impala_udf::FunctionContext::Allocate(), impala_udf::FunctionContext::GetConstantArg(), impala_udf::FunctionContext::IsArgConstant(), impala_udf::StringVal::len, impala_udf::StringVal::ptr, impala_udf::FunctionContext::SetError(), impala_udf::FunctionContext::SetFunctionState(), StrToTruncUnit(), and TruncUnit::UNIT_INVALID.
|
static |
Returns the n-th (0-indexed) element of a double[] stored as a StringVal.
Definition at line 505 of file udf-builtins.cc.
References impala_udf::AnyVal::is_null, impala_udf::StringVal::len, impala_udf::StringVal::ptr, impala_udf::BigIntVal::val, and ValidateMADlibVector().