OmniSciDB  04ee39c94c
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::ConstantgetNumericConstant (const int64_t scale)
 

Detailed Description

Definition at line 34 of file DateTimeTranslator.h.

Member Function Documentation

◆ getDateTruncConstantValue()

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 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)
HOST DEVICE int get_dimension() const
Definition: sqltypes.h:325
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)
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:

◆ getExtractFromTimeConstantValue()

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.

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
HOST DEVICE int get_dimension() const
Definition: sqltypes.h:325
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)
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:

◆ getNumericConstant()

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

Definition at line 76 of file DateTimeTranslator.h.

References anonymous_namespace{ImportTest.cpp}::d(), and kBIGINT.

77  {
78  Datum d{0};
79  d.bigintval = scale;
80  return makeExpr<Analyzer::Constant>(SQLTypeInfo(kBIGINT, false), false, d);
81  }
void d(const SQLTypes expected_type, const std::string &str)
Definition: ImportTest.cpp:268
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:823
+ Here is the call graph for this function:

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