OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
foreign_storage::GeospatialEncoder Class Reference

#include <GeospatialEncoder.h>

+ Inheritance diagram for foreign_storage::GeospatialEncoder:
+ Collaboration diagram for foreign_storage::GeospatialEncoder:

Public Member Functions

virtual ~GeospatialEncoder ()=default
 
 GeospatialEncoder (const bool geo_validate_geometry)
 
 GeospatialEncoder (std::list< Chunk_NS::Chunk > &chunks, const bool geo_validate_geometry)
 
 GeospatialEncoder (std::list< Chunk_NS::Chunk > &chunks, std::list< std::unique_ptr< ChunkMetadata >> &chunk_metadata, const bool geo_validate_geometry)
 

Protected Types

enum  GeoColumnType { COORDS, BOUNDS, RING_OR_LINE_SIZES, POLY_RINGS }
 

Protected Member Functions

void appendBaseDataAndUpdateMetadata (const int64_t row_count)
 
void validateChunksSizing (std::list< Chunk_NS::Chunk > &chunks) const
 
void validateMetadataSizing (std::list< std::unique_ptr< ChunkMetadata >> &chunk_metadata) const
 
void appendArrayDatumsToBufferAndUpdateMetadata ()
 
void appendToArrayEncoderAndUpdateMetadata (const std::vector< ArrayDatum > &datum_parse_buffer, Encoder *encoder, ChunkMetadata *chunk_metadata) const
 
void processGeoElement (std::string_view geo_string_view)
 
void processNullGeoElement ()
 
void clearParseBuffers ()
 
void clearDatumBuffers ()
 
template<typename T >
std::list< T >::iterator getIteratorForGeoColumnType (std::list< T > &list, const SQLTypes column_type, const GeoColumnType geo_column)
 
std::tuple< Encoder
*, ChunkMetadata *, const
ColumnDescriptor * > 
initEncoderAndGetEncoderAndMetadata (std::list< Chunk_NS::Chunk > &chunks, std::list< std::unique_ptr< ChunkMetadata >> &chunk_metadata, const SQLTypes sql_type, GeoColumnType geo_column_type)
 
const ColumnDescriptorgetColumnDescriptor (std::list< Chunk_NS::Chunk > &chunks, const SQLTypes sql_type, GeoColumnType geo_column_type)
 
bool hasBoundsColumn () const
 
bool hasRingOrLineSizesColumn () const
 
bool hasPolyRingsColumn () const
 

Static Protected Member Functions

static void throwMalformedGeoElement (const std::string &omnisci_column_name)
 
static void throwMismatchedGeoElement (const std::string &omnisci_column_name)
 

Protected Attributes

const ColumnDescriptorgeo_column_descriptor_
 
StringNoneEncoderbase_column_encoder_
 
Encodercoords_column_encoder_
 
Encoderbounds_column_encoder_
 
Encoderring_or_line_sizes_column_encoder_
 
Encoderpoly_rings_column_encoder_
 
ChunkMetadatabase_column_metadata_
 
ChunkMetadatacoords_column_metadata_
 
ChunkMetadatabounds_column_metadata_
 
ChunkMetadataring_or_line_sizes_column_metadata_
 
ChunkMetadatapoly_rings_column_metadata_
 
const ColumnDescriptorcoords_column_descriptor_
 
const ColumnDescriptorbounds_column_descriptor_
 
const ColumnDescriptorring_or_line_sizes_column_descriptor_
 
const ColumnDescriptorpoly_rings_column_descriptor_
 
std::vector< std::string > base_values_
 
std::vector< double > coords_parse_buffer_
 
std::vector< double > bounds_parse_buffer_
 
std::vector< int > ring_or_line_sizes_parse_buffer_
 
std::vector< int > poly_rings_parse_buffer_
 
std::vector< ArrayDatumcoords_datum_buffer_
 
std::vector< ArrayDatumbounds_datum_buffer_
 
std::vector< ArrayDatumring_or_line_sizes_datum_buffer_
 
std::vector< ArrayDatumpoly_rings_datum_buffer_
 
bool geo_validate_geometry_
 

Detailed Description

Definition at line 39 of file GeospatialEncoder.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

virtual foreign_storage::GeospatialEncoder::~GeospatialEncoder ( )
virtualdefault
foreign_storage::GeospatialEncoder::GeospatialEncoder ( const bool  geo_validate_geometry)
inline

Definition at line 43 of file GeospatialEncoder.h.

44  : geo_validate_geometry_{geo_validate_geometry} {}
foreign_storage::GeospatialEncoder::GeospatialEncoder ( std::list< Chunk_NS::Chunk > &  chunks,
const bool  geo_validate_geometry 
)
inline

Definition at line 46 of file GeospatialEncoder.h.

47  : geo_column_descriptor_(chunks.begin()->getColumnDesc())
48  , base_column_encoder_(nullptr)
49  , coords_column_encoder_(nullptr)
50  , bounds_column_encoder_(nullptr)
53  , base_column_metadata_(nullptr)
54  , coords_column_metadata_(nullptr)
55  , bounds_column_metadata_(nullptr)
58  , geo_validate_geometry_{geo_validate_geometry} {
60  validateChunksSizing(chunks);
61  const auto geo_column_type = geo_column_descriptor_->columnType.get_type();
62 
63  // initialize coords column
64  coords_column_descriptor_ = getColumnDescriptor(chunks, geo_column_type, COORDS);
65 
66  // initialize bounds column
67  if (hasBoundsColumn()) {
68  bounds_column_descriptor_ = getColumnDescriptor(chunks, geo_column_type, BOUNDS);
69  }
70 
71  // initialize ring sizes column & render group column
74  getColumnDescriptor(chunks, geo_column_type, RING_OR_LINE_SIZES);
75  }
76 
77  // initialize poly rings column
78  if (hasPolyRingsColumn()) {
80  getColumnDescriptor(chunks, geo_column_type, POLY_RINGS);
81  }
82  }
const ColumnDescriptor * poly_rings_column_descriptor_
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:391
void validateChunksSizing(std::list< Chunk_NS::Chunk > &chunks) const
const ColumnDescriptor * getColumnDescriptor(std::list< Chunk_NS::Chunk > &chunks, const SQLTypes sql_type, GeoColumnType geo_column_type)
ChunkMetadata * ring_or_line_sizes_column_metadata_
const ColumnDescriptor * coords_column_descriptor_
#define CHECK(condition)
Definition: Logger.h:291
bool is_geometry() const
Definition: sqltypes.h:597
const ColumnDescriptor * geo_column_descriptor_
const ColumnDescriptor * ring_or_line_sizes_column_descriptor_
SQLTypeInfo columnType
const ColumnDescriptor * bounds_column_descriptor_
foreign_storage::GeospatialEncoder::GeospatialEncoder ( std::list< Chunk_NS::Chunk > &  chunks,
std::list< std::unique_ptr< ChunkMetadata >> &  chunk_metadata,
const bool  geo_validate_geometry 
)
inline

Definition at line 84 of file GeospatialEncoder.h.

87  : geo_column_descriptor_(chunks.begin()->getColumnDesc())
88  , base_column_encoder_(nullptr)
89  , coords_column_encoder_(nullptr)
90  , bounds_column_encoder_(nullptr)
93  , base_column_metadata_(nullptr)
94  , coords_column_metadata_(nullptr)
95  , bounds_column_metadata_(nullptr)
98  , geo_validate_geometry_{geo_validate_geometry} {
100 
101  validateChunksSizing(chunks);
102  validateMetadataSizing(chunk_metadata);
103 
104  const auto geo_column_type = geo_column_descriptor_->columnType.get_type();
105 
106  // initialize base column encoder
107  auto base_chunk = chunks.begin();
108  base_chunk->initEncoder();
110  dynamic_cast<StringNoneEncoder*>(base_chunk->getBuffer()->getEncoder());
111  base_column_metadata_ = chunk_metadata.begin()->get();
113 
114  // initialize coords column
117  chunks, chunk_metadata, geo_column_type, COORDS);
118 
119  // initialize bounds column
120  if (hasBoundsColumn()) {
121  std::tie(
124  chunks, chunk_metadata, geo_column_type, BOUNDS);
125  }
126 
127  // initialize ring sizes column & render group column
128  if (hasRingOrLineSizesColumn()) {
133  chunks, chunk_metadata, geo_column_type, RING_OR_LINE_SIZES);
134  }
135 
136  // initialize poly rings column
137  if (hasPolyRingsColumn()) {
142  chunks, chunk_metadata, geo_column_type, POLY_RINGS);
143  }
144  }
const ColumnDescriptor * poly_rings_column_descriptor_
void validateMetadataSizing(std::list< std::unique_ptr< ChunkMetadata >> &chunk_metadata) const
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:391
void validateChunksSizing(std::list< Chunk_NS::Chunk > &chunks) const
ChunkMetadata * ring_or_line_sizes_column_metadata_
const ColumnDescriptor * coords_column_descriptor_
#define CHECK(condition)
Definition: Logger.h:291
bool is_geometry() const
Definition: sqltypes.h:597
const ColumnDescriptor * geo_column_descriptor_
const ColumnDescriptor * ring_or_line_sizes_column_descriptor_
SQLTypeInfo columnType
std::tuple< Encoder *, ChunkMetadata *, const ColumnDescriptor * > initEncoderAndGetEncoderAndMetadata(std::list< Chunk_NS::Chunk > &chunks, std::list< std::unique_ptr< ChunkMetadata >> &chunk_metadata, const SQLTypes sql_type, GeoColumnType geo_column_type)
const ColumnDescriptor * bounds_column_descriptor_

Member Function Documentation

void foreign_storage::GeospatialEncoder::appendArrayDatumsToBufferAndUpdateMetadata ( )
inlineprotected

Definition at line 164 of file GeospatialEncoder.h.

References appendToArrayEncoderAndUpdateMetadata(), bounds_column_encoder_, bounds_column_metadata_, bounds_datum_buffer_, coords_column_encoder_, coords_column_metadata_, coords_datum_buffer_, poly_rings_column_encoder_, poly_rings_column_metadata_, poly_rings_datum_buffer_, ring_or_line_sizes_column_encoder_, ring_or_line_sizes_column_metadata_, and ring_or_line_sizes_datum_buffer_.

Referenced by foreign_storage::OdbcGeospatialEncoder::appendData(), foreign_storage::ParquetGeospatialEncoder::appendData(), and data_conversion::StringViewToGeoEncoder::encodeAndAppendData().

164  {
175  }
std::vector< ArrayDatum > coords_datum_buffer_
std::vector< ArrayDatum > ring_or_line_sizes_datum_buffer_
std::vector< ArrayDatum > bounds_datum_buffer_
void appendToArrayEncoderAndUpdateMetadata(const std::vector< ArrayDatum > &datum_parse_buffer, Encoder *encoder, ChunkMetadata *chunk_metadata) const
ChunkMetadata * ring_or_line_sizes_column_metadata_
std::vector< ArrayDatum > poly_rings_datum_buffer_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void foreign_storage::GeospatialEncoder::appendBaseDataAndUpdateMetadata ( const int64_t  row_count)
inlineprotected

Definition at line 147 of file GeospatialEncoder.h.

References StringNoneEncoder::appendData(), base_column_encoder_, base_column_metadata_, and base_values_.

Referenced by foreign_storage::OdbcGeospatialEncoder::appendData(), foreign_storage::ParquetGeospatialEncoder::appendData(), and data_conversion::StringViewToGeoEncoder::encodeAndAppendData().

147  {
148  base_values_.resize(row_count);
150  *base_column_encoder_->appendData(&base_values_, 0, row_count);
151  }
std::vector< std::string > base_values_
std::shared_ptr< ChunkMetadata > appendData(int8_t *&src_data, const size_t num_elems_to_append, const SQLTypeInfo &ti, const bool replicating=false, const int64_t offset=-1) override

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void foreign_storage::GeospatialEncoder::appendToArrayEncoderAndUpdateMetadata ( const std::vector< ArrayDatum > &  datum_parse_buffer,
Encoder encoder,
ChunkMetadata chunk_metadata 
) const
inlineprotected

Definition at line 177 of file GeospatialEncoder.h.

References CHECK, and UNREACHABLE.

Referenced by appendArrayDatumsToBufferAndUpdateMetadata().

180  {
181  if (!encoder) {
182  CHECK(!chunk_metadata);
183  return;
184  }
185  if (auto fixed_len_array_encoder =
186  dynamic_cast<FixedLengthArrayNoneEncoder*>(encoder)) {
187  auto new_chunk_metadata = fixed_len_array_encoder->appendData(
188  &datum_parse_buffer, 0, datum_parse_buffer.size());
189  *chunk_metadata = *new_chunk_metadata;
190  } else if (auto array_encoder = dynamic_cast<ArrayNoneEncoder*>(encoder)) {
191  auto new_chunk_metadata = array_encoder->appendData(
192  &datum_parse_buffer, 0, datum_parse_buffer.size(), false);
193  *chunk_metadata = *new_chunk_metadata;
194  } else {
195  UNREACHABLE();
196  }
197  }
#define UNREACHABLE()
Definition: Logger.h:338
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the caller graph for this function:

void foreign_storage::GeospatialEncoder::clearDatumBuffers ( )
inlineprotected

Definition at line 281 of file GeospatialEncoder.h.

References bounds_datum_buffer_, coords_datum_buffer_, poly_rings_datum_buffer_, and ring_or_line_sizes_datum_buffer_.

Referenced by foreign_storage::OdbcGeospatialEncoder::appendData(), foreign_storage::ParquetGeospatialEncoder::appendData(), foreign_storage::ParquetGeospatialImportEncoder::appendData(), and data_conversion::StringViewToGeoEncoder::encodeAndAppendData().

281  {
282  coords_datum_buffer_.clear();
283  bounds_datum_buffer_.clear();
285  poly_rings_datum_buffer_.clear();
286  }
std::vector< ArrayDatum > coords_datum_buffer_
std::vector< ArrayDatum > ring_or_line_sizes_datum_buffer_
std::vector< ArrayDatum > bounds_datum_buffer_
std::vector< ArrayDatum > poly_rings_datum_buffer_

+ Here is the caller graph for this function:

void foreign_storage::GeospatialEncoder::clearParseBuffers ( )
inlineprotected

Definition at line 274 of file GeospatialEncoder.h.

References bounds_parse_buffer_, coords_parse_buffer_, poly_rings_parse_buffer_, and ring_or_line_sizes_parse_buffer_.

Referenced by foreign_storage::OdbcGeospatialEncoder::appendData(), foreign_storage::ParquetGeospatialEncoder::appendData(), foreign_storage::ParquetGeospatialImportEncoder::appendData(), and data_conversion::StringViewToGeoEncoder::encodeAndAppendData().

274  {
275  coords_parse_buffer_.clear();
276  bounds_parse_buffer_.clear();
278  poly_rings_parse_buffer_.clear();
279  }
std::vector< int > ring_or_line_sizes_parse_buffer_
std::vector< double > bounds_parse_buffer_
std::vector< double > coords_parse_buffer_

+ Here is the caller graph for this function:

const ColumnDescriptor* foreign_storage::GeospatialEncoder::getColumnDescriptor ( std::list< Chunk_NS::Chunk > &  chunks,
const SQLTypes  sql_type,
GeoColumnType  geo_column_type 
)
inlineprotected

Definition at line 382 of file GeospatialEncoder.h.

References getIteratorForGeoColumnType().

384  {
385  auto chunk = getIteratorForGeoColumnType(chunks, sql_type, geo_column_type);
386  auto column_descriptor = chunk->getColumnDesc();
387  return column_descriptor;
388  }
std::list< T >::iterator getIteratorForGeoColumnType(std::list< T > &list, const SQLTypes column_type, const GeoColumnType geo_column)

+ Here is the call graph for this function:

template<typename T >
std::list<T>::iterator foreign_storage::GeospatialEncoder::getIteratorForGeoColumnType ( std::list< T > &  list,
const SQLTypes  column_type,
const GeoColumnType  geo_column 
)
inlineprotected

Definition at line 291 of file GeospatialEncoder.h.

References BOUNDS, COORDS, kLINESTRING, kMULTILINESTRING, kMULTIPOINT, kMULTIPOLYGON, kPOINT, kPOLYGON, POLY_RINGS, RING_OR_LINE_SIZES, and UNREACHABLE.

Referenced by foreign_storage::ParquetGeospatialImportEncoder::getBuffer(), getColumnDescriptor(), and initEncoderAndGetEncoderAndMetadata().

294  {
295  auto list_iter = list.begin();
296  list_iter++; // skip base column
297  switch (column_type) {
298  case kPOINT: {
299  if (geo_column == COORDS) {
300  return list_iter;
301  }
302  UNREACHABLE();
303  }
304  case kMULTIPOINT:
305  case kLINESTRING: {
306  if (geo_column == COORDS) {
307  return list_iter;
308  }
309  list_iter++;
310  if (geo_column == BOUNDS) {
311  return list_iter;
312  }
313  UNREACHABLE();
314  }
315  case kMULTILINESTRING: {
316  if (geo_column == COORDS) {
317  return list_iter;
318  }
319  list_iter++;
320  if (geo_column == RING_OR_LINE_SIZES) {
321  return list_iter;
322  }
323  list_iter++;
324  if (geo_column == BOUNDS) {
325  return list_iter;
326  }
327  UNREACHABLE();
328  }
329  case kPOLYGON: {
330  if (geo_column == COORDS) {
331  return list_iter;
332  }
333  list_iter++;
334  if (geo_column == RING_OR_LINE_SIZES) {
335  return list_iter;
336  }
337  list_iter++;
338  if (geo_column == BOUNDS) {
339  return list_iter;
340  }
341  UNREACHABLE();
342  }
343  case kMULTIPOLYGON: {
344  if (geo_column == COORDS) {
345  return list_iter;
346  }
347  list_iter++;
348  if (geo_column == RING_OR_LINE_SIZES) {
349  return list_iter;
350  }
351  list_iter++;
352  if (geo_column == POLY_RINGS) {
353  return list_iter;
354  }
355  list_iter++;
356  if (geo_column == BOUNDS) {
357  return list_iter;
358  }
359  UNREACHABLE();
360  }
361  default:
362  UNREACHABLE();
363  }
364  return {};
365  }
#define UNREACHABLE()
Definition: Logger.h:338

+ Here is the caller graph for this function:

bool foreign_storage::GeospatialEncoder::hasBoundsColumn ( ) const
inlineprotected

Definition at line 403 of file GeospatialEncoder.h.

References ColumnDescriptor::columnType, geo_column_descriptor_, SQLTypeInfo::get_type(), kLINESTRING, kMULTILINESTRING, kMULTIPOINT, kMULTIPOLYGON, and kPOLYGON.

Referenced by foreign_storage::ParquetGeospatialImportEncoder::eraseInvalidIndicesInBuffer(), foreign_storage::ParquetGeospatialImportEncoder::ParquetGeospatialImportEncoder(), processGeoElement(), and processNullGeoElement().

403  {
404  const auto geo_column_type = geo_column_descriptor_->columnType.get_type();
405  return geo_column_type == kMULTIPOINT || geo_column_type == kLINESTRING ||
406  geo_column_type == kMULTILINESTRING || geo_column_type == kPOLYGON ||
407  geo_column_type == kMULTIPOLYGON;
408  }
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:391
const ColumnDescriptor * geo_column_descriptor_
SQLTypeInfo columnType

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool foreign_storage::GeospatialEncoder::hasPolyRingsColumn ( ) const
inlineprotected

Definition at line 416 of file GeospatialEncoder.h.

References ColumnDescriptor::columnType, geo_column_descriptor_, SQLTypeInfo::get_type(), and kMULTIPOLYGON.

Referenced by foreign_storage::ParquetGeospatialImportEncoder::eraseInvalidIndicesInBuffer(), foreign_storage::ParquetGeospatialImportEncoder::ParquetGeospatialImportEncoder(), processGeoElement(), and processNullGeoElement().

416  {
417  const auto geo_column_type = geo_column_descriptor_->columnType.get_type();
418  return geo_column_type == kMULTIPOLYGON;
419  }
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:391
const ColumnDescriptor * geo_column_descriptor_
SQLTypeInfo columnType

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool foreign_storage::GeospatialEncoder::hasRingOrLineSizesColumn ( ) const
inlineprotected

Definition at line 410 of file GeospatialEncoder.h.

References ColumnDescriptor::columnType, geo_column_descriptor_, SQLTypeInfo::get_type(), kMULTILINESTRING, kMULTIPOLYGON, and kPOLYGON.

Referenced by foreign_storage::ParquetGeospatialImportEncoder::eraseInvalidIndicesInBuffer(), foreign_storage::ParquetGeospatialImportEncoder::ParquetGeospatialImportEncoder(), processGeoElement(), and processNullGeoElement().

410  {
411  const auto geo_column_type = geo_column_descriptor_->columnType.get_type();
412  return geo_column_type == kPOLYGON || geo_column_type == kMULTIPOLYGON ||
413  geo_column_type == kMULTILINESTRING;
414  }
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:391
const ColumnDescriptor * geo_column_descriptor_
SQLTypeInfo columnType

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::tuple<Encoder*, ChunkMetadata*, const ColumnDescriptor*> foreign_storage::GeospatialEncoder::initEncoderAndGetEncoderAndMetadata ( std::list< Chunk_NS::Chunk > &  chunks,
std::list< std::unique_ptr< ChunkMetadata >> &  chunk_metadata,
const SQLTypes  sql_type,
GeoColumnType  geo_column_type 
)
inlineprotected

Definition at line 368 of file GeospatialEncoder.h.

References getIteratorForGeoColumnType().

372  {
373  auto chunk = getIteratorForGeoColumnType(chunks, sql_type, geo_column_type);
374  chunk->initEncoder();
375  auto encoder = chunk->getBuffer()->getEncoder();
376  auto metadata =
377  getIteratorForGeoColumnType(chunk_metadata, sql_type, geo_column_type)->get();
378  auto column_descriptor = chunk->getColumnDesc();
379  return {encoder, metadata, column_descriptor};
380  }
std::list< T >::iterator getIteratorForGeoColumnType(std::list< T > &list, const SQLTypes column_type, const GeoColumnType geo_column)

+ Here is the call graph for this function:

void foreign_storage::GeospatialEncoder::processGeoElement ( std::string_view  geo_string_view)
inlineprotected

Definition at line 199 of file GeospatialEncoder.h.

References bounds_datum_buffer_, bounds_parse_buffer_, ColumnDescriptor::columnName, ColumnDescriptor::columnType, Geospatial::compress_coords(), coords_datum_buffer_, coords_parse_buffer_, foreign_storage::encode_as_array_datum(), geo_column_descriptor_, geo_promoted_type_match(), geo_validate_geometry_, SQLTypeInfo::get_type(), Geospatial::GeoTypesFactory::getGeoColumns(), hasBoundsColumn(), hasPolyRingsColumn(), hasRingOrLineSizesColumn(), poly_rings_datum_buffer_, poly_rings_parse_buffer_, ring_or_line_sizes_datum_buffer_, ring_or_line_sizes_parse_buffer_, throwMalformedGeoElement(), and throwMismatchedGeoElement().

Referenced by foreign_storage::OdbcGeospatialEncoder::appendData(), foreign_storage::ParquetGeospatialEncoder::appendData(), foreign_storage::ParquetGeospatialImportEncoder::appendData(), and data_conversion::StringViewToGeoEncoder::encodeAndAppendData().

199  {
201  if (!Geospatial::GeoTypesFactory::getGeoColumns(std::string(geo_string_view),
202  import_ti,
209  }
210 
211  // validate types
212 
213  if (!geo_promoted_type_match(import_ti.get_type(),
216  }
217 
218  // append coords
219  std::vector<uint8_t> compressed_coords = Geospatial::compress_coords(
221  coords_datum_buffer_.emplace_back(encode_as_array_datum(compressed_coords));
222 
223  // append bounds
224  if (hasBoundsColumn()) {
226  }
227 
228  // append ring sizes
229  if (hasRingOrLineSizesColumn()) {
232  }
233 
234  // append poly rings
235  if (hasPolyRingsColumn()) {
236  poly_rings_datum_buffer_.emplace_back(
238  }
239  }
static void throwMismatchedGeoElement(const std::string &omnisci_column_name)
bool geo_promoted_type_match(const SQLTypes a, const SQLTypes b)
Definition: sqltypes.h:2031
std::vector< ArrayDatum > coords_datum_buffer_
std::vector< ArrayDatum > ring_or_line_sizes_datum_buffer_
std::vector< int > ring_or_line_sizes_parse_buffer_
std::vector< ArrayDatum > bounds_datum_buffer_
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:391
static void throwMalformedGeoElement(const std::string &omnisci_column_name)
std::vector< uint8_t > compress_coords(const std::vector< double > &coords, const SQLTypeInfo &ti)
Definition: Compression.cpp:52
static bool getGeoColumns(const std::string &wkt_or_wkb_hex, SQLTypeInfo &ti, std::vector< double > &coords, std::vector< double > &bounds, std::vector< int > &ring_sizes, std::vector< int > &poly_rings, const bool validate_with_geos_if_available)
Definition: Types.cpp:1121
std::vector< double > bounds_parse_buffer_
std::vector< double > coords_parse_buffer_
ArrayDatum encode_as_array_datum(const std::vector< T > &data)
const ColumnDescriptor * geo_column_descriptor_
SQLTypeInfo columnType
std::vector< ArrayDatum > poly_rings_datum_buffer_
std::string columnName

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void foreign_storage::GeospatialEncoder::processNullGeoElement ( )
inlineprotected

Definition at line 241 of file GeospatialEncoder.h.

References bounds_column_descriptor_, bounds_datum_buffer_, bounds_parse_buffer_, ColumnDescriptor::columnType, import_export::ImporterUtils::composeNullArray(), Geospatial::compress_coords(), coords_column_descriptor_, coords_datum_buffer_, coords_parse_buffer_, foreign_storage::encode_as_array_datum(), geo_column_descriptor_, SQLTypeInfo::get_type(), Geospatial::GeoTypesFactory::getNullGeoColumns(), hasBoundsColumn(), hasPolyRingsColumn(), hasRingOrLineSizesColumn(), kPOINT, poly_rings_column_descriptor_, poly_rings_datum_buffer_, poly_rings_parse_buffer_, ring_or_line_sizes_column_descriptor_, ring_or_line_sizes_datum_buffer_, and ring_or_line_sizes_parse_buffer_.

Referenced by foreign_storage::OdbcGeospatialEncoder::appendData(), foreign_storage::ParquetGeospatialEncoder::appendData(), foreign_storage::ParquetGeospatialImportEncoder::appendData(), and data_conversion::StringViewToGeoEncoder::encodeAndAppendData().

241  {
248  // POINT columns are represented using fixed length arrays and need
249  // special treatment of nulls
251  std::vector<uint8_t> compressed_coords = Geospatial::compress_coords(
253  coords_datum_buffer_.emplace_back(encode_as_array_datum(compressed_coords));
254  } else {
257  }
258  if (hasBoundsColumn()) {
261  }
262  if (hasRingOrLineSizesColumn()) {
266  }
267  if (hasPolyRingsColumn()) {
268  poly_rings_datum_buffer_.emplace_back(
271  }
272  }
const ColumnDescriptor * poly_rings_column_descriptor_
std::vector< ArrayDatum > coords_datum_buffer_
static ArrayDatum composeNullArray(const SQLTypeInfo &ti)
Definition: Importer.cpp:395
std::vector< ArrayDatum > ring_or_line_sizes_datum_buffer_
std::vector< int > ring_or_line_sizes_parse_buffer_
static void getNullGeoColumns(SQLTypeInfo &ti, std::vector< double > &coords, std::vector< double > &bounds, std::vector< int > &ring_sizes, std::vector< int > &poly_rings)
Definition: Types.cpp:1342
std::vector< ArrayDatum > bounds_datum_buffer_
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:391
std::vector< uint8_t > compress_coords(const std::vector< double > &coords, const SQLTypeInfo &ti)
Definition: Compression.cpp:52
const ColumnDescriptor * coords_column_descriptor_
std::vector< double > bounds_parse_buffer_
std::vector< double > coords_parse_buffer_
ArrayDatum encode_as_array_datum(const std::vector< T > &data)
const ColumnDescriptor * geo_column_descriptor_
const ColumnDescriptor * ring_or_line_sizes_column_descriptor_
SQLTypeInfo columnType
std::vector< ArrayDatum > poly_rings_datum_buffer_
const ColumnDescriptor * bounds_column_descriptor_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void foreign_storage::GeospatialEncoder::throwMalformedGeoElement ( const std::string &  omnisci_column_name)
inlinestaticprotected

Definition at line 390 of file GeospatialEncoder.h.

Referenced by processGeoElement().

390  {
391  std::string error_message = "Failed to extract valid geometry in HeavyDB column '" +
392  omnisci_column_name + "'.";
393  throw foreign_storage::ForeignStorageException(error_message);
394  }

+ Here is the caller graph for this function:

static void foreign_storage::GeospatialEncoder::throwMismatchedGeoElement ( const std::string &  omnisci_column_name)
inlinestaticprotected

Definition at line 396 of file GeospatialEncoder.h.

Referenced by processGeoElement().

396  {
398  "Imported geometry"
399  " doesn't match the geospatial type of HeavyDB column '" +
400  omnisci_column_name + "'.");
401  }

+ Here is the caller graph for this function:

void foreign_storage::GeospatialEncoder::validateChunksSizing ( std::list< Chunk_NS::Chunk > &  chunks) const
inlineprotected

Definition at line 153 of file GeospatialEncoder.h.

References CHECK_EQ, ColumnDescriptor::columnType, geo_column_descriptor_, and SQLTypeInfo::get_physical_cols().

153  {
154  size_t expected_size = geo_column_descriptor_->columnType.get_physical_cols() + 1;
155  CHECK_EQ(chunks.size(), expected_size);
156  }
#define CHECK_EQ(x, y)
Definition: Logger.h:301
int get_physical_cols() const
Definition: sqltypes.h:432
const ColumnDescriptor * geo_column_descriptor_
SQLTypeInfo columnType

+ Here is the call graph for this function:

void foreign_storage::GeospatialEncoder::validateMetadataSizing ( std::list< std::unique_ptr< ChunkMetadata >> &  chunk_metadata) const
inlineprotected

Definition at line 158 of file GeospatialEncoder.h.

References CHECK_EQ, ColumnDescriptor::columnType, geo_column_descriptor_, and SQLTypeInfo::get_physical_cols().

159  {
160  size_t expected_size = geo_column_descriptor_->columnType.get_physical_cols() + 1;
161  CHECK_EQ(chunk_metadata.size(), expected_size);
162  }
#define CHECK_EQ(x, y)
Definition: Logger.h:301
int get_physical_cols() const
Definition: sqltypes.h:432
const ColumnDescriptor * geo_column_descriptor_
SQLTypeInfo columnType

+ Here is the call graph for this function:

Member Data Documentation

StringNoneEncoder* foreign_storage::GeospatialEncoder::base_column_encoder_
protected

Definition at line 423 of file GeospatialEncoder.h.

Referenced by appendBaseDataAndUpdateMetadata().

ChunkMetadata* foreign_storage::GeospatialEncoder::base_column_metadata_
protected

Definition at line 429 of file GeospatialEncoder.h.

Referenced by appendBaseDataAndUpdateMetadata().

std::vector<std::string> foreign_storage::GeospatialEncoder::base_values_
protected

Definition at line 440 of file GeospatialEncoder.h.

Referenced by appendBaseDataAndUpdateMetadata().

const ColumnDescriptor* foreign_storage::GeospatialEncoder::bounds_column_descriptor_
protected

Definition at line 436 of file GeospatialEncoder.h.

Referenced by processNullGeoElement().

Encoder* foreign_storage::GeospatialEncoder::bounds_column_encoder_
protected

Definition at line 425 of file GeospatialEncoder.h.

Referenced by appendArrayDatumsToBufferAndUpdateMetadata().

ChunkMetadata* foreign_storage::GeospatialEncoder::bounds_column_metadata_
protected

Definition at line 431 of file GeospatialEncoder.h.

Referenced by appendArrayDatumsToBufferAndUpdateMetadata().

std::vector<double> foreign_storage::GeospatialEncoder::bounds_parse_buffer_
protected
const ColumnDescriptor* foreign_storage::GeospatialEncoder::coords_column_descriptor_
protected

Definition at line 435 of file GeospatialEncoder.h.

Referenced by processNullGeoElement().

Encoder* foreign_storage::GeospatialEncoder::coords_column_encoder_
protected

Definition at line 424 of file GeospatialEncoder.h.

Referenced by appendArrayDatumsToBufferAndUpdateMetadata().

ChunkMetadata* foreign_storage::GeospatialEncoder::coords_column_metadata_
protected

Definition at line 430 of file GeospatialEncoder.h.

Referenced by appendArrayDatumsToBufferAndUpdateMetadata().

std::vector<double> foreign_storage::GeospatialEncoder::coords_parse_buffer_
protected
bool foreign_storage::GeospatialEncoder::geo_validate_geometry_
protected

Definition at line 456 of file GeospatialEncoder.h.

Referenced by processGeoElement().

const ColumnDescriptor* foreign_storage::GeospatialEncoder::poly_rings_column_descriptor_
protected

Definition at line 438 of file GeospatialEncoder.h.

Referenced by processNullGeoElement().

Encoder* foreign_storage::GeospatialEncoder::poly_rings_column_encoder_
protected

Definition at line 427 of file GeospatialEncoder.h.

Referenced by appendArrayDatumsToBufferAndUpdateMetadata().

ChunkMetadata* foreign_storage::GeospatialEncoder::poly_rings_column_metadata_
protected

Definition at line 433 of file GeospatialEncoder.h.

Referenced by appendArrayDatumsToBufferAndUpdateMetadata().

std::vector<ArrayDatum> foreign_storage::GeospatialEncoder::poly_rings_datum_buffer_
protected
std::vector<int> foreign_storage::GeospatialEncoder::poly_rings_parse_buffer_
protected
const ColumnDescriptor* foreign_storage::GeospatialEncoder::ring_or_line_sizes_column_descriptor_
protected

Definition at line 437 of file GeospatialEncoder.h.

Referenced by processNullGeoElement().

Encoder* foreign_storage::GeospatialEncoder::ring_or_line_sizes_column_encoder_
protected

Definition at line 426 of file GeospatialEncoder.h.

Referenced by appendArrayDatumsToBufferAndUpdateMetadata().

ChunkMetadata* foreign_storage::GeospatialEncoder::ring_or_line_sizes_column_metadata_
protected

Definition at line 432 of file GeospatialEncoder.h.

Referenced by appendArrayDatumsToBufferAndUpdateMetadata().

std::vector<ArrayDatum> foreign_storage::GeospatialEncoder::ring_or_line_sizes_datum_buffer_
protected
std::vector<int> foreign_storage::GeospatialEncoder::ring_or_line_sizes_parse_buffer_
protected

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