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

#include <TargetValueConvertersImpl.h>

+ Inheritance diagram for GeoLinestringValueConverter:
+ Collaboration diagram for GeoLinestringValueConverter:

Public Member Functions

 GeoLinestringValueConverter (const Catalog_Namespace::Catalog &cat, size_t num_rows, const ColumnDescriptor *logicalColumnDescriptor)
 
 ~GeoLinestringValueConverter () 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
< GeoLineStringTargetValue
GEO_LINESTRING_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 808 of file TargetValueConvertersImpl.h.

Constructor & Destructor Documentation

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

Definition at line 813 of file TargetValueConvertersImpl.h.

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

816  : GeoPointValueConverter(cat, num_rows, logicalColumnDescriptor) {
820 
821  if (num_rows) {
822  allocateColumnarData(num_rows);
823  }
824  }
const ColumnDescriptor * column_descriptor_
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
const ColumnDescriptor * bounds_column_descriptor_
void allocateColumnarData(size_t num_rows) override

+ Here is the call graph for this function:

GeoLinestringValueConverter::~GeoLinestringValueConverter ( )
inlineoverride

Definition at line 826 of file TargetValueConvertersImpl.h.

826 {}

Member Function Documentation

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

Reimplemented from GeoPointValueConverter.

Definition at line 861 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.

861  {
863 
864  DataBlockPtr bounds;
865 
866  bounds.arraysPtr = bounds_data_.get();
867 
868  insertData.data.emplace_back(bounds);
869  insertData.columnIds.emplace_back(bounds_column_descriptor_->columnId);
870  }
std::unique_ptr< std::vector< ArrayDatum > > bounds_data_
std::vector< ArrayDatum > * arraysPtr
Definition: sqltypes.h:235
std::vector< DataBlockPtr > data
the number of rows being inserted
Definition: Fragmenter.h:73
void addDataBlocksToInsertData(Fragmenter_Namespace::InsertData &insertData) override
const ColumnDescriptor * bounds_column_descriptor_
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 GeoLinestringValueConverter::allocateColumnarData ( size_t  num_rows)
inlineoverridevirtual

Reimplemented from GeoPointValueConverter.

Definition at line 828 of file TargetValueConvertersImpl.h.

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

Referenced by GeoLinestringValueConverter().

828  {
829  CHECK(num_rows > 0);
831  bounds_data_ = std::make_unique<std::vector<ArrayDatum>>(num_rows);
832  }
std::unique_ptr< std::vector< ArrayDatum > > bounds_data_
void allocateColumnarData(size_t num_rows) override
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Reimplemented from GeoPointValueConverter.

Definition at line 836 of file TargetValueConvertersImpl.h.

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

836  {
837  const auto geoValue =
838  checked_get<GeoTargetValue>(row, value, GEO_TARGET_VALUE_ACCESSOR);
839  CHECK(geoValue);
840  if (geoValue->is_initialized()) {
841  const auto geo = geoValue->get();
842  const auto geoLinestring =
843  checked_get<GeoLineStringTargetValue>(row, &geo, GEO_LINESTRING_VALUE_ACCESSOR);
844 
845  (*column_data_)[row] = "";
846  (*signed_compressed_coords_data_)[row] = toCompressedCoords(geoLinestring->coords);
847  auto bounds = compute_bounds_of_coords(geoLinestring->coords);
848  (*bounds_data_)[row] = to_array_datum(bounds);
849  } else {
850  // NULL Linestring
851  (*column_data_)[row] = "";
852  (*signed_compressed_coords_data_)[row] = ArrayDatum(0, nullptr, true);
853  std::vector<double> bounds = {
854  NULL_ARRAY_DOUBLE, NULL_DOUBLE, NULL_DOUBLE, NULL_DOUBLE};
855  auto bounds_datum = to_array_datum(bounds);
856  bounds_datum.is_null = true;
857  (*bounds_data_)[row] = bounds_datum;
858  }
859  }
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< GeoLineStringTargetValue > GEO_LINESTRING_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* GeoLinestringValueConverter::bounds_column_descriptor_
std::unique_ptr<std::vector<ArrayDatum> > GeoLinestringValueConverter::bounds_data_

Definition at line 811 of file TargetValueConvertersImpl.h.

Referenced by addDataBlocksToInsertData(), and allocateColumnarData().

boost_variant_accessor<GeoLineStringTargetValue> GeoLinestringValueConverter::GEO_LINESTRING_VALUE_ACCESSOR

Definition at line 834 of file TargetValueConvertersImpl.h.

Referenced by convertToColumnarFormat().


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