Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
TODO: Reconsider whether this class needs to exist. More...
#include <timestamp-functions.h>
Static Public Member Functions | |
static void | UnixAndFromUnixPrepare (FunctionContext *context, FunctionContext::FunctionStateScope scope) |
Parse and initialize format string if it is a constant. Raise error if invalid. More... | |
static void | UnixAndFromUnixClose (FunctionContext *context, FunctionContext::FunctionStateScope scope) |
static BigIntVal | Unix (FunctionContext *context, const StringVal &string_val, const StringVal &fmt) |
Parses 'string_val' based on the format 'fmt'. More... | |
static BigIntVal | Unix (FunctionContext *context, const TimestampVal &tv_val) |
Converts 'tv_val' to a unix time_t. More... | |
static BigIntVal | Unix (FunctionContext *context) |
Returns the current time. More... | |
static BigIntVal | UnixFromString (FunctionContext *context, const StringVal &sv) |
template<class TIME > | |
static StringVal | FromUnix (FunctionContext *context, const TIME &unix_time) |
template<class TIME > | |
static StringVal | FromUnix (FunctionContext *context, const TIME &unix_time, const StringVal &fmt) |
static TimestampVal | FromUtc (FunctionContext *context, const TimestampVal &ts_val, const StringVal &tz_string_val) |
Convert a timestamp to or from a particular timezone based time. More... | |
static TimestampVal | ToUtc (FunctionContext *context, const TimestampVal &ts_val, const StringVal &tz_string_val) |
static StringVal | DayName (FunctionContext *context, const TimestampVal &dow) |
Returns the day's name as a string (e.g. 'Saturday'). More... | |
static IntVal | Year (FunctionContext *context, const TimestampVal &ts_val) |
Functions to extract parts of the timestamp, return integers. More... | |
static IntVal | Month (FunctionContext *context, const TimestampVal &ts_val) |
static IntVal | DayOfWeek (FunctionContext *context, const TimestampVal &ts_val) |
static IntVal | DayOfMonth (FunctionContext *context, const TimestampVal &ts_val) |
static IntVal | DayOfYear (FunctionContext *context, const TimestampVal &ts_val) |
static IntVal | WeekOfYear (FunctionContext *context, const TimestampVal &ts_val) |
static IntVal | Hour (FunctionContext *context, const TimestampVal &ts_val) |
static IntVal | Minute (FunctionContext *context, const TimestampVal &ts_val) |
static IntVal | Second (FunctionContext *context, const TimestampVal &ts_val) |
static TimestampVal | Now (FunctionContext *context) |
Date/time functions. More... | |
static StringVal | ToDate (FunctionContext *context, const TimestampVal &ts_val) |
static IntVal | DateDiff (FunctionContext *context, const TimestampVal &ts_val1, const TimestampVal &ts_val2) |
template<bool ISADD, class VALTYPE , class UNIT > | |
static TimestampVal | DateAddSub (FunctionContext *context, const TimestampVal &ts_value, const VALTYPE &count) |
Add/sub functions on the date portion. More... | |
template<bool ISADD, class VALTYPE , class UNIT > | |
static TimestampVal | TimeAddSub (FunctionContext *context, const TimestampVal &ts_value, const VALTYPE &count) |
Add/sub functions on the time portion. More... | |
static StringValue * | CheckFormat (StringValue *format) |
static void | ReportBadFormat (FunctionContext *context, const StringVal &format, bool is_error) |
Issue a warning for a bad format string. More... | |
Static Private Attributes | |
static const char * | MONDAY = "Monday" |
Static result values for DayName() function. More... | |
static const char * | TUESDAY = "Tuesday" |
static const char * | WEDNESDAY = "Wednesday" |
static const char * | THURSDAY = "Thursday" |
static const char * | FRIDAY = "Friday" |
static const char * | SATURDAY = "Saturday" |
static const char * | SUNDAY = "Sunday" |
TODO: Reconsider whether this class needs to exist.
Definition at line 40 of file timestamp-functions.h.
|
static |
Helper function to check date/time format strings. TODO: eventually return format converted from Java to Boost.
|
static |
Add/sub functions on the date portion.
Definition at line 298 of file timestamp-functions.cc.
References impala_udf::FunctionContext::AddWarning(), impala::TimestampValue::date(), impala::TimestampValue::HasDate(), impala_udf::AnyVal::is_null, impala_udf::TimestampVal::null(), impala::TimestampValue::time(), and impala::TimestampValue::ToTimestampVal().
|
static |
Definition at line 334 of file timestamp-functions.cc.
References impala::TimestampValue::date(), impala::TimestampValue::HasDate(), impala_udf::AnyVal::is_null, and impala_udf::IntVal::null().
|
static |
Returns the day's name as a string (e.g. 'Saturday').
Definition at line 196 of file timestamp-functions.cc.
References impala_udf::AnyVal::is_null, impala_udf::StringVal::null(), and impala_udf::IntVal::val.
|
static |
Definition at line 236 of file timestamp-functions.cc.
References impala::TimestampValue::date(), impala::TimestampValue::HasDate(), impala_udf::AnyVal::is_null, and impala_udf::IntVal::null().
|
static |
Definition at line 227 of file timestamp-functions.cc.
References impala::TimestampValue::date(), impala::TimestampValue::HasDate(), impala_udf::AnyVal::is_null, and impala_udf::IntVal::null().
|
static |
Definition at line 244 of file timestamp-functions.cc.
References impala::TimestampValue::date(), impala::TimestampValue::HasDate(), impala_udf::AnyVal::is_null, and impala_udf::IntVal::null().
|
static |
Return a timestamp string from a unix time_t Optional second argument is the format of the string. TIME is the integer type of the unix time argument.
Definition at line 103 of file timestamp-functions.cc.
References impala_udf::StringVal::null().
|
static |
Definition at line 110 of file timestamp-functions.cc.
References impala::DateTimeFormatContext::fmt_out_len, impala::TimestampValue::Format(), impala_udf::FunctionContext::GetFunctionState(), impala_udf::AnyVal::is_null, impala_udf::FunctionContext::IsArgConstant(), impala_udf::StringVal::len, impala_udf::StringVal::null(), impala_udf::StringVal::ptr, impala::DateTimeFormatContext::Reset(), and impala_udf::FunctionContext::THREAD_LOCAL.
|
static |
Convert a timestamp to or from a particular timezone based time.
Definition at line 349 of file timestamp-functions.cc.
References impala_udf::FunctionContext::AddWarning(), impala::StringValue::DebugString(), impala::TimestampValue::HasDateOrTime(), impala_udf::AnyVal::is_null, impala_udf::TimestampVal::null(), impala::TimestampValue::ToPtime(), and impala::TimestampValue::ToTimestampVal().
|
static |
Definition at line 260 of file timestamp-functions.cc.
References impala::TimestampValue::HasTime(), impala_udf::AnyVal::is_null, impala_udf::IntVal::null(), and impala::TimestampValue::time().
|
static |
Definition at line 267 of file timestamp-functions.cc.
References impala::TimestampValue::HasTime(), impala_udf::AnyVal::is_null, impala_udf::IntVal::null(), and impala::TimestampValue::time().
|
static |
Definition at line 219 of file timestamp-functions.cc.
References impala::TimestampValue::date(), impala::TimestampValue::HasDate(), impala_udf::AnyVal::is_null, and impala_udf::IntVal::null().
|
static |
Date/time functions.
Definition at line 281 of file timestamp-functions.cc.
References impala::TimestampValue::HasDateOrTime(), impala_udf::FunctionContext::impl(), impala::RuntimeState::now(), impala_udf::TimestampVal::null(), impala::FunctionContextImpl::state(), and impala::TimestampValue::ToTimestampVal().
|
static |
Issue a warning for a bad format string.
Definition at line 180 of file timestamp-functions.cc.
References impala_udf::FunctionContext::AddWarning(), impala::StringValue::DebugString(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, and impala_udf::FunctionContext::SetError().
|
static |
Definition at line 274 of file timestamp-functions.cc.
References impala::TimestampValue::HasTime(), impala_udf::AnyVal::is_null, impala_udf::IntVal::null(), and impala::TimestampValue::time().
|
static |
Add/sub functions on the time portion.
Definition at line 321 of file timestamp-functions.cc.
References impala::TimestampValue::date(), impala::TimestampValue::HasDate(), impala_udf::AnyVal::is_null, impala_udf::TimestampVal::null(), and impala::TimestampValue::time().
|
static |
Definition at line 289 of file timestamp-functions.cc.
References impala::TimestampValue::date(), impala_udf::AnyVal::is_null, and impala_udf::StringVal::null().
|
static |
Definition at line 378 of file timestamp-functions.cc.
References impala_udf::FunctionContext::AddWarning(), impala::TimestampValue::date(), impala::StringValue::DebugString(), impala::TimestampValue::HasDateOrTime(), impala_udf::AnyVal::is_null, impala_udf::TimestampVal::null(), and impala::TimestampValue::time().
|
static |
Parses 'string_val' based on the format 'fmt'.
Definition at line 136 of file timestamp-functions.cc.
References impala_udf::FunctionContext::GetFunctionState(), impala::TimestampValue::HasDate(), impala_udf::AnyVal::is_null, impala_udf::FunctionContext::IsArgConstant(), impala_udf::StringVal::len, impala_udf::BigIntVal::null(), impala_udf::StringVal::ptr, impala::DateTimeFormatContext::Reset(), impala_udf::FunctionContext::THREAD_LOCAL, and impala::TimestampValue::ToUnixTime().
|
static |
Converts 'tv_val' to a unix time_t.
Definition at line 160 of file timestamp-functions.cc.
References impala::TimestampValue::HasDate(), impala_udf::AnyVal::is_null, impala_udf::BigIntVal::null(), and impala::TimestampValue::ToUnixTime().
|
static |
Returns the current time.
Definition at line 167 of file timestamp-functions.cc.
References impala::TimestampValue::HasDate(), impala_udf::FunctionContext::impl(), impala::RuntimeState::now(), impala_udf::BigIntVal::null(), impala::FunctionContextImpl::state(), and impala::TimestampValue::ToUnixTime().
|
static |
Definition at line 93 of file timestamp-functions.cc.
References impala_udf::FunctionContext::GetFunctionState(), and impala_udf::FunctionContext::THREAD_LOCAL.
|
static |
Parse and initialize format string if it is a constant. Raise error if invalid.
Definition at line 66 of file timestamp-functions.cc.
References impala_udf::FunctionContext::GetConstantArg(), impala_udf::AnyVal::is_null, impala_udf::FunctionContext::IsArgConstant(), impala::StringValue::len, impala::StringValue::ptr, impala_udf::FunctionContext::SetFunctionState(), and impala_udf::FunctionContext::THREAD_LOCAL.
|
static |
Definition at line 172 of file timestamp-functions.cc.
References impala::TimestampValue::HasDate(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, impala_udf::BigIntVal::null(), impala_udf::StringVal::ptr, and impala::TimestampValue::ToUnixTime().
|
static |
Definition at line 252 of file timestamp-functions.cc.
References impala::TimestampValue::date(), impala::TimestampValue::HasDate(), impala_udf::AnyVal::is_null, and impala_udf::IntVal::null().
|
static |
Functions to extract parts of the timestamp, return integers.
Definition at line 211 of file timestamp-functions.cc.
References impala::TimestampValue::date(), impala::TimestampValue::HasDate(), impala_udf::AnyVal::is_null, and impala_udf::IntVal::null().
Referenced by impala::Expr::InitBuiltinsDummy().
|
staticprivate |
Definition at line 117 of file timestamp-functions.h.
|
staticprivate |
Static result values for DayName() function.
Definition at line 113 of file timestamp-functions.h.
|
staticprivate |
Definition at line 118 of file timestamp-functions.h.
|
staticprivate |
Definition at line 119 of file timestamp-functions.h.
|
staticprivate |
Definition at line 116 of file timestamp-functions.h.
|
staticprivate |
Definition at line 114 of file timestamp-functions.h.
|
staticprivate |
Definition at line 115 of file timestamp-functions.h.