#include <DateTimeTranslator.h>
Definition at line 82 of file DateTimeTranslator.h.
Definition at line 84 of file DateTimeTranslator.h.
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
ExtractExpr::ExtractExpr |
( |
const std::shared_ptr< Analyzer::Expr > |
expr, |
|
|
const std::string & |
field |
|
) |
| |
|
inline |
Definition at line 86 of file DateTimeTranslator.h.
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
std::shared_ptr< Analyzer::Expr > ExtractExpr::generate |
( |
const std::shared_ptr< Analyzer::Expr > |
from_expr, |
|
|
const std::string & |
field_name |
|
) |
| |
|
static |
Definition at line 167 of file DateTimeTranslator.cpp.
References Datum::bigintval, field(), floor_div(), anonymous_namespace{DateTimeTranslator.cpp}::from_extract_field(), DateTimeUtils::get_timestamp_precision_scale(), DateTimeTranslator::getExtractFromTimeConstantValue(), kBIGINT, kEPOCH, kHOUR, kMINUTE, kSECOND, and kTIME.
170 const auto expr_ti = from_expr->get_type_info();
171 if (!expr_ti.is_time()) {
172 throw std::runtime_error(
173 "Only TIME, TIMESTAMP and DATE types can be in EXTRACT function.");
182 if (constant !=
nullptr) {
185 ?
floor_div(constant->get_constval().bigintval,
188 constant->get_constval().bigintval,
field, expr_ti);
189 constant->set_constval(d);
190 constant->set_type_info(ti);
193 return makeExpr<Analyzer::ExtractExpr>(
194 ti, from_expr->get_contains_agg(),
field, from_expr->decompress());
static int64_t getExtractFromTimeConstantValue(const int64_t &timeval, const ExtractField &field, const SQLTypeInfo &ti)
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
std::string from_extract_field(const ExtractField &fieldno)
constexpr int64_t get_timestamp_precision_scale(const int32_t dimen)
ExtractField ExtractExpr::to_extract_field |
( |
const std::string & |
field | ) |
|
|
staticprivate |
Definition at line 114 of file DateTimeTranslator.cpp.
References kDATEEPOCH, kDAY, kDOW, kDOY, kEPOCH, kHOUR, kISODOW, kMICROSECOND, kMILLISECOND, kMINUTE, kMONTH, kNANOSECOND, kQUARTER, kQUARTERDAY, kSECOND, kWEEK, kWEEK_SATURDAY, kWEEK_SUNDAY, and kYEAR.
Referenced by generate().
116 if (boost::iequals(
field,
"year")) {
118 }
else if (boost::iequals(
field,
"quarter")) {
120 }
else if (boost::iequals(
field,
"month")) {
122 }
else if (boost::iequals(
field,
"day")) {
124 }
else if (boost::iequals(
field,
"quarterday")) {
126 }
else if (boost::iequals(
field,
"hour")) {
128 }
else if (boost::iequals(
field,
"minute")) {
130 }
else if (boost::iequals(
field,
"second")) {
132 }
else if (boost::iequals(
field,
"millisecond")) {
134 }
else if (boost::iequals(
field,
"microsecond")) {
136 }
else if (boost::iequals(
field,
"nanosecond")) {
138 }
else if (boost::iequals(
field,
"dow")) {
140 }
else if (boost::iequals(
field,
"isodow")) {
142 }
else if (boost::iequals(
field,
"doy")) {
144 }
else if (boost::iequals(
field,
"epoch")) {
146 }
else if (boost::iequals(
field,
"week")) {
148 }
else if (boost::iequals(
field,
"week_sunday")) {
150 }
else if (boost::iequals(
field,
"week_saturday")) {
152 }
else if (boost::iequals(
field,
"dateepoch")) {
155 throw std::runtime_error(
"Unsupported field in EXTRACT function " +
field);
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
The documentation for this class was generated from the following files: