OmniSciDB  85c2d10cdc
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 889 of file ResultSetIteration.cpp.

Member Function Documentation

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 891 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().

893  {
894  constexpr int num_vals = sizeof...(vals);
895  static_assert(
896  num_vals % 2 == 0,
897  "Must have consistent pointer/size pairs for lazy fetch of geo target values.");
898  const auto vals_vector = make_vals_vector(std::make_index_sequence<num_vals / 2>{},
899  std::make_tuple(vals...));
900  std::array<VarlenDatumPtr, num_vals / 2> ad_arr;
901  size_t ctr = 0;
902  for (const auto& col_pair : vals_vector) {
903  ad_arr[ctr] = lazy_fetch_chunk(col_pair.first, col_pair.second);
904  // Regular chunk iterator used to fetch this datum sets the right nullness.
905  // That includes the fixlen bounds array.
906  // However it may incorrectly set it for the POINT coord array datum
907  // if 1st byte happened to hold NULL_ARRAY_TINYINT. One should either use
908  // the specialized iterator for POINT coords or rely on regular iterator +
909  // reset + recheck, which is what is done below.
910  auto is_point = (geo_ti.get_type() == kPOINT && ctr == 0);
911  if (is_point) {
912  // Resetting POINT coords array nullness here
913  ad_arr[ctr]->is_null = false;
914  }
915  if (!geo_ti.get_notnull()) {
916  // Recheck and set nullness
917  if (ad_arr[ctr]->length == 0 || ad_arr[ctr]->pointer == NULL ||
918  (is_point &&
919  is_null_point(geo_ti, ad_arr[ctr]->pointer, ad_arr[ctr]->length))) {
920  ad_arr[ctr]->is_null = true;
921  }
922  }
923  ctr++;
924  }
925  return ad_arr;
926  }
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)
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:314
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:321
std::unique_ptr< VarlenDatum > VarlenDatumPtr

+ Here is the call graph for this function:


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