Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
impala::TimestampFunctions Class Reference

TODO: Reconsider whether this class needs to exist. More...

#include <timestamp-functions.h>

Collaboration diagram for impala::TimestampFunctions:

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 StringValueCheckFormat (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"
 

Detailed Description

TODO: Reconsider whether this class needs to exist.

Definition at line 40 of file timestamp-functions.h.

Member Function Documentation

static StringValue* impala::TimestampFunctions::CheckFormat ( StringValue format)
static

Helper function to check date/time format strings. TODO: eventually return format converted from Java to Boost.

template<bool ISADD, class VALTYPE , class UNIT >
template TimestampVal impala::TimestampFunctions::DateAddSub< false, BigIntVal, days > ( FunctionContext context,
const TimestampVal ts_value,
const VALTYPE &  count 
)
static
IntVal impala::TimestampFunctions::DateDiff ( FunctionContext context,
const TimestampVal ts_val1,
const TimestampVal ts_val2 
)
static
StringVal impala::TimestampFunctions::DayName ( FunctionContext context,
const TimestampVal dow 
)
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.

IntVal impala::TimestampFunctions::DayOfMonth ( FunctionContext context,
const TimestampVal ts_val 
)
static
IntVal impala::TimestampFunctions::DayOfWeek ( FunctionContext context,
const TimestampVal ts_val 
)
static
IntVal impala::TimestampFunctions::DayOfYear ( FunctionContext context,
const TimestampVal ts_val 
)
static
template<class TIME >
StringVal impala::TimestampFunctions::FromUnix ( FunctionContext context,
const TIME &  unix_time 
)
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().

TimestampVal impala::TimestampFunctions::FromUtc ( FunctionContext context,
const TimestampVal ts_val,
const StringVal tz_string_val 
)
static
IntVal impala::TimestampFunctions::Hour ( FunctionContext context,
const TimestampVal ts_val 
)
static
IntVal impala::TimestampFunctions::Minute ( FunctionContext context,
const TimestampVal ts_val 
)
static
IntVal impala::TimestampFunctions::Month ( FunctionContext context,
const TimestampVal ts_val 
)
static
void impala::TimestampFunctions::ReportBadFormat ( FunctionContext context,
const StringVal format,
bool  is_error 
)
static
IntVal impala::TimestampFunctions::Second ( FunctionContext context,
const TimestampVal ts_val 
)
static
template<bool ISADD, class VALTYPE , class UNIT >
template TimestampVal impala::TimestampFunctions::TimeAddSub< false, BigIntVal, nanoseconds > ( FunctionContext context,
const TimestampVal ts_value,
const VALTYPE &  count 
)
static
StringVal impala::TimestampFunctions::ToDate ( FunctionContext context,
const TimestampVal ts_val 
)
static
BigIntVal impala::TimestampFunctions::Unix ( FunctionContext context,
const TimestampVal tv_val 
)
static
void impala::TimestampFunctions::UnixAndFromUnixClose ( FunctionContext context,
FunctionContext::FunctionStateScope  scope 
)
static
void impala::TimestampFunctions::UnixAndFromUnixPrepare ( FunctionContext context,
FunctionContext::FunctionStateScope  scope 
)
static
IntVal impala::TimestampFunctions::WeekOfYear ( FunctionContext context,
const TimestampVal ts_val 
)
static
IntVal impala::TimestampFunctions::Year ( FunctionContext context,
const TimestampVal ts_val 
)
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().

Member Data Documentation

const char * impala::TimestampFunctions::FRIDAY = "Friday"
staticprivate

Definition at line 117 of file timestamp-functions.h.

const char * impala::TimestampFunctions::MONDAY = "Monday"
staticprivate

Static result values for DayName() function.

Definition at line 113 of file timestamp-functions.h.

const char * impala::TimestampFunctions::SATURDAY = "Saturday"
staticprivate

Definition at line 118 of file timestamp-functions.h.

const char * impala::TimestampFunctions::SUNDAY = "Sunday"
staticprivate

Definition at line 119 of file timestamp-functions.h.

const char * impala::TimestampFunctions::THURSDAY = "Thursday"
staticprivate

Definition at line 116 of file timestamp-functions.h.

const char * impala::TimestampFunctions::TUESDAY = "Tuesday"
staticprivate

Definition at line 114 of file timestamp-functions.h.

const char * impala::TimestampFunctions::WEDNESDAY = "Wednesday"
staticprivate

Definition at line 115 of file timestamp-functions.h.


The documentation for this class was generated from the following files: