OmniSciDB  bf83d84833
 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 941 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 965 of file ResultSetIteration.cpp.

References ResultSet::GeoTargetValueGpuPtr, SQLTypeInfo::get_notnull(), SQLTypeInfo::get_type(), is_null(), Geospatial::is_null_point(), kARRAY, kDOUBLE, kENCODING_NONE, and kPOINT.

970  {
971  auto ad_arr_generator = [&](auto datum_fetcher) {
972  constexpr int num_vals = sizeof...(vals);
973  static_assert(
974  num_vals % 2 == 0,
975  "Must have consistent pointer/size pairs for lazy fetch of geo target values.");
976  const auto vals_vector = std::vector<int64_t>{vals...};
977 
978  std::array<VarlenDatumPtr, num_vals / 2> ad_arr;
979  size_t ctr = 0;
980  for (size_t i = 0; i < vals_vector.size(); i += 2) {
981  ad_arr[ctr] = datum_fetcher(vals_vector[i], vals_vector[i + 1]);
982  // All fetched datums come in with is_null set to false
983  if (!geo_ti.get_notnull()) {
984  bool is_null = false;
985  // Now need to set the nullness
986  if (ad_arr[ctr]->length == 0 || ad_arr[ctr]->pointer == NULL) {
987  is_null = true;
988  } else if (geo_ti.get_type() == kPOINT && ctr == 0 &&
989  is_null_point(geo_ti, ad_arr[ctr]->pointer, ad_arr[ctr]->length)) {
990  is_null = true; // recognizes compressed and uncompressed points
991  } else if (ad_arr[ctr]->length == 4 * sizeof(double)) {
992  // Bounds
993  auto dti = SQLTypeInfo(kARRAY, 0, 0, false, kENCODING_NONE, 0, kDOUBLE);
994  is_null = dti.is_null_fixlen_array(ad_arr[ctr]->pointer, ad_arr[ctr]->length);
995  }
996  ad_arr[ctr]->is_null = is_null;
997  }
998  ctr++;
999  }
1000  return ad_arr;
1001  };
1002 
1003  if (fetch_data_from_gpu) {
1005  return ad_arr_generator(yieldGpuPtrFetcher());
1006  } else {
1007  return ad_arr_generator(yieldGpuDatumFetcher(data_mgr, device_id));
1008  }
1009  } else {
1010  return ad_arr_generator(yieldCpuDatumFetcher());
1011  }
1012  }
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:311
CONSTEXPR DEVICE bool is_null(const T &value)
static auto yieldGpuDatumFetcher(Data_Namespace::DataMgr *data_mgr_ptr, const int device_id)
HOST DEVICE bool get_notnull() const
Definition: sqltypes.h:318
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 957 of file ResultSetIteration.cpp.

957  {
958  return [](const int64_t ptr, const int64_t length) -> VarlenDatumPtr {
959  // Just fetching the data from gpu, not checking geo nullness
960  return std::make_unique<VarlenDatum>(length, reinterpret_cast<int8_t*>(ptr), false);
961  };
962  }
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 949 of file ResultSetIteration.cpp.

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

950  {
951  return [data_mgr_ptr, device_id](const int64_t ptr,
952  const int64_t length) -> VarlenDatumPtr {
953  return fetch_data_from_gpu(ptr, length, data_mgr_ptr, device_id);
954  };
955  }
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 942 of file ResultSetIteration.cpp.

942  {
943  return [](const int64_t ptr, const int64_t length) -> VarlenDatumPtr {
944  // Just fetching the data from gpu, not checking geo nullness
945  return std::make_unique<VarlenDatum>(length, reinterpret_cast<int8_t*>(ptr), false);
946  };
947  }
std::unique_ptr< VarlenDatum > VarlenDatumPtr

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