OmniSciDB  bf83d84833
 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 237 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 283 of file ParquetMetadataValidator.h.

References kSecsPerDay.

283  {
284  auto [min_value, max_value] = get_min_max_bounds<D>();
285  return value >= kSecsPerDay * min_value && value <= kSecsPerDay * max_value;
286  }
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 268 of file ParquetMetadataValidator.h.

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

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

269  {
270  CHECK(column_type.is_date());
271  switch (column_type.get_size()) {
272  case 4:
273  return getMinMaxBoundsAsStrings<int32_t>(column_type);
274  case 2:
275  return getMinMaxBoundsAsStrings<int16_t>(column_type);
276  default:
277  UNREACHABLE();
278  }
279  return {};
280  }
HOST DEVICE int get_size() const
Definition: sqltypes.h:321
#define UNREACHABLE()
Definition: Logger.h:241
#define CHECK(condition)
Definition: Logger.h:197
bool is_date() const
Definition: sqltypes.h:715

+ 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 289 of file ParquetMetadataValidator.h.

References foreign_storage::datetime_to_string(), and kSecsPerDay.

290  {
291  auto [min_value, max_value] = get_min_max_bounds<D>();
292  return {datetime_to_string(kSecsPerDay * min_value, column_type),
293  datetime_to_string(kSecsPerDay * max_value, column_type)};
294  }
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 244 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().

244  {
245  if (!valueWithinBounds(data_value, column_type)) {
246  auto [min_allowed_value, max_allowed_value] = getMinMaxBoundsAsStrings(column_type);
248  min_allowed_value,
249  max_allowed_value,
250  datetime_to_string(data_value, column_type));
251  }
252  }
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 255 of file ParquetMetadataValidator.h.

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

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

255  {
256  CHECK(column_type.is_date());
257  switch (column_type.get_size()) {
258  case 4:
259  return checkBounds<int32_t>(value);
260  case 2:
261  return checkBounds<int16_t>(value);
262  default:
263  UNREACHABLE();
264  }
265  return {};
266  }
HOST DEVICE int get_size() const
Definition: sqltypes.h:321
#define UNREACHABLE()
Definition: Logger.h:241
#define CHECK(condition)
Definition: Logger.h:197
bool is_date() const
Definition: sqltypes.h:715

+ 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: