OmniSciDB  1dac507f6e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
< 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 533 of file TargetValueConvertersImpl.h.

Constructor & Destructor Documentation

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

Definition at line 539 of file TargetValueConvertersImpl.h.

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

542  : TargetValueConverter(logicalColumnDescriptor) {
546 
547  if (num_rows) {
549  }
550  }
const int8_t const int64_t * num_rows
TargetValueConverter(const ColumnDescriptor *cd)
void allocateColumnarData(size_t num_rows) override
const ColumnDescriptor * column_descriptor_
CHECK(cgen_state)
const ColumnDescriptor * getMetadataForColumn(int tableId, const std::string &colName) const
const ColumnDescriptor * coords_column_descriptor_

+ Here is the call graph for this function:

GeoPointValueConverter::~GeoPointValueConverter ( )
inlineoverride

Definition at line 552 of file TargetValueConvertersImpl.h.

552 {}

Member Function Documentation

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

Implements TargetValueConverter.

Reimplemented in GeoMultiPolygonValueConverter, GeoPolygonValueConverter, and GeoLinestringValueConverter.

Definition at line 587 of file TargetValueConvertersImpl.h.

References DataBlockPtr::arraysPtr, column_data_, TargetValueConverter::column_descriptor_, ColumnDescriptor::columnId, Fragmenter_Namespace::InsertData::columnIds, coords_column_descriptor_, Fragmenter_Namespace::InsertData::data, signed_compressed_coords_data_, and DataBlockPtr::stringsPtr.

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

587  {
588  DataBlockPtr logical, coords;
589 
590  logical.stringsPtr = column_data_.get();
592 
593  insertData.data.emplace_back(logical);
594  insertData.columnIds.emplace_back(column_descriptor_->columnId);
595 
596  insertData.data.emplace_back(coords);
597  insertData.columnIds.emplace_back(coords_column_descriptor_->columnId);
598  }
std::vector< std::string > * stringsPtr
Definition: sqltypes.h:141
std::vector< ArrayDatum > * arraysPtr
Definition: sqltypes.h:142
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:

void GeoPointValueConverter::allocateColumnarData ( size_t  num_rows)
inlineoverridevirtual

Implements TargetValueConverter.

Reimplemented in GeoMultiPolygonValueConverter, GeoPolygonValueConverter, and GeoLinestringValueConverter.

Definition at line 554 of file TargetValueConvertersImpl.h.

References CHECK(), column_data_, num_rows, and signed_compressed_coords_data_.

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

554  {
555  CHECK(num_rows > 0);
556  column_data_ = std::make_unique<std::vector<std::string>>(num_rows);
557  signed_compressed_coords_data_ = std::make_unique<std::vector<ArrayDatum>>(num_rows);
558  }
const int8_t const int64_t * num_rows
std::unique_ptr< std::vector< std::string > > column_data_
CHECK(cgen_state)
std::unique_ptr< std::vector< ArrayDatum > > signed_compressed_coords_data_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Implements TargetValueConverter.

Reimplemented in GeoMultiPolygonValueConverter, GeoPolygonValueConverter, and GeoLinestringValueConverter.

Definition at line 578 of file TargetValueConvertersImpl.h.

References GEO_POINT_VALUE_ACCESSOR, TargetValueConverter::GEO_TARGET_VALUE_ACCESSOR, and toCompressedCoords().

578  {
579  auto geoValue = checked_get<GeoTargetValue>(row, value, GEO_TARGET_VALUE_ACCESSOR);
580  auto geoPoint =
581  checked_get<GeoPointTargetValue>(row, geoValue, GEO_POINT_VALUE_ACCESSOR);
582 
583  (*column_data_)[row] = "";
584  (*signed_compressed_coords_data_)[row] = toCompressedCoords(geoPoint->coords);
585  }
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

+ Here is the call graph for this function:

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

Definition at line 562 of file TargetValueConvertersImpl.h.

References checked_malloc(), TargetValueConverter::column_descriptor_, ColumnDescriptor::columnType, and Importer_NS::compress_coords().

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

563  {
564  const auto compressed_coords_vector =
566 
567  uint8_t* compressed_coords_array = reinterpret_cast<uint8_t*>(
568  checked_malloc(sizeof(uint8_t) * compressed_coords_vector.size()));
569  memcpy(compressed_coords_array,
570  &compressed_coords_vector[0],
571  compressed_coords_vector.size());
572 
573  return ArrayDatum((int)compressed_coords_vector.size(),
574  reinterpret_cast<int8_t*>(compressed_coords_array),
575  false);
576  }
std::vector< uint8_t > compress_coords(std::vector< double > &coords, const SQLTypeInfo &ti)
Definition: Importer.cpp:1422
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:122

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

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

Definition at line 536 of file TargetValueConvertersImpl.h.

Referenced by addDataBlocksToInsertData(), and allocateColumnarData().

const ColumnDescriptor* GeoPointValueConverter::coords_column_descriptor_
boost_variant_accessor<GeoPointTargetValue> GeoPointValueConverter::GEO_POINT_VALUE_ACCESSOR

Definition at line 560 of file TargetValueConvertersImpl.h.

Referenced by convertToColumnarFormat().

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

Definition at line 537 of file TargetValueConvertersImpl.h.

Referenced by addDataBlocksToInsertData(), and allocateColumnarData().


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