OmniSciDB  b24e664e58
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DateTimeTranslator Class Reference

#include <DateTimeTranslator.h>

+ Inheritance diagram for DateTimeTranslator:

Static Public Member Functions

static int64_t getExtractFromTimeConstantValue (const int64_t &timeval, const ExtractField &field, const SQLTypeInfo &ti)
 
static int64_t getDateTruncConstantValue (const int64_t &timeval, const DatetruncField &field, const SQLTypeInfo &ti)
 

Static Protected Member Functions

static std::shared_ptr
< Analyzer::Constant
getNumericConstant (const int64_t scale)
 

Detailed Description

Definition at line 34 of file DateTimeTranslator.h.

Member Function Documentation

static int64_t DateTimeTranslator::getDateTruncConstantValue ( const int64_t &  timeval,
const DatetruncField field,
const SQLTypeInfo ti 
)
inlinestatic

Definition at line 59 of file DateTimeTranslator.h.

References DateTruncate(), DateTimeUtils::get_datetrunc_high_precision_scale(), SQLTypeInfoCore< TYPE_FACET_PACK >::get_dimension(), DateTimeUtils::get_timestamp_precision_scale(), DateTimeUtils::is_subsecond_datetrunc_field(), and run_benchmark_import::result.

Referenced by DateTruncExpr::generate(), and getExpressionRange().

61  {
62  if (ti.is_high_precision_timestamp()) {
65  return result != -1 ? (DateTruncate(field, timeval) / result) * result
66  : DateTruncate(field, timeval);
67  } else {
68  const int64_t scale = get_timestamp_precision_scale(ti.get_dimension());
69  return DateTruncate(field, timeval / scale) * scale;
70  }
71  }
72  return DateTruncate(field, timeval);
73  }
NEVER_INLINE DEVICE int64_t DateTruncate(DatetruncField field, const int64_t timeval)
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
Definition: JsonAccessors.h:31
constexpr bool is_subsecond_datetrunc_field(const DatetruncField field)
HOST DEVICE int get_dimension() const
Definition: sqltypes.h:328
constexpr int64_t get_timestamp_precision_scale(const int32_t dimen)
Definition: DateTimeUtils.h:48
const int64_t get_datetrunc_high_precision_scale(const DatetruncField &field, const int32_t dimen)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int64_t DateTimeTranslator::getExtractFromTimeConstantValue ( const int64_t &  timeval,
const ExtractField field,
const SQLTypeInfo ti 
)
inlinestatic

Definition at line 36 of file DateTimeTranslator.h.

References ExtractFromTime(), SQLTypeInfoCore< TYPE_FACET_PACK >::get_dimension(), DateTimeUtils::get_extract_high_precision_adjusted_scale(), DateTimeUtils::get_extract_timestamp_precision_scale(), DateTimeUtils::get_timestamp_precision_scale(), DateTimeUtils::is_subsecond_extract_field(), kDIVIDE, and run_benchmark_import::result.

Referenced by ExtractExpr::generate().

38  {
39  if (ti.is_high_precision_timestamp()) {
41  const auto result =
43  return result.second
45  result.first == kDIVIDE ? timeval / result.second
46  : timeval * result.second)
47  : ExtractFromTime(field, timeval);
48  } else {
49  return ExtractFromTime(
51  }
52  } else if (is_subsecond_extract_field(field)) {
53  return ExtractFromTime(field,
55  }
56  return ExtractFromTime(field, timeval);
57  }
constexpr int64_t get_extract_timestamp_precision_scale(const ExtractField field)
Definition: DateTimeUtils.h:78
const std::pair< SQLOps, int64_t > get_extract_high_precision_adjusted_scale(const ExtractField &field, const int32_t dimen)
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
Definition: JsonAccessors.h:31
NEVER_INLINE DEVICE int64_t ExtractFromTime(ExtractField field, const int64_t timeval)
HOST DEVICE int get_dimension() const
Definition: sqltypes.h:328
constexpr int64_t get_timestamp_precision_scale(const int32_t dimen)
Definition: DateTimeUtils.h:48
constexpr bool is_subsecond_extract_field(const ExtractField &field)
Definition: DateTimeUtils.h:92

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static std::shared_ptr<Analyzer::Constant> DateTimeTranslator::getNumericConstant ( const int64_t  scale)
inlinestaticprotected

Definition at line 76 of file DateTimeTranslator.h.

References Datum::bigintval, and kBIGINT.

77  {
78  Datum d{0};
79  d.bigintval = scale;
80  return makeExpr<Analyzer::Constant>(SQLTypeInfo(kBIGINT, false), false, d);
81  }
int64_t bigintval
Definition: sqltypes.h:129
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:852

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