OmniSciDB
a5dc49c757
|
#include "DateTruncate.h"
#include "ExtractFromTime.h"
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <iostream>
#include <limits>
Go to the source code of this file.
Classes | |
struct | anonymous_namespace{DateTruncate.cpp}::EraTime |
Namespaces | |
anonymous_namespace{DateTruncate.cpp} | |
Functions | |
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t | datetrunc_minute (int64_t timeval) |
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t | datetrunc_hour (int64_t timeval) |
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t | datetrunc_quarterday (int64_t timeval) |
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t | datetrunc_day (int64_t timeval) |
template<unsigned OFFSET> | |
ALWAYS_INLINE DEVICE int64_t | datetrunc_week (int64_t timeval) |
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t | datetrunc_week_monday (int64_t timeval) |
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t | datetrunc_week_sunday (int64_t timeval) |
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t | datetrunc_week_saturday (int64_t timeval) |
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t | datetrunc_month (int64_t timeval) |
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t | datetrunc_quarter (int64_t timeval) |
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t | datetrunc_year (int64_t timeval) |
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t | datetrunc_decade (int64_t timeval) |
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t | datetrunc_century (int64_t timeval) |
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t | datetrunc_millennium (int64_t timeval) |
DEVICE int64_t | DateTruncate (DatetruncField field, const int64_t timeval) |
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t | DateTruncateHighPrecisionToDate (const int64_t timeval, const int64_t scale) |
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t | DateTruncateHighPrecisionToDateNullable (const int64_t timeval, const int64_t scale, const int64_t null_val) |
RUNTIME_EXPORT DEVICE int64_t | DateDiff (const DatetruncField datepart, const int64_t startdate, const int64_t enddate) |
RUNTIME_EXPORT DEVICE int64_t | DateDiffHighPrecision (const DatetruncField datepart, const int64_t startdate, const int64_t enddate, const int32_t start_dim, const int32_t end_dim) |
RUNTIME_EXPORT DEVICE int64_t | DateDiffNullable (const DatetruncField datepart, const int64_t startdate, const int64_t enddate, const int64_t null_val) |
RUNTIME_EXPORT DEVICE int64_t | DateDiffHighPrecisionNullable (const DatetruncField datepart, const int64_t startdate, const int64_t enddate, const int32_t start_dim, const int32_t end_dim, const int64_t null_val) |
Variables | |
constexpr unsigned | anonymous_namespace{DateTruncate.cpp}::dtMONDAY = 3 |
constexpr unsigned | anonymous_namespace{DateTruncate.cpp}::dtSUNDAY = 4 |
constexpr unsigned | anonymous_namespace{DateTruncate.cpp}::dtSATURDAY = 5 |
RUNTIME_EXPORT DEVICE int64_t DateDiff | ( | const DatetruncField | datepart, |
const int64_t | startdate, | ||
const int64_t | enddate | ||
) |
Definition at line 397 of file DateTruncate.cpp.
References dtDAY, dtHOUR, dtMICROSECOND, dtMILLISECOND, dtMINUTE, dtNANOSECOND, dtQUARTERDAY, dtSECOND, dtWEEK, dtWEEK_SATURDAY, dtWEEK_SUNDAY, kMicroSecsPerSec, kMilliSecsPerSec, kNanoSecsPerSec, kSecsPerDay, kSecsPerHour, and kSecsPerMin.
Referenced by DateDiffHighPrecision(), and DateDiffNullable().
RUNTIME_EXPORT DEVICE int64_t DateDiffHighPrecision | ( | const DatetruncField | datepart, |
const int64_t | startdate, | ||
const int64_t | enddate, | ||
const int32_t | start_dim, | ||
const int32_t | end_dim | ||
) |
Definition at line 427 of file DateTruncate.cpp.
References DateDiff(), dtMICROSECOND, dtMILLISECOND, dtNANOSECOND, and floor_div().
Referenced by DateDiffHighPrecisionNullable().
RUNTIME_EXPORT DEVICE int64_t DateDiffHighPrecisionNullable | ( | const DatetruncField | datepart, |
const int64_t | startdate, | ||
const int64_t | enddate, | ||
const int32_t | start_dim, | ||
const int32_t | end_dim, | ||
const int64_t | null_val | ||
) |
Definition at line 474 of file DateTruncate.cpp.
References DateDiffHighPrecision().
RUNTIME_EXPORT DEVICE int64_t DateDiffNullable | ( | const DatetruncField | datepart, |
const int64_t | startdate, | ||
const int64_t | enddate, | ||
const int64_t | null_val | ||
) |
Definition at line 463 of file DateTruncate.cpp.
References DateDiff().
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t datetrunc_century | ( | int64_t | timeval | ) |
Definition at line 215 of file DateTruncate.cpp.
References floor_div(), kDaysPer400Years, kEpochAdjustedDays, kSecsPerDay, MARJAN, and unsigned_mod().
Referenced by DateTruncate().
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t datetrunc_day | ( | int64_t | timeval | ) |
Definition at line 47 of file DateTruncate.cpp.
References kSecsPerDay, and unsigned_mod().
Referenced by DateTruncate().
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t datetrunc_decade | ( | int64_t | timeval | ) |
Definition at line 196 of file DateTruncate.cpp.
References floor_div(), JANMAR, kDaysPer400Years, kEpochAdjustedDays, kSecsPerDay, MARJAN, and unsigned_mod().
Referenced by DateTruncate().
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t datetrunc_hour | ( | int64_t | timeval | ) |
Definition at line 38 of file DateTruncate.cpp.
References kSecsPerHour, and unsigned_mod().
Referenced by DateTruncate().
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t datetrunc_millennium | ( | int64_t | timeval | ) |
Definition at line 224 of file DateTruncate.cpp.
References floor_div(), kDaysPer400Years, kEpochAdjustedDays, kSecsPerDay, MARJAN, and unsigned_mod().
Referenced by DateTruncate().
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t datetrunc_minute | ( | int64_t | timeval | ) |
Definition at line 34 of file DateTruncate.cpp.
References kSecsPerMin, and unsigned_mod().
Referenced by DateTruncate().
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t datetrunc_month | ( | int64_t | timeval | ) |
Definition at line 79 of file DateTruncate.cpp.
References floor_div(), kDaysPer400Years, kEpochAdjustedDays, kEpochOffsetYear1900, kMonsPerYear, kSecondsPer4YearCycle, kSecondsPerNonLeapYear, kSecsJanToMar1900, kSecsPerDay, kUSecsPerDay, STATIC_QUAL, and unsigned_mod().
Referenced by DateTruncate().
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t datetrunc_quarter | ( | int64_t | timeval | ) |
Definition at line 128 of file DateTruncate.cpp.
References floor_div(), JANMAR, kDaysPer400Years, kEpochAdjustedDays, kEpochOffsetYear1900, kSecondsPer4YearCycle, kSecondsPerNonLeapYear, kSecsJanToMar1900, kSecsPerDay, kUSecsPerDay, STATIC_QUAL, and unsigned_mod().
Referenced by DateTruncate().
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t datetrunc_quarterday | ( | int64_t | timeval | ) |
Definition at line 43 of file DateTruncate.cpp.
References kSecsPerQuarterDay, and unsigned_mod().
Referenced by DateTruncate().
ALWAYS_INLINE DEVICE int64_t datetrunc_week | ( | int64_t | timeval | ) |
Definition at line 59 of file DateTruncate.cpp.
References kSecsPerDay, and unsigned_mod().
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t datetrunc_week_monday | ( | int64_t | timeval | ) |
Definition at line 65 of file DateTruncate.cpp.
Referenced by DateTruncate().
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t datetrunc_week_saturday | ( | int64_t | timeval | ) |
Definition at line 75 of file DateTruncate.cpp.
Referenced by DateTruncate().
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t datetrunc_week_sunday | ( | int64_t | timeval | ) |
Definition at line 70 of file DateTruncate.cpp.
Referenced by DateTruncate().
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t datetrunc_year | ( | int64_t | timeval | ) |
Definition at line 171 of file DateTruncate.cpp.
References floor_div(), JANMAR, kDaysPer400Years, kEpochAdjustedDays, kEpochOffsetYear1900, kSecondsPer4YearCycle, kSecondsPerNonLeapYear, kSecsJanToMar1900, kSecsPerDay, kUSecsPerDay, MARJAN, and unsigned_mod().
Referenced by DateTruncate().
DEVICE int64_t DateTruncate | ( | DatetruncField | field, |
const int64_t | timeval | ||
) |
Definition at line 242 of file DateTruncate.cpp.
References datetrunc_century(), datetrunc_day(), datetrunc_decade(), datetrunc_hour(), datetrunc_millennium(), datetrunc_minute(), datetrunc_month(), datetrunc_quarter(), datetrunc_quarterday(), datetrunc_week_monday(), datetrunc_week_saturday(), datetrunc_week_sunday(), datetrunc_year(), dtCENTURY, dtDAY, dtDECADE, dtHOUR, dtMICROSECOND, dtMILLENNIUM, dtMILLISECOND, dtMINUTE, dtMONTH, dtNANOSECOND, dtQUARTER, dtQUARTERDAY, dtSECOND, dtWEEK, dtWEEK_SATURDAY, dtWEEK_SUNDAY, and dtYEAR.
Referenced by Analyzer::Constant::do_cast(), anonymous_namespace{ExpressionRange.cpp}::getDateTimePrecisionCastRange(), DateTimeTranslator::getDateTruncConstantValue(), Timestamp::truncateToDay(), Timestamp::truncateToHours(), Timestamp::truncateToMinutes(), Timestamp::truncateToMonth(), and Timestamp::truncateToYear().
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t DateTruncateHighPrecisionToDate | ( | const int64_t | timeval, |
const int64_t | scale | ||
) |
Definition at line 286 of file DateTruncate.cpp.
References floor_div(), and kSecsPerDay.
Referenced by DateTruncateHighPrecisionToDateNullable(), Analyzer::Constant::do_cast(), and Executor::skipFragment().
RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t DateTruncateHighPrecisionToDateNullable | ( | const int64_t | timeval, |
const int64_t | scale, | ||
const int64_t | null_val | ||
) |
Definition at line 291 of file DateTruncate.cpp.
References DateTruncateHighPrecisionToDate().