OmniSciDB  06b3bd477c
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
anonymous_namespace{ResultSetIteration.cpp}::GeoQueryOutputFetchHandler Struct Reference

Static Public Member Functions

static auto yieldGpuPtrFetcher ()
 
static auto yieldGpuDatumFetcher (Data_Namespace::DataMgr *data_mgr_ptr, const int device_id)
 
static auto yieldCpuDatumFetcher ()
 
template<typename... T>
static auto fetch (const SQLTypeInfo &geo_ti, const ResultSet::GeoReturnType return_type, Data_Namespace::DataMgr *data_mgr, const bool fetch_data_from_gpu, const int device_id, T &&...vals)
 

Detailed Description

Definition at line 1002 of file ResultSetIteration.cpp.

Member Function Documentation

template<typename... T>
static auto anonymous_namespace{ResultSetIteration.cpp}::GeoQueryOutputFetchHandler::fetch ( const SQLTypeInfo geo_ti,
const ResultSet::GeoReturnType  return_type,
Data_Namespace::DataMgr data_mgr,
const bool  fetch_data_from_gpu,
const int  device_id,
T &&...  vals 
)
inlinestatic

Definition at line 1026 of file ResultSetIteration.cpp.

References ResultSet::GeoTargetValueGpuPtr, SQLTypeInfo::get_notnull(), SQLTypeInfo::get_type(), anonymous_namespace{TypedDataAccessors.h}::is_null(), geospatial::is_null_point(), kARRAY, kDOUBLE, kENCODING_NONE, and kPOINT.

1031  {
1032  auto ad_arr_generator = [&](auto datum_fetcher) {
1033  constexpr int num_vals = sizeof...(vals);
1034  static_assert(
1035  num_vals % 2 == 0,
1036  "Must have consistent pointer/size pairs for lazy fetch of geo target values.");
1037  const auto vals_vector = std::vector<int64_t>{vals...};
1038 
1039  std::array<VarlenDatumPtr, num_vals / 2> ad_arr;
1040  size_t ctr = 0;
1041  for (size_t i = 0; i < vals_vector.size(); i += 2) {
1042  ad_arr[ctr] = datum_fetcher(vals_vector[i], vals_vector[i + 1]);
1043  // All fetched datums come in with is_null set to false
1044  if (!geo_ti.get_notnull()) {
1045  bool is_null = false;
1046  // Now need to set the nullness
1047  if (ad_arr[ctr]->length == 0 || ad_arr[ctr]->pointer == NULL) {
1048  is_null = true;
1049  } else if (geo_ti.get_type() == kPOINT && ctr == 0 &&
1050  is_null_point(geo_ti, ad_arr[ctr]->pointer, ad_arr[ctr]->length)) {
1051  is_null = true; // recognizes compressed and uncompressed points
1052  } else if (ad_arr[ctr]->length == 4 * sizeof(double)) {
1053  // Bounds
1054  auto dti = SQLTypeInfo(kARRAY, 0, 0, false, kENCODING_NONE, 0, kDOUBLE);
1055  is_null = dti.is_null_fixlen_array(ad_arr[ctr]->pointer, ad_arr[ctr]->length);
1056  }
1057  ad_arr[ctr]->is_null = is_null;
1058  }
1059  ctr++;
1060  }
1061  return ad_arr;
1062  };
1063 
1064  if (fetch_data_from_gpu) {
1066  return ad_arr_generator(yieldGpuPtrFetcher());
1067  } else {
1068  return ad_arr_generator(yieldGpuDatumFetcher(data_mgr, device_id));
1069  }
1070  } else {
1071  return ad_arr_generator(yieldCpuDatumFetcher());
1072  }
1073  }
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:258
bool is_null(const T &v, const SQLTypeInfo &t)
static auto yieldGpuDatumFetcher(Data_Namespace::DataMgr *data_mgr_ptr, const int device_id)
bool is_null_point(const SQLTypeInfo &geo_ti, const int8_t *coords, const size_t coords_sz)
HOST DEVICE bool get_notnull() const
Definition: sqltypes.h:265
std::unique_ptr< VarlenDatum > VarlenDatumPtr
std::unique_ptr< ArrayDatum > fetch_data_from_gpu(int64_t varlen_ptr, const int64_t length, Data_Namespace::DataMgr *data_mgr, const int device_id)

+ Here is the call graph for this function:

static auto anonymous_namespace{ResultSetIteration.cpp}::GeoQueryOutputFetchHandler::yieldCpuDatumFetcher ( )
inlinestatic

Definition at line 1018 of file ResultSetIteration.cpp.

1018  {
1019  return [](const int64_t ptr, const int64_t length) -> VarlenDatumPtr {
1020  // Just fetching the data from gpu, not checking geo nullness
1021  return std::make_unique<VarlenDatum>(length, reinterpret_cast<int8_t*>(ptr), false);
1022  };
1023  }
std::unique_ptr< VarlenDatum > VarlenDatumPtr
static auto anonymous_namespace{ResultSetIteration.cpp}::GeoQueryOutputFetchHandler::yieldGpuDatumFetcher ( Data_Namespace::DataMgr data_mgr_ptr,
const int  device_id 
)
inlinestatic

Definition at line 1010 of file ResultSetIteration.cpp.

References anonymous_namespace{ResultSetIteration.cpp}::fetch_data_from_gpu().

1011  {
1012  return [data_mgr_ptr, device_id](const int64_t ptr,
1013  const int64_t length) -> VarlenDatumPtr {
1014  return fetch_data_from_gpu(ptr, length, data_mgr_ptr, device_id);
1015  };
1016  }
std::unique_ptr< VarlenDatum > VarlenDatumPtr
std::unique_ptr< ArrayDatum > fetch_data_from_gpu(int64_t varlen_ptr, const int64_t length, Data_Namespace::DataMgr *data_mgr, const int device_id)

+ Here is the call graph for this function:

static auto anonymous_namespace{ResultSetIteration.cpp}::GeoQueryOutputFetchHandler::yieldGpuPtrFetcher ( )
inlinestatic

Definition at line 1003 of file ResultSetIteration.cpp.

1003  {
1004  return [](const int64_t ptr, const int64_t length) -> VarlenDatumPtr {
1005  // Just fetching the data from gpu, not checking geo nullness
1006  return std::make_unique<VarlenDatum>(length, reinterpret_cast<int8_t*>(ptr), false);
1007  };
1008  }
std::unique_ptr< VarlenDatum > VarlenDatumPtr

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