Skip to content

Commit

Permalink
Keep original cast
Browse files Browse the repository at this point in the history
  • Loading branch information
PHILO-HE committed Sep 28, 2023
1 parent 4014be8 commit ff68a69
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions velox/type/Conversions.h
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,14 @@ struct Converter<TypeKind::DATE, void, TRUNCATE, ALLOW_DECIMAL> {
return fromDateString(v.data(), v.size());
}

static T cast(const Timestamp& t) {
static const int32_t kSecsPerDay{86'400};
auto seconds = t.getSeconds();
if (seconds >= 0 || seconds % kSecsPerDay == 0) {
return Date(seconds / kSecsPerDay);
}
}

static T cast(const Timestamp& t, const std::string& sessionTzName) {
static const int32_t kSecsPerDay{86'400};
auto ts = t;
Expand Down

0 comments on commit ff68a69

Please sign in to comment.