OmniSciDB  471d68cefb
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 209 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 255 of file ParquetMetadataValidator.h.

References kSecsPerDay.

255  {
256  auto [min_value, max_value] = get_min_max_bounds<D>();
257  return value >= kSecsPerDay * min_value && value <= kSecsPerDay * max_value;
258  }
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 240 of file ParquetMetadataValidator.h.

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

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

241  {
242  CHECK(column_type.is_date());
243  switch (column_type.get_size()) {
244  case 4:
245  return getMinMaxBoundsAsStrings<int32_t>(column_type);
246  case 2:
247  return getMinMaxBoundsAsStrings<int16_t>(column_type);
248  default:
249  UNREACHABLE();
250  }
251  return {};
252  }
HOST DEVICE int get_size() const
Definition: sqltypes.h:339
#define UNREACHABLE()
Definition: Logger.h:253
#define CHECK(condition)
Definition: Logger.h:209
bool is_date() const
Definition: sqltypes.h:868

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

References foreign_storage::datetime_to_string(), and kSecsPerDay.

262  {
263  auto [min_value, max_value] = get_min_max_bounds<D>();
264  return {datetime_to_string(kSecsPerDay * min_value, column_type),
265  datetime_to_string(kSecsPerDay * max_value, column_type)};
266  }
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 216 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< NullType >::validate(), and foreign_storage::ParquetTimestampEncoder< V, T, conversion_denominator, NullType >::validate().

216  {
217  if (!valueWithinBounds(data_value, column_type)) {
218  auto [min_allowed_value, max_allowed_value] = getMinMaxBoundsAsStrings(column_type);
220  min_allowed_value,
221  max_allowed_value,
222  datetime_to_string(data_value, column_type));
223  }
224  }
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 227 of file ParquetMetadataValidator.h.

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

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

227  {
228  CHECK(column_type.is_date());
229  switch (column_type.get_size()) {
230  case 4:
231  return checkBounds<int32_t>(value);
232  case 2:
233  return checkBounds<int16_t>(value);
234  default:
235  UNREACHABLE();
236  }
237  return {};
238  }
HOST DEVICE int get_size() const
Definition: sqltypes.h:339
#define UNREACHABLE()
Definition: Logger.h:253
#define CHECK(condition)
Definition: Logger.h:209
bool is_date() const
Definition: sqltypes.h:868

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