OmniSciDB  21ac014ffc
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 886 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 888 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().

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

+ Here is the call graph for this function:


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