OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
foreign_storage::BaseDateBoundsValidator< T, is_in_seconds > 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, bool is_in_seconds = true>
class foreign_storage::BaseDateBoundsValidator< T, is_in_seconds >

Definition at line 209 of file ParquetMetadataValidator.h.

Member Function Documentation

template<typename T , bool is_in_seconds = true>
template<typename D >
static bool foreign_storage::BaseDateBoundsValidator< T, is_in_seconds >::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  if (is_in_seconds) {
258  return value >= kSecsPerDay * min_value && value <= kSecsPerDay * max_value;
259  } else {
260  return value >= min_value && value <= max_value;
261  }
262  }
static constexpr int64_t kSecsPerDay
template<typename T , bool is_in_seconds = true>
static std::pair<std::string, std::string> foreign_storage::BaseDateBoundsValidator< T, is_in_seconds >::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::BaseDateBoundsValidator< T, is_in_seconds >::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:403
#define UNREACHABLE()
Definition: Logger.h:338
#define CHECK(condition)
Definition: Logger.h:291
bool is_date() const
Definition: sqltypes.h:1028

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T , bool is_in_seconds = true>
template<typename D >
static std::pair<std::string, std::string> foreign_storage::BaseDateBoundsValidator< T, is_in_seconds >::getMinMaxBoundsAsStrings ( const SQLTypeInfo column_type)
inlinestaticprivate

Definition at line 265 of file ParquetMetadataValidator.h.

References foreign_storage::datetime_to_string(), and kSecsPerDay.

266  {
267  auto [min_value, max_value] = get_min_max_bounds<D>();
268  return {datetime_to_string(kSecsPerDay * min_value, column_type),
269  datetime_to_string(kSecsPerDay * max_value, column_type)};
270  }
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 , bool is_in_seconds = true>
template<typename D >
static void foreign_storage::BaseDateBoundsValidator< T, is_in_seconds >::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::BaseDateBoundsValidator< T, is_in_seconds >::getMinMaxBoundsAsStrings(), foreign_storage::throw_parquet_metadata_out_of_bounds_error(), and foreign_storage::BaseDateBoundsValidator< T, is_in_seconds >::valueWithinBounds().

Referenced by foreign_storage::ParquetDateInDaysFromTimestampEncoder< V, T, conversion_denominator, NullType >::validate(), foreign_storage::ParquetDateInSecondsEncoder< NullType >::validate(), foreign_storage::ParquetTimestampEncoder< V, T, conversion_denominator *kSecsPerDay, NullType >::validate(), and foreign_storage::ParquetFixedLengthEncoder< V, T, NullType >::validateIntegralOrFloatingPointValue().

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  }
void throw_parquet_metadata_out_of_bounds_error(const std::string &min_value, const std::string &max_value, const std::string &encountered_value)
std::string datetime_to_string(const D &timestamp, const SQLTypeInfo &column_type)
static bool valueWithinBounds(const T &value, const SQLTypeInfo &column_type)
static std::pair< std::string, std::string > getMinMaxBoundsAsStrings(const SQLTypeInfo &column_type)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T , bool is_in_seconds = true>
static bool foreign_storage::BaseDateBoundsValidator< T, is_in_seconds >::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::BaseDateBoundsValidator< T, is_in_seconds >::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:403
#define UNREACHABLE()
Definition: Logger.h:338
#define CHECK(condition)
Definition: Logger.h:291
bool is_date() const
Definition: sqltypes.h:1028

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