OmniSciDB  c1a53651b2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Column< Array< T > > Struct Template Reference

#include <heavydbTypes.h>

Public Member Functions

 Column (int8_t *flatbuffer, const int64_t num_rows)
 
DEVICE Array< T > getItem (const int64_t index, const int64_t expected_numel=-1) const
 
DEVICE Array< T > operator[] (const unsigned int index) const
 
DEVICE int64_t size () const
 
DEVICE bool isNull (int64_t index) const
 
DEVICE void setNull (int64_t index)
 
DEVICE void setItem (int64_t index, const Array< T > &other)
 
DEVICE void concatItem (int64_t index, const Array< T > &other)
 
DEVICE int32_t getDictDbId () const
 
DEVICE int32_t getDictId () const
 

Public Attributes

int8_t * flatbuffer_
 
int64_t num_rows_
 

Detailed Description

template<typename T>
struct Column< Array< T > >

Definition at line 784 of file heavydbTypes.h.

Constructor & Destructor Documentation

template<typename T >
Column< Array< T > >::Column ( int8_t *  flatbuffer,
const int64_t  num_rows 
)
inline

Definition at line 794 of file heavydbTypes.h.

795  : flatbuffer_(flatbuffer), num_rows_(num_rows) {}

Member Function Documentation

template<typename T >
DEVICE void Column< Array< T > >::concatItem ( int64_t  index,
const Array< T > &  other 
)
inline

Definition at line 881 of file heavydbTypes.h.

References Array< T >::getSize(), Array< T >::isNull(), FlatBufferManager::setNull(), heavydb.dtypes::T, and toString().

881  {
884  if (other.isNull()) {
885  status = m.setNull(index);
886  } else {
887  status = m.concatItem(index,
888  reinterpret_cast<const int8_t*>(&(other[0])),
889  other.getSize() * sizeof(T));
890 #ifndef __CUDACC__
891  if (status != FlatBufferManager::Status::Success) {
892  throw std::runtime_error("concatItem failed: " + ::toString(status));
893  }
894 #endif
895  }
896  }
DEVICE int64_t getSize() const
Definition: heavydbTypes.h:256
std::string toString(const ExecutorDeviceType &device_type)
DEVICE bool isNull() const
Definition: heavydbTypes.h:258

+ Here is the call graph for this function:

template<typename T >
DEVICE int32_t Column< Array< T > >::getDictDbId ( ) const
inline

Definition at line 898 of file heavydbTypes.h.

References FlatBufferManager::getDTypeMetadataDictDbId().

898  {
900  return m.getDTypeMetadataDictDbId();
901  }

+ Here is the call graph for this function:

template<typename T >
DEVICE int32_t Column< Array< T > >::getDictId ( ) const
inline

Definition at line 903 of file heavydbTypes.h.

References FlatBufferManager::getDTypeMetadataDictId().

903  {
905  return m.getDTypeMetadataDictId();
906  }

+ Here is the call graph for this function:

template<typename T >
DEVICE Array<T> Column< Array< T > >::getItem ( const int64_t  index,
const int64_t  expected_numel = -1 
) const
inline

Definition at line 797 of file heavydbTypes.h.

References is_null(), run_benchmark_import::result, Column< T >::size(), heavydb.dtypes::T, and toString().

797  {
799  int8_t* ptr;
800  int64_t size;
801  bool is_null;
802  auto status = m.getItem(index, size, ptr, is_null);
803  if (status == FlatBufferManager::Status::ItemUnspecifiedError) {
804  if (expected_numel < 0) {
805 #ifndef __CUDACC__
806  throw std::runtime_error("getItem failed: " + ::toString(status));
807 #endif
808  }
809  status = m.setItem(index,
810  nullptr,
811  expected_numel * sizeof(T),
812  nullptr); // reserves a junk in array buffer
813  if (status != FlatBufferManager::Status::Success) {
814 #ifndef __CUDACC__
815  throw std::runtime_error("getItem failed[setItem]: " + ::toString(status));
816 #endif
817  }
818  status = m.getItem(index, size, ptr, is_null);
819  }
820  if (status == FlatBufferManager::Status::Success) {
821  if (expected_numel >= 0 &&
822  expected_numel * static_cast<int64_t>(sizeof(T)) != size) {
823 #ifndef __CUDACC__
824  throw std::runtime_error("getItem failed: unexpected size");
825 #endif
826  }
827  } else {
828 #ifndef __CUDACC__
829  throw std::runtime_error("getItem failed: " + ::toString(status));
830 #endif
831  }
832  Array<T> result(reinterpret_cast<T*>(ptr), size / sizeof(T), is_null);
833  return result;
834  }
DEVICE int64_t size() const
Definition: heavydbTypes.h:840
CONSTEXPR DEVICE bool is_null(const T &value)
std::string toString(const ExecutorDeviceType &device_type)

+ Here is the call graph for this function:

template<typename T >
DEVICE bool Column< Array< T > >::isNull ( int64_t  index) const
inline

Definition at line 842 of file heavydbTypes.h.

References is_null(), and toString().

842  {
844  bool is_null = false;
845  auto status = m.isNull(index, is_null);
846 #ifndef __CUDACC__
847  if (status != FlatBufferManager::Status::Success) {
848  throw std::runtime_error("isNull failed: " + ::toString(status));
849  }
850 #endif
851  return is_null;
852  }
CONSTEXPR DEVICE bool is_null(const T &value)
std::string toString(const ExecutorDeviceType &device_type)

+ Here is the call graph for this function:

template<typename T >
DEVICE Array<T> Column< Array< T > >::operator[] ( const unsigned int  index) const
inline

Definition at line 836 of file heavydbTypes.h.

836  {
837  return getItem(static_cast<int64_t>(index));
838  }
DEVICE Array< T > getItem(const int64_t index, const int64_t expected_numel=-1) const
Definition: heavydbTypes.h:797
template<typename T >
DEVICE void Column< Array< T > >::setItem ( int64_t  index,
const Array< T > &  other 
)
inline

Definition at line 864 of file heavydbTypes.h.

References Array< T >::getSize(), Array< T >::isNull(), FlatBufferManager::setNull(), heavydb.dtypes::T, and toString().

864  {
867  if (other.isNull()) {
868  status = m.setNull(index);
869  } else {
870  status = m.setItem(index,
871  reinterpret_cast<const int8_t*>(&(other[0])),
872  other.getSize() * sizeof(T));
873  }
874 #ifndef __CUDACC__
875  if (status != FlatBufferManager::Status::Success) {
876  throw std::runtime_error("setItem failed: " + ::toString(status));
877  }
878 #endif
879  }
DEVICE int64_t getSize() const
Definition: heavydbTypes.h:256
std::string toString(const ExecutorDeviceType &device_type)
DEVICE bool isNull() const
Definition: heavydbTypes.h:258

+ Here is the call graph for this function:

template<typename T >
DEVICE void Column< Array< T > >::setNull ( int64_t  index)
inline

Definition at line 854 of file heavydbTypes.h.

References FlatBufferManager::setNull(), and toString().

854  {
856  auto status = m.setNull(index);
857 #ifndef __CUDACC__
858  if (status != FlatBufferManager::Status::Success) {
859  throw std::runtime_error("setNull failed: " + ::toString(status));
860  }
861 #endif
862  }
std::string toString(const ExecutorDeviceType &device_type)

+ Here is the call graph for this function:

template<typename T >
DEVICE int64_t Column< Array< T > >::size ( ) const
inline

Definition at line 840 of file heavydbTypes.h.

References Column< T >::num_rows_.

840 { return num_rows_; }

Member Data Documentation

template<typename T >
int8_t* Column< Array< T > >::flatbuffer_

Definition at line 790 of file heavydbTypes.h.

template<typename T >
int64_t Column< Array< T > >::num_rows_

Definition at line 792 of file heavydbTypes.h.


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