OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GeoMultiPointValueConverter Struct Reference

#include <TargetValueConvertersImpl.h>

+ Inheritance diagram for GeoMultiPointValueConverter:
+ Collaboration diagram for GeoMultiPointValueConverter:

Public Member Functions

 GeoMultiPointValueConverter (const Catalog_Namespace::Catalog &cat, size_t num_rows, const ColumnDescriptor *logicalColumnDescriptor)
 
 ~GeoMultiPointValueConverter () override
 
void allocateColumnarData (size_t num_rows) override
 
void convertToColumnarFormat (size_t row, const TargetValue *value) override
 
void addDataBlocksToInsertData (Fragmenter_Namespace::InsertData &insertData) override
 
- Public Member Functions inherited from GeoPointValueConverter
 GeoPointValueConverter (const Catalog_Namespace::Catalog &cat, size_t num_rows, const ColumnDescriptor *logicalColumnDescriptor)
 
 ~GeoPointValueConverter () override
 
ArrayDatum toCompressedCoords (const std::shared_ptr< std::vector< double >> &coords)
 
- Public Member Functions inherited from TargetValueConverter
 TargetValueConverter (const ColumnDescriptor *cd)
 
virtual ~TargetValueConverter ()
 
virtual void finalizeDataBlocksForInsertData ()
 

Public Attributes

const ColumnDescriptorbounds_column_descriptor_
 
std::unique_ptr< std::vector
< ArrayDatum > > 
bounds_data_
 
boost_variant_accessor
< GeoMultiPointTargetValue
GEO_MULTIPOINT_VALUE_ACCESSOR
 
- Public Attributes inherited from GeoPointValueConverter
const ColumnDescriptorcoords_column_descriptor_
 
std::unique_ptr< std::vector
< std::string > > 
column_data_
 
std::unique_ptr< std::vector
< ArrayDatum > > 
signed_compressed_coords_data_
 
boost_variant_accessor
< GeoTargetValue
GEO_VALUE_ACCESSOR
 
boost_variant_accessor
< GeoPointTargetValue
GEO_POINT_VALUE_ACCESSOR
 
- Public Attributes inherited from TargetValueConverter
const ColumnDescriptorcolumn_descriptor_
 
boost_variant_accessor
< ScalarTargetValue
SCALAR_TARGET_VALUE_ACCESSOR
 
boost_variant_accessor
< ArrayTargetValue
ARRAY_TARGET_VALUE_ACCESSOR
 
boost_variant_accessor
< GeoTargetValue
GEO_TARGET_VALUE_ACCESSOR
 
boost_variant_accessor
< NullableString
NULLABLE_STRING_ACCESSOR
 
boost_variant_accessor
< std::string > 
STRING_ACCESSOR
 

Detailed Description

Definition at line 743 of file TargetValueConvertersImpl.h.

Constructor & Destructor Documentation

GeoMultiPointValueConverter::GeoMultiPointValueConverter ( const Catalog_Namespace::Catalog cat,
size_t  num_rows,
const ColumnDescriptor logicalColumnDescriptor 
)
inline

Definition at line 748 of file TargetValueConvertersImpl.h.

References allocateColumnarData(), bounds_column_descriptor_, CHECK, TargetValueConverter::column_descriptor_, ColumnDescriptor::columnId, Catalog_Namespace::Catalog::getMetadataForColumn(), and ColumnDescriptor::tableId.

751  : GeoPointValueConverter(cat, num_rows, logicalColumnDescriptor) {
755 
756  if (num_rows) {
757  allocateColumnarData(num_rows);
758  }
759  }
const ColumnDescriptor * column_descriptor_
const ColumnDescriptor * bounds_column_descriptor_
void allocateColumnarData(size_t num_rows) override
GeoPointValueConverter(const Catalog_Namespace::Catalog &cat, size_t num_rows, const ColumnDescriptor *logicalColumnDescriptor)
const ColumnDescriptor * getMetadataForColumn(int tableId, const std::string &colName) const
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call graph for this function:

GeoMultiPointValueConverter::~GeoMultiPointValueConverter ( )
inlineoverride

Definition at line 761 of file TargetValueConvertersImpl.h.

761 {}

Member Function Documentation

void GeoMultiPointValueConverter::addDataBlocksToInsertData ( Fragmenter_Namespace::InsertData insertData)
inlineoverridevirtual

Reimplemented from GeoPointValueConverter.

Definition at line 796 of file TargetValueConvertersImpl.h.

References GeoPointValueConverter::addDataBlocksToInsertData(), DataBlockPtr::arraysPtr, bounds_column_descriptor_, bounds_data_, ColumnDescriptor::columnId, Fragmenter_Namespace::InsertData::columnIds, and Fragmenter_Namespace::InsertData::data.

796  {
798 
799  DataBlockPtr bounds;
800 
801  bounds.arraysPtr = bounds_data_.get();
802 
803  insertData.data.emplace_back(bounds);
804  insertData.columnIds.emplace_back(bounds_column_descriptor_->columnId);
805  }
std::vector< ArrayDatum > * arraysPtr
Definition: sqltypes.h:235
const ColumnDescriptor * bounds_column_descriptor_
std::vector< DataBlockPtr > data
the number of rows being inserted
Definition: Fragmenter.h:73
std::unique_ptr< std::vector< ArrayDatum > > bounds_data_
void addDataBlocksToInsertData(Fragmenter_Namespace::InsertData &insertData) override
std::vector< int > columnIds
identifies the table into which the data is being inserted
Definition: Fragmenter.h:71

+ Here is the call graph for this function:

void GeoMultiPointValueConverter::allocateColumnarData ( size_t  num_rows)
inlineoverridevirtual

Reimplemented from GeoPointValueConverter.

Definition at line 763 of file TargetValueConvertersImpl.h.

References GeoPointValueConverter::allocateColumnarData(), bounds_data_, and CHECK.

Referenced by GeoMultiPointValueConverter().

763  {
764  CHECK(num_rows > 0);
766  bounds_data_ = std::make_unique<std::vector<ArrayDatum>>(num_rows);
767  }
void allocateColumnarData(size_t num_rows) override
std::unique_ptr< std::vector< ArrayDatum > > bounds_data_
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void GeoMultiPointValueConverter::convertToColumnarFormat ( size_t  row,
const TargetValue value 
)
inlineoverridevirtual

Reimplemented from GeoPointValueConverter.

Definition at line 771 of file TargetValueConvertersImpl.h.

References CHECK, compute_bounds_of_coords(), GEO_MULTIPOINT_VALUE_ACCESSOR, TargetValueConverter::GEO_TARGET_VALUE_ACCESSOR, NULL_ARRAY_DOUBLE, NULL_DOUBLE, to_array_datum(), and GeoPointValueConverter::toCompressedCoords().

771  {
772  const auto geoValue =
773  checked_get<GeoTargetValue>(row, value, GEO_TARGET_VALUE_ACCESSOR);
774  CHECK(geoValue);
775  if (geoValue->is_initialized()) {
776  const auto geo = geoValue->get();
777  const auto geoMultiPoint =
778  checked_get<GeoMultiPointTargetValue>(row, &geo, GEO_MULTIPOINT_VALUE_ACCESSOR);
779 
780  (*column_data_)[row] = "";
781  (*signed_compressed_coords_data_)[row] = toCompressedCoords(geoMultiPoint->coords);
782  auto bounds = compute_bounds_of_coords(geoMultiPoint->coords);
783  (*bounds_data_)[row] = to_array_datum(bounds);
784  } else {
785  // NULL MultiPoint
786  (*column_data_)[row] = "";
787  (*signed_compressed_coords_data_)[row] = ArrayDatum(0, nullptr, true);
788  std::vector<double> bounds = {
789  NULL_ARRAY_DOUBLE, NULL_DOUBLE, NULL_DOUBLE, NULL_DOUBLE};
790  auto bounds_datum = to_array_datum(bounds);
791  bounds_datum.is_null = true;
792  (*bounds_data_)[row] = bounds_datum;
793  }
794  }
ArrayDatum to_array_datum(const std::vector< ELEM_TYPE > &vector)
#define NULL_DOUBLE
ArrayDatum toCompressedCoords(const std::shared_ptr< std::vector< double >> &coords)
std::vector< double > compute_bounds_of_coords(const std::shared_ptr< std::vector< double >> &coords)
boost_variant_accessor< GeoMultiPointTargetValue > GEO_MULTIPOINT_VALUE_ACCESSOR
std::conditional_t< is_cuda_compiler(), DeviceArrayDatum, HostArrayDatum > ArrayDatum
Definition: sqltypes.h:229
#define NULL_ARRAY_DOUBLE
#define CHECK(condition)
Definition: Logger.h:291
boost_variant_accessor< GeoTargetValue > GEO_TARGET_VALUE_ACCESSOR

+ Here is the call graph for this function:

Member Data Documentation

const ColumnDescriptor* GeoMultiPointValueConverter::bounds_column_descriptor_
std::unique_ptr<std::vector<ArrayDatum> > GeoMultiPointValueConverter::bounds_data_

Definition at line 746 of file TargetValueConvertersImpl.h.

Referenced by addDataBlocksToInsertData(), and allocateColumnarData().

boost_variant_accessor<GeoMultiPointTargetValue> GeoMultiPointValueConverter::GEO_MULTIPOINT_VALUE_ACCESSOR

Definition at line 769 of file TargetValueConvertersImpl.h.

Referenced by convertToColumnarFormat().


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