OmniSciDB  a5dc49c757
 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 887 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 889 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().

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

+ Here is the call graph for this function:


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