OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TargetValueConvertersImpl.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef TARGET_VALUE_CONVERTERS_IMPL_H_
18 #define TARGET_VALUE_CONVERTERS_IMPL_H_
19 
21 #include "Geospatial/Compression.h"
22 #include "Shared/checked_alloc.h"
24 
25 #include <atomic>
26 #include <future>
27 #include <thread>
28 
29 template <typename T>
31  if (std::is_floating_point<T>::value) {
32  return static_cast<T>(inline_fp_null_array_value<T>());
33  } else {
34  return static_cast<T>(inline_int_null_array_value<T>());
35  }
36 }
37 
38 template <typename SOURCE_TYPE, typename RETURN_TYPE, typename CHECKED_CAST_TYPE>
39 RETURN_TYPE checked_cast(SOURCE_TYPE val, bool check_null, RETURN_TYPE null_value) {
40  if (!std::is_same<SOURCE_TYPE, CHECKED_CAST_TYPE>::value) {
41  // do an overflow check
42  try {
43  CHECKED_CAST_TYPE castedVal = boost::numeric_cast<CHECKED_CAST_TYPE>(val);
44  if (check_null && castedVal == null_value) {
45  throw std::runtime_error("Overflow or underflow");
46  }
47  } catch (...) {
48  throw std::runtime_error("Overflow or underflow");
49  }
50  }
51 
52  return static_cast<RETURN_TYPE>(val);
53 }
54 
55 template <typename SOURCE_TYPE, typename TARGET_TYPE>
57  using ColumnDataPtr = std::unique_ptr<TARGET_TYPE, CheckedMallocDeleter<TARGET_TYPE>>;
59  using CasterFunc = std::function<TARGET_TYPE(SOURCE_TYPE, bool, TARGET_TYPE)>;
60 
62  TARGET_TYPE null_value_;
63  SOURCE_TYPE null_check_value_;
67 
69 
71  size_t num_rows,
72  TARGET_TYPE nullValue,
73  SOURCE_TYPE nullCheckValue,
74  bool doNullCheck)
76  , null_value_(nullValue)
77  , null_check_value_(nullCheckValue)
78  , do_null_check_(doNullCheck) {
79  fixed_array_null_value_ = get_fixed_array_null_value<TARGET_TYPE>();
80  if (num_rows) {
81  allocateColumnarData(num_rows);
82  }
83  }
84 
85  ~NumericValueConverter() override {}
86 
87  void setValueCaster(CasterFunc caster) { checked_caster_ = caster; }
88 
89  void populateFixedArrayNullSentinel(size_t num_rows) {
90  allocateColumnarData(num_rows);
93  }
94 
95  void allocateColumnarData(size_t num_rows) override {
96  CHECK(num_rows > 0);
98  reinterpret_cast<TARGET_TYPE*>(checked_malloc(num_rows * sizeof(TARGET_TYPE))));
99  }
100 
102  CHECK(num_rows > 0);
104  reinterpret_cast<TARGET_TYPE*>(checked_malloc(num_rows * sizeof(TARGET_TYPE))));
105  }
106 
108  size_t row,
109  typename ElementsBufferColumnPtr::pointer columnData,
110  const ScalarTargetValue* scalarValue) {
111  auto db_p = checked_get<SOURCE_TYPE>(row, scalarValue, SOURCE_TYPE_ACCESSOR);
112  auto val = *db_p;
113 
114  if (do_null_check_ && null_check_value_ == val) {
115  columnData[row] = null_value_;
116  } else {
117  if (checked_caster_) {
118  columnData[row] = checked_caster_(val, do_null_check_, null_value_);
119  } else {
120  columnData[row] = static_cast<TARGET_TYPE>(val);
121  }
122  }
123  }
124 
125  void convertToColumnarFormat(size_t row, const ScalarTargetValue* scalarValue) {
126  convertElementToColumnarFormat(row, column_data_.get(), scalarValue);
127  }
128 
129  void convertToColumnarFormat(size_t row, const TargetValue* value) override {
130  auto scalarValue =
131  checked_get<ScalarTargetValue>(row, value, SCALAR_TARGET_VALUE_ACCESSOR);
132  convertToColumnarFormat(row, scalarValue);
133  }
134 
136  std::unique_ptr<std::vector<std::pair<size_t, ElementsBufferColumnPtr>>>&
137  array_buffer,
138  std::unique_ptr<std::vector<ArrayDatum>>::pointer arrayData) {
139  for (size_t row = 0; row < array_buffer->size(); row++) {
140  auto& element = (array_buffer->at(row));
141  bool is_null = false;
142  if (element.second) {
143  ColumnDataPtr& data = element.second;
144  int8_t* arrayDataPtr = reinterpret_cast<int8_t*>(data.release());
145  (*arrayData)[row] =
146  ArrayDatum(element.first * sizeof(TARGET_TYPE), arrayDataPtr, is_null);
147  }
148  }
149  }
150 
152  DataBlockPtr dataBlock;
153  dataBlock.numbersPtr = reinterpret_cast<int8_t*>(column_data_.get());
154  insertData.data.push_back(dataBlock);
155  insertData.columnIds.push_back(column_descriptor_->columnId);
156  }
157 };
158 
159 template <typename TARGET_TYPE>
160 struct DictionaryValueConverter : public NumericValueConverter<int64_t, TARGET_TYPE> {
161  using ElementsDataColumnPtr =
163 
164  using ElementsBufferColumnPtr = std::unique_ptr<std::vector<int32_t>>;
165 
167 
170 
172 
173  const int32_t buffer_null_sentinal_ = std::numeric_limits<int32_t>::min();
174 
176 
177  std::unordered_map<int32_t, int32_t> literals_lookup_;
179 
181  const ColumnDescriptor* targetDescriptor,
182  const Catalog_Namespace::Catalog& target_cat,
183  size_t num_rows,
184  TARGET_TYPE nullValue,
185  int64_t nullCheckValue,
186  bool doNullCheck,
187  StringDictionaryProxy* literals_dict,
188  StringDictionaryProxy* source_dict_proxy)
189  : NumericValueConverter<int64_t, TARGET_TYPE>(targetDescriptor,
190  num_rows,
191  nullValue,
192  nullCheckValue,
193  doNullCheck) {
194  literals_dict_ = literals_dict;
195  const auto& target_dict_key = targetDescriptor->columnType.getStringDictKey();
196  CHECK_EQ(target_dict_key.db_id, target_cat.getDatabaseId());
197  target_dict_desc_ = target_cat.getMetadataForDict(target_dict_key.dict_id, true);
198 
199  source_dict_desc_ = nullptr;
200  source_dict_proxy_ = source_dict_proxy;
201 
202  use_literals_ = 0 == source_dict_key.dict_id;
203  if (!use_literals_) {
204  const auto source_cat =
206  CHECK(source_cat);
208  source_cat->getMetadataForDict(std::abs(source_dict_key.dict_id), true);
210  } else {
211  if (literals_dict) {
212  auto const& transient_vecmap = literals_dict->getTransientVector();
213  for (unsigned index = 0; index < transient_vecmap.size(); ++index) {
214  auto const old_id = StringDictionaryProxy::transientIndexToId(index);
215  std::string const& str = *transient_vecmap[index];
216  auto const new_id = target_dict_desc_->stringDict->getOrAdd(str);
217  literals_lookup_[old_id] = new_id;
218  }
219  }
220 
222  }
223 
224  CHECK(target_dict_desc_);
225 
226  if (num_rows) {
228  }
229  }
230 
232 
234  CHECK(num_rows > 0);
235  return std::make_unique<std::vector<int32_t>>(num_rows);
236  }
237 
239  size_t row,
240  typename ElementsBufferColumnPtr::pointer columnBuffer,
241  const ScalarTargetValue* scalarValue) {
242  auto db_p = checked_get<int64_t>(row, scalarValue, this->SOURCE_TYPE_ACCESSOR);
243  auto val = *db_p;
244 
245  if (this->do_null_check_ && this->null_check_value_ == val) {
246  (*columnBuffer)[row] = this->buffer_null_sentinal_;
247  } else {
248  (*columnBuffer)[row] = (int32_t)val;
249  }
250  }
251 
252  void convertToColumnarFormat(size_t row, const ScalarTargetValue* scalarValue) {
253  convertElementToColumnarFormat(row, this->column_buffer_.get(), scalarValue);
254  }
255 
256  void convertToColumnarFormat(size_t row, const TargetValue* value) override {
257  auto scalarValue =
258  checked_get<ScalarTargetValue>(row, value, this->SCALAR_TARGET_VALUE_ACCESSOR);
259 
260  convertToColumnarFormat(row, scalarValue);
261  }
262 
263  inline int32_t convertTransientStringIdToPermanentId(int32_t& transient_string_id) {
264  if (source_dict_proxy_) {
265  auto str = source_dict_proxy_->getString(transient_string_id);
266  return source_dict_proxy_->getOrAdd(str);
267  } else {
268  throw std::runtime_error("Unexpected negative source ID");
269  }
270  }
271 
273  ElementsBufferColumnPtr buffer) {
276  reinterpret_cast<TARGET_TYPE*>(
277  checked_malloc(buffer->size() * sizeof(TARGET_TYPE))));
278 
279  std::vector<int32_t>* bufferPtr =
280  reinterpret_cast<std::vector<int32_t>*>(buffer.get());
281  TARGET_TYPE* columnDataPtr = reinterpret_cast<TARGET_TYPE*>(data.get());
282  if (use_literals_) {
283  for (size_t i = 0; i < bufferPtr->size(); i++) {
284  auto id = literals_lookup_[(*bufferPtr)[i]];
285  if (id == buffer_null_sentinal_) {
286  columnDataPtr[i] = this->null_value_;
287  } else {
288  columnDataPtr[i] = static_cast<TARGET_TYPE>(id);
289  }
290  }
291  } else {
293  // special case, where source and target dict are the same
294  // mostly in update
295  for (size_t i = 0; i < bufferPtr->size(); i++) {
296  auto src_id = (*bufferPtr)[i];
297  if (src_id == buffer_null_sentinal_) {
298  columnDataPtr[i] = this->null_value_;
299  } else if (src_id < 0) {
300  columnDataPtr[i] = convertTransientStringIdToPermanentId(src_id);
301  } else {
302  columnDataPtr[i] = static_cast<TARGET_TYPE>(src_id);
303  }
304  }
305 
306  } else {
307  std::vector<int32_t> dest_ids;
308  dest_ids.resize(bufferPtr->size());
309 
310  if (source_dict_proxy_) {
313  *bufferPtr,
316  } else {
319  *bufferPtr,
321  }
322 
323  // fixup NULL sentinel
324  for (size_t i = 0; i < dest_ids.size(); i++) {
325  auto id = dest_ids[i];
326  if (id == buffer_null_sentinal_) {
327  columnDataPtr[i] = this->null_value_;
328  } else {
329  if (std::is_signed<TARGET_TYPE>::value) {
330  if (id < 0) {
331  throw std::runtime_error(
332  "Maximum number of unique strings (" +
333  std::to_string(std::numeric_limits<TARGET_TYPE>::max()) +
334  ") reached in target dictionary");
335  }
336  } else {
337  if (id >= std::numeric_limits<TARGET_TYPE>::max()) {
338  throw std::runtime_error(
339  "Maximum number of unique strings (" +
340  std::to_string(std::numeric_limits<TARGET_TYPE>::max()) +
341  ") reached in target column's dict encoding");
342  }
343  }
344  columnDataPtr[i] = static_cast<TARGET_TYPE>(id);
345  }
346  }
347  }
348  }
349 
350  return data;
351  }
352 
354  std::unique_ptr<std::vector<std::pair<size_t, ElementsBufferColumnPtr>>>&
355  array_buffer,
356  std::unique_ptr<std::vector<ArrayDatum>>::pointer arrayData) {
357  if (use_literals_) {
358  for (size_t row = 0; row < array_buffer->size(); row++) {
359  auto& element = (array_buffer->at(row));
360  bool is_null = false;
361  if (element.second) {
363  processBuffer(std::move(element.second));
364  int8_t* arrayDataPtr = reinterpret_cast<int8_t*>(data.release());
365  (*arrayData)[row] =
366  ArrayDatum(element.first * sizeof(TARGET_TYPE), arrayDataPtr, is_null);
367  }
368  }
369  } else {
370  std::vector<std::vector<int32_t>> srcArrayIds(array_buffer->size());
371  std::vector<std::vector<int32_t>> destArrayIds(0);
372 
373  for (size_t row = 0; row < array_buffer->size(); row++) {
374  auto& element = (array_buffer->at(row));
375  if (element.second) {
376  srcArrayIds[row] = *(element.second.get());
377  }
378  }
379 
382  srcArrayIds,
384 
385  for (size_t row = 0; row < array_buffer->size(); row++) {
386  auto& element = (array_buffer->at(row));
387  bool is_null = false;
388  if (element.second) {
389  *(element.second.get()) = destArrayIds[row];
390  int8_t* arrayDataPtr = reinterpret_cast<int8_t*>(&(element.second->at(0)));
391  (*arrayData)[row] = ArrayDatum(element.first * sizeof(TARGET_TYPE),
392  arrayDataPtr,
393  is_null,
394  DoNothingDeleter());
395  }
396  }
397  }
398  }
399 
401  if (column_buffer_) {
402  this->column_data_ = processBuffer(std::move(column_buffer_));
403  column_buffer_ = nullptr;
404  }
405  }
406 
409  DataBlockPtr dataBlock;
410  dataBlock.numbersPtr = reinterpret_cast<int8_t*>(this->column_data_.get());
411  insertData.data.push_back(dataBlock);
412  insertData.columnIds.push_back(this->column_descriptor_->columnId);
413  }
414 };
415 
417  std::unique_ptr<std::vector<std::string>> column_data_;
418 
420 
424 
426  size_t num_rows,
427  bool dictEncoded,
428  const shared::StringDictKey& source_dict_key,
429  StringDictionaryProxy* literals_dict)
430  : TargetValueConverter(cd) {
431  source_dict_ = nullptr;
432  literals_source_dict_ = nullptr;
433  dict_encoded_ = dictEncoded;
434  if (dictEncoded) {
435  if (0 != source_dict_key.dict_id) {
436  const auto source_cat =
438  CHECK(source_cat);
439  const auto source_dict_desc =
440  source_cat->getMetadataForDict(std::abs(source_dict_key.dict_id), true);
441  CHECK(source_dict_desc);
442  source_dict_ = source_dict_desc->stringDict.get();
444  } else {
445  literals_source_dict_ = literals_dict;
446  }
447  }
448  if (num_rows) {
449  allocateColumnarData(num_rows);
450  }
451  }
452 
453  ~StringValueConverter() override {}
454 
455  void allocateColumnarData(size_t num_rows) override {
456  CHECK(num_rows > 0);
457  column_data_ = std::make_unique<std::vector<std::string>>(num_rows);
458  }
459 
460  void convertToColumnarFormatFromDict(size_t row, const TargetValue* value) {
461  auto scalarValue =
462  checked_get<ScalarTargetValue>(row, value, SCALAR_TARGET_VALUE_ACCESSOR);
463  auto db_p = checked_get<int64_t>(row, scalarValue, this->SOURCE_TYPE_ACCESSOR);
464  auto val = *db_p;
465 
466  if (std::numeric_limits<int32_t>::min() == val) {
467  (*column_data_)[row] = std::string("");
468  } else {
469  if (source_dict_) {
470  std::string strVal = source_dict_->getString(val);
471  (*column_data_)[row] = strVal;
472  } else if (literals_source_dict_) {
473  std::string strVal = literals_source_dict_->getString(val);
474  (*column_data_)[row] = strVal;
475  } else {
476  CHECK_EQ(val, inline_int_null_value<int32_t>());
477  std::string nullStr = "";
478  (*column_data_)[row] = nullStr;
479  }
480  }
481  }
482 
483  void convertToColumnarFormatFromString(size_t row, const TargetValue* value) {
484  auto scalarValue =
485  checked_get<ScalarTargetValue>(row, value, SCALAR_TARGET_VALUE_ACCESSOR);
486  auto db_p = checked_get<NullableString>(row, scalarValue, NULLABLE_STRING_ACCESSOR);
487  const auto db_str_p = checked_get<std::string>(row, db_p, STRING_ACCESSOR);
488 
489  if (nullptr != db_str_p) {
490  (*column_data_)[row] = *db_str_p;
491  } else {
492  (*column_data_)[row] = std::string("");
493  }
494  }
495 
496  void convertToColumnarFormat(size_t row, const TargetValue* value) override {
497  if (dict_encoded_) {
499  } else {
501  }
502  }
503 
505  DataBlockPtr dataBlock;
506  dataBlock.stringsPtr = column_data_.get();
507  insertData.data.push_back(dataBlock);
508  insertData.columnIds.push_back(column_descriptor_->columnId);
509  }
510 };
511 
512 template <typename ELEMENT_CONVERTER>
514  std::unique_ptr<
515  std::vector<std::pair<size_t, typename ELEMENT_CONVERTER::ElementsBufferColumnPtr>>>
517  std::unique_ptr<std::vector<ArrayDatum>> column_data_;
518  std::unique_ptr<ELEMENT_CONVERTER> element_converter_;
521  bool data_finalized_ = false;
525 
527 
529  size_t num_rows,
530  std::unique_ptr<ELEMENT_CONVERTER> element_converter,
531  bool do_check_null)
533  , element_converter_(std::move(element_converter))
534  , element_type_info_(cd->columnType.get_elem_type())
535  , do_check_null_(do_check_null) {
536  if (num_rows) {
537  allocateColumnarData(num_rows);
538  }
539 
540  if (cd->columnType.get_size() > 0) {
543  fixed_array_size_ / sizeof(ELEMENT_CONVERTER::fixed_array_null_value_);
544  element_converter_->populateFixedArrayNullSentinel(fixed_array_elements_count_);
546  reinterpret_cast<int8_t*>(element_converter_->column_data_.get());
547  } else {
548  fixed_array_size_ = 0;
550  fixed_array_null_sentinel_ = nullptr;
551  }
552  }
553 
554  ~ArrayValueConverter() override {}
555 
556  void allocateColumnarData(size_t num_rows) override {
557  CHECK(num_rows > 0);
558  column_data_ = std::make_unique<std::vector<ArrayDatum>>(num_rows);
559  column_buffer_ = std::make_unique<std::vector<
560  std::pair<size_t, typename ELEMENT_CONVERTER::ElementsBufferColumnPtr>>>(
561  num_rows);
562  }
563 
564  void convertToColumnarFormat(size_t row, const TargetValue* value) override {
565  const auto arrayValue =
566  checked_get<ArrayTargetValue>(row, value, ARRAY_VALUE_ACCESSOR);
567  CHECK(arrayValue);
568  if (arrayValue->is_initialized()) {
569  const auto& vec = arrayValue->get();
570  bool is_null = false;
571 
573  if (fixed_array_elements_count_ != vec.size()) {
574  throw std::runtime_error(
575  "Incorrect number of array elements for fixed length array column");
576  }
577  }
578 
579  if (vec.size()) {
580  typename ELEMENT_CONVERTER::ElementsBufferColumnPtr elementBuffer =
581  element_converter_->allocateColumnarBuffer(vec.size());
582 
583  int elementIndex = 0;
584  for (const auto& scalarValue : vec) {
585  element_converter_->convertElementToColumnarFormat(
586  elementIndex++, elementBuffer.get(), &scalarValue);
587  }
588 
589  column_buffer_->at(row) = {vec.size(), std::move(elementBuffer)};
590 
591  } else {
592  // Empty, not NULL
593  (*column_data_)[row] = ArrayDatum(0, nullptr, is_null, DoNothingDeleter());
594  }
595  } else {
596  if (!do_check_null_) {
597  throw std::runtime_error("NULL assignment of non null column not allowed");
598  }
599 
600  bool is_null = true; // do_check_null_;
601  (*column_data_)[row] = ArrayDatum(
603  (*column_data_)[row].is_null = is_null;
604  }
605  }
606 
608  if (!data_finalized_) {
609  element_converter_->processArrayBuffer(column_buffer_, column_data_.get());
610  data_finalized_ = true;
611  }
612  }
613 
616  DataBlockPtr dataBlock;
617  dataBlock.arraysPtr = column_data_.get();
618  insertData.data.push_back(dataBlock);
619  insertData.columnIds.push_back(column_descriptor_->columnId);
620  }
621 };
622 
625 
626  std::unique_ptr<std::vector<std::string>> column_data_;
627  std::unique_ptr<std::vector<ArrayDatum>> signed_compressed_coords_data_;
628 
630  size_t num_rows,
631  const ColumnDescriptor* logicalColumnDescriptor)
632  : TargetValueConverter(logicalColumnDescriptor) {
636 
637  if (num_rows) {
638  allocateColumnarData(num_rows);
639  }
640  }
641 
643 
644  void allocateColumnarData(size_t num_rows) override {
645  CHECK(num_rows > 0);
646  column_data_ = std::make_unique<std::vector<std::string>>(num_rows);
647  signed_compressed_coords_data_ = std::make_unique<std::vector<ArrayDatum>>(num_rows);
648  }
649 
652 
654  const std::shared_ptr<std::vector<double>>& coords) {
655  const auto compressed_coords_vector =
657 
658  uint8_t* compressed_coords_array = reinterpret_cast<uint8_t*>(
659  checked_malloc(sizeof(uint8_t) * compressed_coords_vector.size()));
660  memcpy(compressed_coords_array,
661  &compressed_coords_vector[0],
662  compressed_coords_vector.size());
663 
664  return ArrayDatum((int)compressed_coords_vector.size(),
665  reinterpret_cast<int8_t*>(compressed_coords_array),
666  false);
667  }
668 
669  void convertToColumnarFormat(size_t row, const TargetValue* value) override {
670  const auto geoValue = checked_get<GeoTargetValue>(row, value, GEO_VALUE_ACCESSOR);
671  CHECK(geoValue);
672  if (geoValue->is_initialized()) {
673  const auto geo = geoValue->get();
674  const auto geoPoint =
675  checked_get<GeoPointTargetValue>(row, &geo, GEO_POINT_VALUE_ACCESSOR);
676  CHECK(geoPoint);
677  (*column_data_)[row] = "";
678  (*signed_compressed_coords_data_)[row] = toCompressedCoords(geoPoint->coords);
679  } else {
680  // NULL point
681  (*column_data_)[row] = "";
682  auto coords = std::make_shared<std::vector<double>>();
683  coords->push_back(NULL_ARRAY_DOUBLE);
684  coords->push_back(NULL_DOUBLE);
685  auto coords_datum = toCompressedCoords(coords);
686  coords_datum.is_null = true;
687  (*signed_compressed_coords_data_)[row] = coords_datum;
688  }
689  }
690 
692  DataBlockPtr logical, coords;
693 
694  logical.stringsPtr = column_data_.get();
696 
697  insertData.data.emplace_back(logical);
698  insertData.columnIds.emplace_back(column_descriptor_->columnId);
699 
700  insertData.data.emplace_back(coords);
701  insertData.columnIds.emplace_back(coords_column_descriptor_->columnId);
702  }
703 };
704 
705 inline std::vector<double> compute_bounds_of_coords(
706  const std::shared_ptr<std::vector<double>>& coords) {
707  std::vector<double> bounds(4);
708  constexpr auto DOUBLE_MAX = std::numeric_limits<double>::max();
709  constexpr auto DOUBLE_MIN = std::numeric_limits<double>::lowest();
710  bounds[0] = DOUBLE_MAX;
711  bounds[1] = DOUBLE_MAX;
712  bounds[2] = DOUBLE_MIN;
713  bounds[3] = DOUBLE_MIN;
714  auto size_coords = coords->size();
715 
716  for (size_t i = 0; i < size_coords; i += 2) {
717  double x = (*coords)[i];
718  double y = (*coords)[i + 1];
719 
720  bounds[0] = std::min(bounds[0], x);
721  bounds[1] = std::min(bounds[1], y);
722  bounds[2] = std::max(bounds[2], x);
723  bounds[3] = std::max(bounds[3], y);
724  }
725  return bounds;
726 }
727 
728 template <typename ELEM_TYPE>
729 inline ArrayDatum to_array_datum(const std::vector<ELEM_TYPE>& vector) {
730  ELEM_TYPE* array =
731  reinterpret_cast<ELEM_TYPE*>(checked_malloc(sizeof(ELEM_TYPE) * vector.size()));
732  memcpy(array, vector.data(), vector.size() * sizeof(ELEM_TYPE));
733 
734  return ArrayDatum(
735  (int)(vector.size() * sizeof(ELEM_TYPE)), reinterpret_cast<int8_t*>(array), false);
736 }
737 
738 template <typename ELEM_TYPE>
739 inline ArrayDatum to_array_datum(const std::shared_ptr<std::vector<ELEM_TYPE>>& vector) {
740  return to_array_datum(*vector.get());
741 }
742 
745 
746  std::unique_ptr<std::vector<ArrayDatum>> bounds_data_;
747 
749  size_t num_rows,
750  const ColumnDescriptor* logicalColumnDescriptor)
751  : GeoPointValueConverter(cat, num_rows, logicalColumnDescriptor) {
755 
756  if (num_rows) {
757  allocateColumnarData(num_rows);
758  }
759  }
760 
762 
763  void allocateColumnarData(size_t num_rows) override {
764  CHECK(num_rows > 0);
766  bounds_data_ = std::make_unique<std::vector<ArrayDatum>>(num_rows);
767  }
768 
770 
771  void convertToColumnarFormat(size_t row, const TargetValue* value) override {
772  const auto geoValue =
773  checked_get<GeoTargetValue>(row, value, GEO_TARGET_VALUE_ACCESSOR);
774  CHECK(geoValue);
775  if (geoValue->is_initialized()) {
776  const auto geo = geoValue->get();
777  const auto geoMultiPoint =
778  checked_get<GeoMultiPointTargetValue>(row, &geo, GEO_MULTIPOINT_VALUE_ACCESSOR);
779 
780  (*column_data_)[row] = "";
781  (*signed_compressed_coords_data_)[row] = toCompressedCoords(geoMultiPoint->coords);
782  auto bounds = compute_bounds_of_coords(geoMultiPoint->coords);
783  (*bounds_data_)[row] = to_array_datum(bounds);
784  } else {
785  // NULL MultiPoint
786  (*column_data_)[row] = "";
787  (*signed_compressed_coords_data_)[row] = ArrayDatum(0, nullptr, true);
788  std::vector<double> bounds = {
789  NULL_ARRAY_DOUBLE, NULL_DOUBLE, NULL_DOUBLE, NULL_DOUBLE};
790  auto bounds_datum = to_array_datum(bounds);
791  bounds_datum.is_null = true;
792  (*bounds_data_)[row] = bounds_datum;
793  }
794  }
795 
798 
799  DataBlockPtr bounds;
800 
801  bounds.arraysPtr = bounds_data_.get();
802 
803  insertData.data.emplace_back(bounds);
804  insertData.columnIds.emplace_back(bounds_column_descriptor_->columnId);
805  }
806 };
807 
810 
811  std::unique_ptr<std::vector<ArrayDatum>> bounds_data_;
812 
814  size_t num_rows,
815  const ColumnDescriptor* logicalColumnDescriptor)
816  : GeoPointValueConverter(cat, num_rows, logicalColumnDescriptor) {
820 
821  if (num_rows) {
822  allocateColumnarData(num_rows);
823  }
824  }
825 
827 
828  void allocateColumnarData(size_t num_rows) override {
829  CHECK(num_rows > 0);
831  bounds_data_ = std::make_unique<std::vector<ArrayDatum>>(num_rows);
832  }
833 
835 
836  void convertToColumnarFormat(size_t row, const TargetValue* value) override {
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  }
860 
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  }
871 };
872 
876 
877  std::unique_ptr<std::vector<ArrayDatum>> linestring_sizes_data_;
878  std::unique_ptr<std::vector<ArrayDatum>> bounds_data_;
879 
881  size_t num_rows,
882  const ColumnDescriptor* logicalColumnDescriptor)
883  : GeoPointValueConverter(cat, num_rows, logicalColumnDescriptor) {
890 
891  if (num_rows) {
892  allocateColumnarData(num_rows);
893  }
894  }
895 
897 
898  void allocateColumnarData(size_t num_rows) override {
899  CHECK(num_rows > 0);
901  linestring_sizes_data_ = std::make_unique<std::vector<ArrayDatum>>(num_rows);
902  bounds_data_ = std::make_unique<std::vector<ArrayDatum>>(num_rows);
903  }
904 
907 
908  void convertToColumnarFormat(size_t row, const TargetValue* value) override {
909  const auto geoValue =
910  checked_get<GeoTargetValue>(row, value, GEO_TARGET_VALUE_ACCESSOR);
911  CHECK(geoValue);
912  if (geoValue->is_initialized()) {
913  const auto geo = geoValue->get();
914  const auto geoMultiLinestring = checked_get<GeoMultiLineStringTargetValue>(
916 
917  (*column_data_)[row] = "";
918  (*signed_compressed_coords_data_)[row] =
919  toCompressedCoords(geoMultiLinestring->coords);
920  (*linestring_sizes_data_)[row] =
921  to_array_datum(geoMultiLinestring->linestring_sizes);
922  auto bounds = compute_bounds_of_coords(geoMultiLinestring->coords);
923  (*bounds_data_)[row] = to_array_datum(bounds);
924  } else {
925  // NULL MultiLinestring
926  (*column_data_)[row] = "";
927  (*signed_compressed_coords_data_)[row] = ArrayDatum(0, nullptr, true);
928  (*linestring_sizes_data_)[row] = ArrayDatum(0, nullptr, true);
929  std::vector<double> bounds = {
930  NULL_ARRAY_DOUBLE, NULL_DOUBLE, NULL_DOUBLE, NULL_DOUBLE};
931  auto bounds_datum = to_array_datum(bounds);
932  bounds_datum.is_null = true;
933  (*bounds_data_)[row] = bounds_datum;
934  }
935  }
936 
939 
940  DataBlockPtr linestringSizes, bounds;
941 
942  linestringSizes.arraysPtr = linestring_sizes_data_.get();
943  bounds.arraysPtr = bounds_data_.get();
944 
945  insertData.data.emplace_back(linestringSizes);
946  insertData.columnIds.emplace_back(linestring_sizes_column_descriptor_->columnId);
947 
948  insertData.data.emplace_back(bounds);
949  insertData.columnIds.emplace_back(bounds_column_descriptor_->columnId);
950  }
951 };
952 
956 
957  std::unique_ptr<std::vector<ArrayDatum>> ring_sizes_data_;
958  std::unique_ptr<std::vector<ArrayDatum>> bounds_data_;
959 
961  size_t num_rows,
962  const ColumnDescriptor* logicalColumnDescriptor)
963  : GeoPointValueConverter(cat, num_rows, logicalColumnDescriptor) {
970 
971  if (num_rows) {
972  allocateColumnarData(num_rows);
973  }
974  }
975 
977 
978  void allocateColumnarData(size_t num_rows) override {
980  ring_sizes_data_ = std::make_unique<std::vector<ArrayDatum>>(num_rows);
981  bounds_data_ = std::make_unique<std::vector<ArrayDatum>>(num_rows);
982  }
983 
985 
986  void convertToColumnarFormat(size_t row, const TargetValue* value) override {
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  }
1012 
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  }
1027 };
1028 
1033 
1034  std::unique_ptr<std::vector<ArrayDatum>> ring_sizes_data_;
1035  std::unique_ptr<std::vector<ArrayDatum>> poly_rings_data_;
1036  std::unique_ptr<std::vector<ArrayDatum>> bounds_data_;
1037 
1039  size_t num_rows,
1040  const ColumnDescriptor* logicalColumnDescriptor)
1041  : GeoPointValueConverter(cat, num_rows, logicalColumnDescriptor) {
1051 
1052  if (num_rows) {
1053  allocateColumnarData(num_rows);
1054  }
1055  }
1056 
1058 
1059  void allocateColumnarData(size_t num_rows) override {
1061  ring_sizes_data_ = std::make_unique<std::vector<ArrayDatum>>(num_rows);
1062  poly_rings_data_ = std::make_unique<std::vector<ArrayDatum>>(num_rows);
1063  bounds_data_ = std::make_unique<std::vector<ArrayDatum>>(num_rows);
1064  }
1065 
1067 
1068  void convertToColumnarFormat(size_t row, const TargetValue* value) override {
1069  const auto geoValue =
1070  checked_get<GeoTargetValue>(row, value, GEO_TARGET_VALUE_ACCESSOR);
1071  CHECK(geoValue);
1072  if (geoValue->is_initialized()) {
1073  const auto geo = geoValue->get();
1074  const auto geoMultiPoly =
1075  checked_get<GeoMultiPolyTargetValue>(row, &geo, GEO_MULTI_POLY_VALUE_ACCESSOR);
1076 
1077  (*column_data_)[row] = "";
1078  (*signed_compressed_coords_data_)[row] = toCompressedCoords(geoMultiPoly->coords);
1079  (*ring_sizes_data_)[row] = to_array_datum(geoMultiPoly->ring_sizes);
1080  (*poly_rings_data_)[row] = to_array_datum(geoMultiPoly->poly_rings);
1081  auto bounds = compute_bounds_of_coords(geoMultiPoly->coords);
1082  (*bounds_data_)[row] = to_array_datum(bounds);
1083  } else {
1084  // NULL MultiPolygon
1085  (*column_data_)[row] = "";
1086  (*signed_compressed_coords_data_)[row] = ArrayDatum(0, nullptr, true);
1087  (*ring_sizes_data_)[row] = ArrayDatum(0, nullptr, true);
1088  (*poly_rings_data_)[row] = ArrayDatum(0, nullptr, true);
1089  std::vector<double> bounds = {
1090  NULL_ARRAY_DOUBLE, NULL_DOUBLE, NULL_DOUBLE, NULL_DOUBLE};
1091  auto bounds_datum = to_array_datum(bounds);
1092  bounds_datum.is_null = true;
1093  (*bounds_data_)[row] = bounds_datum;
1094  }
1095  }
1096 
1099 
1100  DataBlockPtr ringSizes, polyRings, bounds;
1101 
1102  ringSizes.arraysPtr = ring_sizes_data_.get();
1103  polyRings.arraysPtr = poly_rings_data_.get();
1104  bounds.arraysPtr = bounds_data_.get();
1105 
1106  insertData.data.emplace_back(ringSizes);
1107  insertData.columnIds.emplace_back(ring_sizes_column_descriptor_->columnId);
1108 
1109  insertData.data.emplace_back(polyRings);
1110  insertData.columnIds.emplace_back(ring_sizes_solumn_descriptor_->columnId);
1111 
1112  insertData.data.emplace_back(bounds);
1113  insertData.columnIds.emplace_back(bounds_column_descriptor_->columnId);
1114  }
1115 };
1116 
1117 #endif
std::unique_ptr< std::vector< ArrayDatum > > ring_sizes_data_
ArrayDatum to_array_datum(const std::vector< ELEM_TYPE > &vector)
std::unique_ptr< std::vector< ArrayDatum > > bounds_data_
std::unique_ptr< TARGET_TYPE, CheckedMallocDeleter< TARGET_TYPE >> ColumnDataPtr
std::unique_ptr< std::vector< int32_t >> ElementsBufferColumnPtr
StringDictionaryProxy * literals_source_dict_
#define CHECK_EQ(x, y)
Definition: Logger.h:301
void convertToColumnarFormatFromDict(size_t row, const TargetValue *value)
void allocateColumnarData(size_t num_rows) override
std::unique_ptr< std::vector< ArrayDatum > > bounds_data_
#define NULL_DOUBLE
HOST DEVICE int get_size() const
Definition: sqltypes.h:403
const std::vector< std::string const * > & getTransientVector() const
std::string cat(Ts &&...args)
void addDataBlocksToInsertData(Fragmenter_Namespace::InsertData &insertData) override
class for a per-database catalog. also includes metadata for the current database and the current use...
Definition: Catalog.h:143
std::vector< std::string > * stringsPtr
Definition: sqltypes.h:234
const ColumnDescriptor * ring_sizes_solumn_descriptor_
std::vector< ArrayDatum > * arraysPtr
Definition: sqltypes.h:235
constexpr auto DOUBLE_MAX
Definition: Types.cpp:41
void allocateColumnarData(size_t num_rows) override
void processArrayBuffer(std::unique_ptr< std::vector< std::pair< size_t, ElementsBufferColumnPtr >>> &array_buffer, std::unique_ptr< std::vector< ArrayDatum >>::pointer arrayData)
boost_variant_accessor< int64_t > SOURCE_TYPE_ACCESSOR
const ColumnDescriptor * bounds_column_descriptor_
ArrayValueConverter(const ColumnDescriptor *cd, size_t num_rows, std::unique_ptr< ELEMENT_CONVERTER > element_converter, bool do_check_null)
void populateFixedArrayNullSentinel(size_t num_rows)
const DictDescriptor * source_dict_desc_
const ColumnDescriptor * bounds_column_descriptor_
const ColumnDescriptor * linestring_sizes_column_descriptor_
void convertToColumnarFormat(size_t row, const TargetValue *value) override
void convertToColumnarFormat(size_t row, const ScalarTargetValue *scalarValue)
void convertToColumnarFormat(size_t row, const TargetValue *value) override
std::unique_ptr< std::vector< ArrayDatum > > bounds_data_
void allocateColumnarData(size_t num_rows) override
const ColumnDescriptor * column_descriptor_
std::string getString(int32_t string_id) const
ArrayDatum toCompressedCoords(const std::shared_ptr< std::vector< double >> &coords)
ElementsBufferColumnPtr column_buffer_
std::vector< double > compute_bounds_of_coords(const std::shared_ptr< std::vector< double >> &coords)
std::unique_ptr< std::vector< ArrayDatum > > poly_rings_data_
static void populate_string_ids(std::vector< int32_t > &dest_ids, StringDictionary *dest_dict, const std::vector< int32_t > &source_ids, const StringDictionary *source_dict, const std::vector< std::string const * > &transient_string_vec={})
Populates provided dest_ids vector with string ids corresponding to given source strings.
void processArrayBuffer(std::unique_ptr< std::vector< std::pair< size_t, ElementsBufferColumnPtr >>> &array_buffer, std::unique_ptr< std::vector< ArrayDatum >>::pointer arrayData)
std::function< TARGET_TYPE(int64_t, bool, TARGET_TYPE)> CasterFunc
const ColumnDescriptor * bounds_column_descriptor_
ElementsBufferColumnPtr allocateColumnarBuffer(size_t num_rows)
void convertElementToColumnarFormat(size_t row, typename ElementsBufferColumnPtr::pointer columnData, const ScalarTargetValue *scalarValue)
std::string to_string(char const *&&v)
const DictDescriptor * target_dict_desc_
void addDataBlocksToInsertData(Fragmenter_Namespace::InsertData &insertData) override
void addDataBlocksToInsertData(Fragmenter_Namespace::InsertData &insertData) override
const StringDictionaryProxy * literals_dict_
void convertToColumnarFormat(size_t row, const ScalarTargetValue *scalarValue)
void allocateColumnarData(size_t num_rows) override
std::shared_ptr< StringDictionary > stringDict
boost_variant_accessor< GeoMultiPointTargetValue > GEO_MULTIPOINT_VALUE_ACCESSOR
boost_variant_accessor< ScalarTargetValue > SCALAR_TARGET_VALUE_ACCESSOR
boost_variant_accessor< GeoLineStringTargetValue > GEO_LINESTRING_VALUE_ACCESSOR
std::conditional_t< is_cuda_compiler(), DeviceArrayDatum, HostArrayDatum > ArrayDatum
Definition: sqltypes.h:229
GeoPointValueConverter(const Catalog_Namespace::Catalog &cat, size_t num_rows, const ColumnDescriptor *logicalColumnDescriptor)
std::vector< uint8_t > compress_coords(const std::vector< double > &coords, const SQLTypeInfo &ti)
Definition: Compression.cpp:52
boost_variant_accessor< NullableString > NULLABLE_STRING_ACCESSOR
static SysCatalog & instance()
Definition: SysCatalog.h:343
std::unique_ptr< std::vector< std::string > > column_data_
CONSTEXPR DEVICE bool is_null(const T &value)
void addDataBlocksToInsertData(Fragmenter_Namespace::InsertData &insertData) override
void convertToColumnarFormatFromString(size_t row, const TargetValue *value)
void * checked_malloc(const size_t size)
Definition: checked_alloc.h:45
boost_variant_accessor< GeoMultiPolyTargetValue > GEO_MULTI_POLY_VALUE_ACCESSOR
const ColumnDescriptor * bounds_column_descriptor_
boost_variant_accessor< GeoPolyTargetValue > GEO_POLY_VALUE_ACCESSOR
boost_variant_accessor< std::string > STRING_ACCESSOR
const ColumnDescriptor * ring_sizes_column_descriptor_
std::unique_ptr< std::vector< ArrayDatum > > ring_sizes_data_
void finalizeDataBlocksForInsertData() override
GeoLinestringValueConverter(const Catalog_Namespace::Catalog &cat, size_t num_rows, const ColumnDescriptor *logicalColumnDescriptor)
const ColumnDescriptor * getMetadataForColumn(int tableId, const std::string &colName) const
int getDatabaseId() const
Definition: Catalog.h:326
static int32_t transientIndexToId(unsigned const index)
std::unique_ptr< std::vector< ArrayDatum > > linestring_sizes_data_
GeoMultiPointValueConverter(const Catalog_Namespace::Catalog &cat, size_t num_rows, const ColumnDescriptor *logicalColumnDescriptor)
const DictDescriptor * getMetadataForDict(int dict_ref, bool loadDict=true) const
Definition: Catalog.cpp:1907
specifies the content in-memory of a row in the column metadata table
StringValueConverter(const ColumnDescriptor *cd, size_t num_rows, bool dictEncoded, const shared::StringDictKey &source_dict_key, StringDictionaryProxy *literals_dict)
void addDataBlocksToInsertData(Fragmenter_Namespace::InsertData &insertData) override
GeoMultiPolygonValueConverter(const Catalog_Namespace::Catalog &cat, size_t num_rows, const ColumnDescriptor *logicalColumnDescriptor)
void convertToColumnarFormat(size_t row, const TargetValue *value) override
std::unique_ptr< ELEMENT_CONVERTER > element_converter_
T get_fixed_array_null_value()
void convertToColumnarFormat(size_t row, const TargetValue *value) override
std::shared_ptr< Catalog > getCatalog(const std::string &dbName)
void finalizeDataBlocksForInsertData() override
void addDataBlocksToInsertData(Fragmenter_Namespace::InsertData &insertData) override
void setValueCaster(CasterFunc caster)
std::vector< DataBlockPtr > data
the number of rows being inserted
Definition: Fragmenter.h:73
int32_t getOrAdd(const std::string &str) noexcept
boost_variant_accessor< GeoMultiLineStringTargetValue > GEO_MULTILINESTRING_VALUE_ACCESSOR
void allocateColumnarData(size_t num_rows) override
int32_t convertTransientStringIdToPermanentId(int32_t &transient_string_id)
void convertToColumnarFormat(size_t row, const TargetValue *value) override
std::unique_ptr< std::vector< std::string > > column_data_
typename NumericValueConverter< int64_t, TARGET_TYPE >::ColumnDataPtr ElementsDataColumnPtr
std::unordered_map< int32_t, int32_t > literals_lookup_
RETURN_TYPE checked_cast(SOURCE_TYPE val, bool check_null, RETURN_TYPE null_value)
const ColumnDescriptor * coords_column_descriptor_
void allocateColumnarData(size_t num_rows) override
std::string getString(int32_t string_id) const
constexpr auto DOUBLE_MIN
Definition: Types.cpp:42
std::unique_ptr< std::vector< ArrayDatum > > bounds_data_
void allocateColumnarData(size_t num_rows) override
boost_variant_accessor< GeoTargetValue > GEO_VALUE_ACCESSOR
#define NULL_ARRAY_DOUBLE
void addDataBlocksToInsertData(Fragmenter_Namespace::InsertData &insertData) override
static void populate_string_array_ids(std::vector< std::vector< int32_t >> &dest_array_ids, StringDictionary *dest_dict, const std::vector< std::vector< int32_t >> &source_array_ids, const StringDictionary *source_dict)
#define CHECK(condition)
Definition: Logger.h:291
NumericValueConverter< int64_t, TARGET_TYPE >::ColumnDataPtr processBuffer(ElementsBufferColumnPtr buffer)
std::unique_ptr< std::vector< std::pair< size_t, typename ELEMENT_CONVERTER::ElementsBufferColumnPtr > > > column_buffer_
boost_variant_accessor< GeoTargetValue > GEO_TARGET_VALUE_ACCESSOR
GeoMultiLinestringValueConverter(const Catalog_Namespace::Catalog &cat, size_t num_rows, const ColumnDescriptor *logicalColumnDescriptor)
Descriptor for a dictionary for a string columne.
const ColumnDescriptor * bounds_column_descriptor_
void convertToColumnarFormat(size_t row, const TargetValue *value) override
void convertToColumnarFormat(size_t row, const TargetValue *value) override
The data to be inserted using the fragment manager.
Definition: Fragmenter.h:68
boost::variant< ScalarTargetValue, ArrayTargetValue, GeoTargetValue, GeoTargetValuePtr > TargetValue
Definition: TargetValue.h:195
std::unique_ptr< std::vector< ArrayDatum > > column_data_
SQLTypeInfo columnType
void convertElementToColumnarFormat(size_t row, typename ElementsBufferColumnPtr::pointer columnBuffer, const ScalarTargetValue *scalarValue)
void allocateColumnarData(size_t num_rows) override
void allocateColumnarData(size_t num_rows) override
void convertToColumnarFormat(size_t row, const TargetValue *value) override
int8_t * numbersPtr
Definition: sqltypes.h:233
ElementsBufferColumnPtr allocateColumnarBuffer(size_t num_rows)
void convertToColumnarFormat(size_t row, const TargetValue *value) override
std::unique_ptr< std::vector< ArrayDatum > > bounds_data_
boost_variant_accessor< ArrayTargetValue > ARRAY_VALUE_ACCESSOR
void convertToColumnarFormat(size_t row, const TargetValue *value) override
boost_variant_accessor< GeoPointTargetValue > GEO_POINT_VALUE_ACCESSOR
const ColumnDescriptor * ring_sizes_column_descriptor_
boost_variant_accessor< SOURCE_TYPE > SOURCE_TYPE_ACCESSOR
std::vector< int > columnIds
identifies the table into which the data is being inserted
Definition: Fragmenter.h:71
void addDataBlocksToInsertData(Fragmenter_Namespace::InsertData &insertData) override
void addDataBlocksToInsertData(Fragmenter_Namespace::InsertData &insertData) override
GeoPolygonValueConverter(const Catalog_Namespace::Catalog &cat, size_t num_rows, const ColumnDescriptor *logicalColumnDescriptor)
std::unique_ptr< std::vector< ArrayDatum > > signed_compressed_coords_data_
void addDataBlocksToInsertData(Fragmenter_Namespace::InsertData &insertData) override
StringDictionaryProxy * source_dict_proxy_
NumericValueConverter(const ColumnDescriptor *cd, size_t num_rows, TARGET_TYPE nullValue, SOURCE_TYPE nullCheckValue, bool doNullCheck)
const shared::StringDictKey & getStringDictKey() const
Definition: sqltypes.h:1057
DictionaryValueConverter(const shared::StringDictKey &source_dict_key, const ColumnDescriptor *targetDescriptor, const Catalog_Namespace::Catalog &target_cat, size_t num_rows, TARGET_TYPE nullValue, int64_t nullCheckValue, bool doNullCheck, StringDictionaryProxy *literals_dict, StringDictionaryProxy *source_dict_proxy)
boost::variant< int64_t, double, float, NullableString > ScalarTargetValue
Definition: TargetValue.h:180