OmniSciDB  dfae7c3b14
anonymous_namespace{ResultSetIteration.cpp}::GeoLazyFetchHandler Struct Reference

Static Public Member Functions

template<typename... T>
static auto fetch (const SQLTypeInfo &geo_ti, const ResultSet::GeoReturnType return_type, T &&... vals)
 

Detailed Description

Definition at line 951 of file ResultSetIteration.cpp.

Member Function Documentation

◆ fetch()

template<typename... T>
static auto anonymous_namespace{ResultSetIteration.cpp}::GeoLazyFetchHandler::fetch ( const SQLTypeInfo geo_ti,
const ResultSet::GeoReturnType  return_type,
T &&...  vals 
)
inlinestatic

Definition at line 953 of file ResultSetIteration.cpp.

References SQLTypeInfo::get_notnull(), SQLTypeInfo::get_type(), Geospatial::is_null_point(), kPOINT, anonymous_namespace{ResultSetIteration.cpp}::lazy_fetch_chunk(), and anonymous_namespace{ResultSetIteration.cpp}::make_vals_vector().

955  {
956  constexpr int num_vals = sizeof...(vals);
957  static_assert(
958  num_vals % 2 == 0,
959  "Must have consistent pointer/size pairs for lazy fetch of geo target values.");
960  const auto vals_vector = make_vals_vector(std::make_index_sequence<num_vals / 2>{},
961  std::make_tuple(vals...));
962  std::array<VarlenDatumPtr, num_vals / 2> ad_arr;
963  size_t ctr = 0;
964  for (const auto& col_pair : vals_vector) {
965  ad_arr[ctr] = lazy_fetch_chunk(col_pair.first, col_pair.second);
966  // Regular chunk iterator used to fetch this datum sets the right nullness.
967  // That includes the fixlen bounds array.
968  // However it may incorrectly set it for the POINT coord array datum
969  // if 1st byte happened to hold NULL_ARRAY_TINYINT. One should either use
970  // the specialized iterator for POINT coords or rely on regular iterator +
971  // reset + recheck, which is what is done below.
972  auto is_point = (geo_ti.get_type() == kPOINT && ctr == 0);
973  if (is_point) {
974  // Resetting POINT coords array nullness here
975  ad_arr[ctr]->is_null = false;
976  }
977  if (!geo_ti.get_notnull()) {
978  // Recheck and set nullness
979  if (ad_arr[ctr]->length == 0 || ad_arr[ctr]->pointer == NULL ||
980  (is_point &&
981  is_null_point(geo_ti, ad_arr[ctr]->pointer, ad_arr[ctr]->length))) {
982  ad_arr[ctr]->is_null = true;
983  }
984  }
985  ctr++;
986  }
987  return ad_arr;
988  }
std::unique_ptr< ArrayDatum > lazy_fetch_chunk(const int8_t *ptr, const int64_t varlen_ptr)
bool is_null_point(const SQLTypeInfo &geo_ti, const int8_t *coords, const size_t coords_sz)
std::vector< std::pair< const int8_t *, const int64_t > > make_vals_vector(std::index_sequence< indices... >, const Tuple &tuple)
HOST DEVICE bool get_notnull() const
Definition: sqltypes.h:266
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:259
std::unique_ptr< VarlenDatum > VarlenDatumPtr
+ Here is the call graph for this function:

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