OmniSciDB  c07336695a
GeoPointValueConverter Struct Reference

#include <TargetValueConvertersImpl.h>

+ Inheritance diagram for GeoPointValueConverter:
+ Collaboration diagram for GeoPointValueConverter:

Public Member Functions

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

Public Attributes

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< GeoPointTargetValueGEO_POINT_VALUE_ACCESSOR
 
- Public Attributes inherited from TargetValueConverter
const ColumnDescriptorcolumn_descriptor_
 
boost_variant_accessor< ScalarTargetValueSCALAR_TARGET_VALUE_ACCESSOR
 
boost_variant_accessor< ArrayTargetValueARRAY_TARGET_VALUE_ACCESSOR
 
boost_variant_accessor< GeoTargetValueGEO_TARGET_VALUE_ACCESSOR
 
boost_variant_accessor< NullableStringNULLABLE_STRING_ACCESSOR
 
boost_variant_accessor< std::string > STRING_ACCESSOR
 

Detailed Description

Definition at line 504 of file TargetValueConvertersImpl.h.

Constructor & Destructor Documentation

◆ GeoPointValueConverter()

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

Definition at line 510 of file TargetValueConvertersImpl.h.

References CHECK, and Catalog_Namespace::Catalog::getMetadataForColumn().

513  : TargetValueConverter(logicalColumnDescriptor) {
517 
518  if (num_rows) {
520  }
521  }
const int8_t const int64_t * num_rows
TargetValueConverter(const ColumnDescriptor *cd)
void allocateColumnarData(size_t num_rows) override
const ColumnDescriptor * column_descriptor_
const ColumnDescriptor * getMetadataForColumn(int tableId, const std::string &colName) const
const ColumnDescriptor * coords_column_descriptor_
#define CHECK(condition)
Definition: Logger.h:187
+ Here is the call graph for this function:

◆ ~GeoPointValueConverter()

GeoPointValueConverter::~GeoPointValueConverter ( )
inlineoverride

Definition at line 523 of file TargetValueConvertersImpl.h.

523 {}

Member Function Documentation

◆ addDataBlocksToInsertData()

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

Implements TargetValueConverter.

Reimplemented in GeoMultiPolygonValueConverter, GeoPolygonValueConverter, and GeoLinestringValueConverter.

Definition at line 558 of file TargetValueConvertersImpl.h.

References DataBlockPtr::arraysPtr, ColumnDescriptor::columnId, Fragmenter_Namespace::InsertData::columnIds, Fragmenter_Namespace::InsertData::data, and DataBlockPtr::stringsPtr.

Referenced by GeoLinestringValueConverter::addDataBlocksToInsertData(), GeoPolygonValueConverter::addDataBlocksToInsertData(), and GeoMultiPolygonValueConverter::addDataBlocksToInsertData().

558  {
559  DataBlockPtr logical, coords;
560 
561  logical.stringsPtr = column_data_.get();
563 
564  insertData.data.emplace_back(logical);
565  insertData.columnIds.emplace_back(column_descriptor_->columnId);
566 
567  insertData.data.emplace_back(coords);
568  insertData.columnIds.emplace_back(coords_column_descriptor_->columnId);
569  }
std::vector< std::string > * stringsPtr
Definition: sqltypes.h:138
std::vector< ArrayDatum > * arraysPtr
Definition: sqltypes.h:139
const ColumnDescriptor * column_descriptor_
std::unique_ptr< std::vector< std::string > > column_data_
std::vector< DataBlockPtr > data
the number of rows being inserted
Definition: Fragmenter.h:64
const ColumnDescriptor * coords_column_descriptor_
std::vector< int > columnIds
identifies the table into which the data is being inserted
Definition: Fragmenter.h:62
std::unique_ptr< std::vector< ArrayDatum > > signed_compressed_coords_data_
+ Here is the caller graph for this function:

◆ allocateColumnarData()

void GeoPointValueConverter::allocateColumnarData ( size_t  num_rows)
inlineoverridevirtual

Implements TargetValueConverter.

Reimplemented in GeoMultiPolygonValueConverter, GeoPolygonValueConverter, and GeoLinestringValueConverter.

Definition at line 525 of file TargetValueConvertersImpl.h.

References CHECK, and num_rows.

Referenced by GeoLinestringValueConverter::allocateColumnarData(), GeoPolygonValueConverter::allocateColumnarData(), and GeoMultiPolygonValueConverter::allocateColumnarData().

525  {
526  CHECK(num_rows > 0);
527  column_data_ = std::make_unique<std::vector<std::string>>(num_rows);
528  signed_compressed_coords_data_ = std::make_unique<std::vector<ArrayDatum>>(num_rows);
529  }
const int8_t const int64_t * num_rows
std::unique_ptr< std::vector< std::string > > column_data_
#define CHECK(condition)
Definition: Logger.h:187
std::unique_ptr< std::vector< ArrayDatum > > signed_compressed_coords_data_
+ Here is the caller graph for this function:

◆ convertToColumnarFormat()

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

Implements TargetValueConverter.

Reimplemented in GeoMultiPolygonValueConverter, GeoPolygonValueConverter, and GeoLinestringValueConverter.

Definition at line 549 of file TargetValueConvertersImpl.h.

549  {
550  auto geoValue = checked_get<GeoTargetValue>(row, value, GEO_TARGET_VALUE_ACCESSOR);
551  auto geoPoint =
552  checked_get<GeoPointTargetValue>(row, geoValue, GEO_POINT_VALUE_ACCESSOR);
553 
554  (*column_data_)[row] = "";
555  (*signed_compressed_coords_data_)[row] = toCompressedCoords(geoPoint->coords);
556  }
ArrayDatum toCompressedCoords(const std::shared_ptr< std::vector< double >> &coords)
boost_variant_accessor< GeoTargetValue > GEO_TARGET_VALUE_ACCESSOR
boost_variant_accessor< GeoPointTargetValue > GEO_POINT_VALUE_ACCESSOR

◆ toCompressedCoords()

ArrayDatum GeoPointValueConverter::toCompressedCoords ( const std::shared_ptr< std::vector< double >> &  coords)
inline

Definition at line 533 of file TargetValueConvertersImpl.h.

References checked_malloc(), and Importer_NS::compress_coords().

534  {
535  const auto compressed_coords_vector =
537 
538  uint8_t* compressed_coords_array = reinterpret_cast<uint8_t*>(
539  checked_malloc(sizeof(uint8_t) * compressed_coords_vector.size()));
540  memcpy(compressed_coords_array,
541  &compressed_coords_vector[0],
542  compressed_coords_vector.size());
543 
544  return ArrayDatum((int)compressed_coords_vector.size(),
545  reinterpret_cast<int8_t*>(compressed_coords_array),
546  false);
547  }
std::vector< uint8_t > compress_coords(std::vector< double > &coords, const SQLTypeInfo &ti)
Definition: Importer.cpp:1546
const ColumnDescriptor * column_descriptor_
void * checked_malloc(const size_t size)
Definition: checked_alloc.h:40
SQLTypeInfo columnType
std::conditional_t< isCudaCC(), DeviceArrayDatum, HostArrayDatum > ArrayDatum
Definition: sqltypes.h:119
+ Here is the call graph for this function:

Member Data Documentation

◆ column_data_

std::unique_ptr<std::vector<std::string> > GeoPointValueConverter::column_data_

Definition at line 507 of file TargetValueConvertersImpl.h.

◆ coords_column_descriptor_

const ColumnDescriptor* GeoPointValueConverter::coords_column_descriptor_

Definition at line 505 of file TargetValueConvertersImpl.h.

◆ GEO_POINT_VALUE_ACCESSOR

boost_variant_accessor<GeoPointTargetValue> GeoPointValueConverter::GEO_POINT_VALUE_ACCESSOR

Definition at line 531 of file TargetValueConvertersImpl.h.

◆ signed_compressed_coords_data_

std::unique_ptr<std::vector<ArrayDatum> > GeoPointValueConverter::signed_compressed_coords_data_

Definition at line 508 of file TargetValueConvertersImpl.h.


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