#include <DateTimeTranslator.h>
Definition at line 105 of file DateTimeTranslator.h.
Definition at line 107 of file DateTimeTranslator.h.
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
std::shared_ptr< Analyzer::Expr > from_expr_
DateTruncExpr::DateTruncExpr |
( |
const std::shared_ptr< Analyzer::Expr > |
expr, |
|
|
const std::string & |
field |
|
) |
| |
|
inline |
Definition at line 109 of file DateTimeTranslator.h.
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
std::shared_ptr< Analyzer::Expr > from_expr_
static DatetruncField to_datetrunc_field(const std::string &field)
std::shared_ptr< Analyzer::Expr > DateTruncExpr::generate |
( |
const std::shared_ptr< Analyzer::Expr > |
from_expr, |
|
|
const std::string & |
field_name |
|
) |
| |
|
static |
Definition at line 239 of file DateTimeTranslator.cpp.
References field(), generate(), and to_datetrunc_field().
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
static DatetruncField to_datetrunc_field(const std::string &field)
const std::shared_ptr< Analyzer::Expr > generate() const
Definition at line 246 of file DateTimeTranslator.cpp.
References Datum::bigintval, dtHOUR, dtMINUTE, dtSECOND, field(), anonymous_namespace{DateTimeTranslator.cpp}::from_datetrunc_field(), DateTimeTranslator::getDateTruncConstantValue(), kTIME, and kTIMESTAMP.
249 const auto& expr_ti = from_expr->get_type_info();
250 if (!expr_ti.is_time()) {
251 throw std::runtime_error(
252 "Only TIME, TIMESTAMP and DATE types can be in DATE_TRUNC function.");
265 constant->set_constval(d);
266 constant->set_type_info(ti);
269 return makeExpr<Analyzer::DatetruncExpr>(
270 ti, from_expr->get_contains_agg(),
field, from_expr->decompress());
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
std::string from_datetrunc_field(const DatetruncField &fieldno)
static int64_t getDateTruncConstantValue(const int64_t &timeval, const DatetruncField &field, const SQLTypeInfo &ti)
const std::shared_ptr<Analyzer::Expr> DateTruncExpr::generate |
( |
| ) |
const |
|
inline |
DatetruncField DateTruncExpr::to_datetrunc_field |
( |
const std::string & |
field | ) |
|
|
staticprivate |
Definition at line 197 of file DateTimeTranslator.cpp.
References dtCENTURY, dtDAY, dtDECADE, dtHOUR, dtMICROSECOND, dtMILLENNIUM, dtMILLISECOND, dtMINUTE, dtMONTH, dtNANOSECOND, dtQUARTER, dtQUARTERDAY, dtSECOND, dtWEEK, dtWEEK_SATURDAY, dtWEEK_SUNDAY, and dtYEAR.
Referenced by generate().
199 if (boost::iequals(
field,
"year")) {
201 }
else if (boost::iequals(
field,
"quarter")) {
203 }
else if (boost::iequals(
field,
"month")) {
205 }
else if (boost::iequals(
field,
"quarterday")) {
207 }
else if (boost::iequals(
field,
"day")) {
209 }
else if (boost::iequals(
field,
"hour")) {
211 }
else if (boost::iequals(
field,
"minute")) {
213 }
else if (boost::iequals(
field,
"second")) {
215 }
else if (boost::iequals(
field,
"millennium")) {
217 }
else if (boost::iequals(
field,
"century")) {
219 }
else if (boost::iequals(
field,
"decade")) {
221 }
else if (boost::iequals(
field,
"millisecond")) {
223 }
else if (boost::iequals(
field,
"microsecond")) {
225 }
else if (boost::iequals(
field,
"nanosecond")) {
227 }
else if (boost::iequals(
field,
"week")) {
229 }
else if (boost::iequals(
field,
"week_sunday")) {
231 }
else if (boost::iequals(
field,
"week_saturday")) {
234 throw std::runtime_error(
"Invalid field in DATE_TRUNC 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: