27 #include "../Shared/sqldefs.h"
31 static const std::map<std::pair<int32_t, ExtractField>, std::pair<SQLOps, int64_t>>
39 static const std::map<std::pair<int32_t, DatetruncField>, int64_t>
46 namespace DateTimeUtils {
62 throw std::runtime_error(
"Unknown dimen = " +
std::to_string(dimen));
76 throw std::runtime_error(
"Unknown field = " +
std::to_string(field));
90 throw std::runtime_error(
"Unknown field = " +
std::to_string(field));
120 throw std::runtime_error(
"Unknown dimen = " +
std::to_string(dimen));
131 throw std::runtime_error(
"Unknown dimen = " +
std::to_string(dimen));
142 throw std::runtime_error(
"Unknown dimen = " +
std::to_string(dimen));
145 throw std::runtime_error(
"Unknown field = " +
std::to_string(field));
152 const int32_t dimen) {
161 const int32_t dimen) {
171 const int32_t dimen) {
176 throw std::runtime_error(
177 "Value Overflow/underflow detected while scaling DateTime precision.");
186 return std::numeric_limits<int64_t>::min();
constexpr int64_t get_extract_timestamp_precision_scale(const ExtractField field)
constexpr int64_t get_dateadd_timestamp_precision_scale(const DateaddField field)
const std::pair< SQLOps, int64_t > get_extract_high_precision_adjusted_scale(const ExtractField &field, const int32_t dimen)
constexpr int64_t get_datetime_scaled_epoch(const ScalingType direction, const int64_t epoch, const int32_t dimen)
static const std::map< std::pair< int32_t, ExtractField >, std::pair< SQLOps, int64_t > > extract_precision_lookup
static const std::map< std::pair< int32_t, DatetruncField >, int64_t > datetrunc_precision_lookup
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
const std::pair< SQLOps, int64_t > get_dateadd_high_precision_adjusted_scale(const DateaddField field, int32_t dimen)
constexpr bool is_subsecond_datetrunc_field(const DatetruncField field)
constexpr bool is_subsecond_dateadd_field(const DateaddField field)
constexpr int64_t get_timestamp_precision_scale(const int32_t dimen)
constexpr bool is_subsecond_extract_field(const ExtractField &field)
const int64_t get_datetrunc_high_precision_scale(const DatetruncField &field, const int32_t dimen)