OmniSciDB  85c2d10cdc
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
foreign_storage::DateInSecondsBoundsValidator< T > Class Template Reference

#include <ParquetMetadataValidator.h>

Static Public Member Functions

template<typename D >
static void validateValue (const D &data_value, const SQLTypeInfo &column_type)
 

Static Private Member Functions

static bool valueWithinBounds (const T &value, const SQLTypeInfo &column_type)
 
static std::pair< std::string,
std::string > 
getMinMaxBoundsAsStrings (const SQLTypeInfo &column_type)
 
template<typename D >
static bool checkBounds (const T &value)
 
template<typename D >
static std::pair< std::string,
std::string > 
getMinMaxBoundsAsStrings (const SQLTypeInfo &column_type)
 

Detailed Description

template<typename T>
class foreign_storage::DateInSecondsBoundsValidator< T >

Definition at line 230 of file ParquetMetadataValidator.h.

Member Function Documentation

template<typename T >
template<typename D >
static bool foreign_storage::DateInSecondsBoundsValidator< T >::checkBounds ( const T &  value)
inlinestaticprivate

Definition at line 276 of file ParquetMetadataValidator.h.

References kSecsPerDay.

276  {
277  auto [min_value, max_value] = get_min_max_bounds<D>();
278  return value >= kSecsPerDay * min_value && value <= kSecsPerDay * max_value;
279  }
static constexpr int64_t kSecsPerDay
template<typename T >
static std::pair<std::string, std::string> foreign_storage::DateInSecondsBoundsValidator< T >::getMinMaxBoundsAsStrings ( const SQLTypeInfo column_type)
inlinestaticprivate

Definition at line 261 of file ParquetMetadataValidator.h.

References CHECK, SQLTypeInfo::get_size(), SQLTypeInfo::is_date(), and UNREACHABLE.

Referenced by foreign_storage::DateInSecondsBoundsValidator< T >::validateValue().

262  {
263  CHECK(column_type.is_date());
264  switch (column_type.get_size()) {
265  case 4:
266  return getMinMaxBoundsAsStrings<int32_t>(column_type);
267  case 2:
268  return getMinMaxBoundsAsStrings<int16_t>(column_type);
269  default:
270  UNREACHABLE();
271  }
272  return {};
273  }
HOST DEVICE int get_size() const
Definition: sqltypes.h:324
#define UNREACHABLE()
Definition: Logger.h:241
#define CHECK(condition)
Definition: Logger.h:197
bool is_date() const
Definition: sqltypes.h:730

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T >
template<typename D >
static std::pair<std::string, std::string> foreign_storage::DateInSecondsBoundsValidator< T >::getMinMaxBoundsAsStrings ( const SQLTypeInfo column_type)
inlinestaticprivate

Definition at line 282 of file ParquetMetadataValidator.h.

References foreign_storage::datetime_to_string(), and kSecsPerDay.

283  {
284  auto [min_value, max_value] = get_min_max_bounds<D>();
285  return {datetime_to_string(kSecsPerDay * min_value, column_type),
286  datetime_to_string(kSecsPerDay * max_value, column_type)};
287  }
static constexpr int64_t kSecsPerDay
std::string datetime_to_string(const D &timestamp, const SQLTypeInfo &column_type)

+ Here is the call graph for this function:

template<typename T >
template<typename D >
static void foreign_storage::DateInSecondsBoundsValidator< T >::validateValue ( const D &  data_value,
const SQLTypeInfo column_type 
)
inlinestatic

Definition at line 237 of file ParquetMetadataValidator.h.

References foreign_storage::datetime_to_string(), foreign_storage::DateInSecondsBoundsValidator< T >::getMinMaxBoundsAsStrings(), foreign_storage::throw_parquet_metadata_out_of_bounds_error(), and foreign_storage::DateInSecondsBoundsValidator< T >::valueWithinBounds().

Referenced by foreign_storage::ParquetDateInSecondsEncoder::validate(), and foreign_storage::ParquetTimestampEncoder< V, T, conversion_denominator >::validate().

237  {
238  if (!valueWithinBounds(data_value, column_type)) {
239  auto [min_allowed_value, max_allowed_value] = getMinMaxBoundsAsStrings(column_type);
241  min_allowed_value,
242  max_allowed_value,
243  datetime_to_string(data_value, column_type));
244  }
245  }
static std::pair< std::string, std::string > getMinMaxBoundsAsStrings(const SQLTypeInfo &column_type)
void throw_parquet_metadata_out_of_bounds_error(const std::string &min_value, const std::string &max_value, const std::string &encountered_value)
static bool valueWithinBounds(const T &value, const SQLTypeInfo &column_type)
std::string datetime_to_string(const D &timestamp, const SQLTypeInfo &column_type)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T >
static bool foreign_storage::DateInSecondsBoundsValidator< T >::valueWithinBounds ( const T &  value,
const SQLTypeInfo column_type 
)
inlinestaticprivate

Definition at line 248 of file ParquetMetadataValidator.h.

References CHECK, SQLTypeInfo::get_size(), SQLTypeInfo::is_date(), and UNREACHABLE.

Referenced by foreign_storage::DateInSecondsBoundsValidator< T >::validateValue().

248  {
249  CHECK(column_type.is_date());
250  switch (column_type.get_size()) {
251  case 4:
252  return checkBounds<int32_t>(value);
253  case 2:
254  return checkBounds<int16_t>(value);
255  default:
256  UNREACHABLE();
257  }
258  return {};
259  }
HOST DEVICE int get_size() const
Definition: sqltypes.h:324
#define UNREACHABLE()
Definition: Logger.h:241
#define CHECK(condition)
Definition: Logger.h:197
bool is_date() const
Definition: sqltypes.h:730

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


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