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

#include <TargetValueConvertersImpl.h>

+ Inheritance diagram for GeoPolygonValueConverter:
+ Collaboration diagram for GeoPolygonValueConverter:

Public Member Functions

 GeoPolygonValueConverter (const Catalog_Namespace::Catalog &cat, size_t num_rows, const ColumnDescriptor *logicalColumnDescriptor)
 
 ~GeoPolygonValueConverter () 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 ColumnDescriptorring_sizes_column_descriptor_
 
const ColumnDescriptorbounds_column_descriptor_
 
std::unique_ptr< std::vector
< ArrayDatum > > 
ring_sizes_data_
 
std::unique_ptr< std::vector
< ArrayDatum > > 
bounds_data_
 
boost_variant_accessor
< GeoPolyTargetValue
GEO_POLY_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 953 of file TargetValueConvertersImpl.h.

Constructor & Destructor Documentation

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

Definition at line 960 of file TargetValueConvertersImpl.h.

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

963  : GeoPointValueConverter(cat, num_rows, logicalColumnDescriptor) {
970 
971  if (num_rows) {
972  allocateColumnarData(num_rows);
973  }
974  }
const ColumnDescriptor * bounds_column_descriptor_
const ColumnDescriptor * column_descriptor_
GeoPointValueConverter(const Catalog_Namespace::Catalog &cat, size_t num_rows, const ColumnDescriptor *logicalColumnDescriptor)
const ColumnDescriptor * ring_sizes_column_descriptor_
const ColumnDescriptor * getMetadataForColumn(int tableId, const std::string &colName) const
void allocateColumnarData(size_t num_rows) override
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call graph for this function:

GeoPolygonValueConverter::~GeoPolygonValueConverter ( )
inlineoverride

Definition at line 976 of file TargetValueConvertersImpl.h.

976 {}

Member Function Documentation

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

Reimplemented from GeoPointValueConverter.

Definition at line 1013 of file TargetValueConvertersImpl.h.

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

1013  {
1015 
1016  DataBlockPtr ringSizes, bounds;
1017 
1018  ringSizes.arraysPtr = ring_sizes_data_.get();
1019  bounds.arraysPtr = bounds_data_.get();
1020 
1021  insertData.data.emplace_back(ringSizes);
1022  insertData.columnIds.emplace_back(ring_sizes_column_descriptor_->columnId);
1023 
1024  insertData.data.emplace_back(bounds);
1025  insertData.columnIds.emplace_back(bounds_column_descriptor_->columnId);
1026  }
std::vector< ArrayDatum > * arraysPtr
Definition: sqltypes.h:235
const ColumnDescriptor * bounds_column_descriptor_
std::unique_ptr< std::vector< ArrayDatum > > bounds_data_
const ColumnDescriptor * ring_sizes_column_descriptor_
std::unique_ptr< std::vector< ArrayDatum > > ring_sizes_data_
std::vector< DataBlockPtr > data
the number of rows being inserted
Definition: Fragmenter.h:73
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 GeoPolygonValueConverter::allocateColumnarData ( size_t  num_rows)
inlineoverridevirtual

Reimplemented from GeoPointValueConverter.

Definition at line 978 of file TargetValueConvertersImpl.h.

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

Referenced by GeoPolygonValueConverter().

978  {
980  ring_sizes_data_ = std::make_unique<std::vector<ArrayDatum>>(num_rows);
981  bounds_data_ = std::make_unique<std::vector<ArrayDatum>>(num_rows);
982  }
void allocateColumnarData(size_t num_rows) override
std::unique_ptr< std::vector< ArrayDatum > > bounds_data_
std::unique_ptr< std::vector< ArrayDatum > > ring_sizes_data_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Reimplemented from GeoPointValueConverter.

Definition at line 986 of file TargetValueConvertersImpl.h.

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

986  {
987  const auto geoValue =
988  checked_get<GeoTargetValue>(row, value, GEO_TARGET_VALUE_ACCESSOR);
989  CHECK(geoValue);
990  if (geoValue->is_initialized()) {
991  const auto geo = geoValue->get();
992  const auto geoPoly =
993  checked_get<GeoPolyTargetValue>(row, &geo, GEO_POLY_VALUE_ACCESSOR);
994 
995  (*column_data_)[row] = "";
996  (*signed_compressed_coords_data_)[row] = toCompressedCoords(geoPoly->coords);
997  (*ring_sizes_data_)[row] = to_array_datum(geoPoly->ring_sizes);
998  auto bounds = compute_bounds_of_coords(geoPoly->coords);
999  (*bounds_data_)[row] = to_array_datum(bounds);
1000  } else {
1001  // NULL Polygon
1002  (*column_data_)[row] = "";
1003  (*signed_compressed_coords_data_)[row] = ArrayDatum(0, nullptr, true);
1004  (*ring_sizes_data_)[row] = ArrayDatum(0, nullptr, true);
1005  std::vector<double> bounds = {
1006  NULL_ARRAY_DOUBLE, NULL_DOUBLE, NULL_DOUBLE, NULL_DOUBLE};
1007  auto bounds_datum = to_array_datum(bounds);
1008  bounds_datum.is_null = true;
1009  (*bounds_data_)[row] = bounds_datum;
1010  }
1011  }
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)
std::conditional_t< is_cuda_compiler(), DeviceArrayDatum, HostArrayDatum > ArrayDatum
Definition: sqltypes.h:229
boost_variant_accessor< GeoPolyTargetValue > GEO_POLY_VALUE_ACCESSOR
#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* GeoPolygonValueConverter::bounds_column_descriptor_
std::unique_ptr<std::vector<ArrayDatum> > GeoPolygonValueConverter::bounds_data_

Definition at line 958 of file TargetValueConvertersImpl.h.

Referenced by addDataBlocksToInsertData(), and allocateColumnarData().

boost_variant_accessor<GeoPolyTargetValue> GeoPolygonValueConverter::GEO_POLY_VALUE_ACCESSOR

Definition at line 984 of file TargetValueConvertersImpl.h.

Referenced by convertToColumnarFormat().

const ColumnDescriptor* GeoPolygonValueConverter::ring_sizes_column_descriptor_
std::unique_ptr<std::vector<ArrayDatum> > GeoPolygonValueConverter::ring_sizes_data_

Definition at line 957 of file TargetValueConvertersImpl.h.

Referenced by addDataBlocksToInsertData(), and allocateColumnarData().


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