OmniSciDB  b24e664e58
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ArrayValueConverter< ELEMENT_CONVERTER > Struct Template Reference

#include <TargetValueConvertersImpl.h>

+ Inheritance diagram for ArrayValueConverter< ELEMENT_CONVERTER >:
+ Collaboration diagram for ArrayValueConverter< ELEMENT_CONVERTER >:

Public Member Functions

 ArrayValueConverter (const ColumnDescriptor *cd, size_t num_rows, std::unique_ptr< ELEMENT_CONVERTER > element_converter, bool do_check_null)
 
 ~ArrayValueConverter () override
 
void allocateColumnarData (size_t num_rows) override
 
void convertToColumnarFormat (size_t row, const TargetValue *value) override
 
void finalizeDataBlocksForInsertData () override
 
void addDataBlocksToInsertData (Fragmenter_Namespace::InsertData &insertData) override
 
- Public Member Functions inherited from TargetValueConverter
 TargetValueConverter (const ColumnDescriptor *cd)
 
virtual ~TargetValueConverter ()
 

Public Attributes

std::unique_ptr< std::vector
< std::pair< size_t, typename
ELEMENT_CONVERTER::ElementsBufferColumnPtr > > > 
column_buffer_
 
std::unique_ptr< std::vector
< ArrayDatum > > 
column_data_
 
std::unique_ptr
< ELEMENT_CONVERTER > 
element_converter_
 
SQLTypeInfo element_type_info_
 
bool do_check_null_
 
bool data_finalized_ = false
 
boost_variant_accessor
< ArrayTargetValue
ARRAY_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

template<typename ELEMENT_CONVERTER>
struct ArrayValueConverter< ELEMENT_CONVERTER >

Definition at line 450 of file TargetValueConvertersImpl.h.

Constructor & Destructor Documentation

template<typename ELEMENT_CONVERTER >
ArrayValueConverter< ELEMENT_CONVERTER >::ArrayValueConverter ( const ColumnDescriptor cd,
size_t  num_rows,
std::unique_ptr< ELEMENT_CONVERTER >  element_converter,
bool  do_check_null 
)
inline

Definition at line 462 of file TargetValueConvertersImpl.h.

References ArrayValueConverter< ELEMENT_CONVERTER >::allocateColumnarData().

467  , element_converter_(std::move(element_converter))
469  , do_check_null_(do_check_null) {
470  if (num_rows) {
472  }
473  }
const int8_t const int64_t * num_rows
TargetValueConverter(const ColumnDescriptor *cd)
std::unique_ptr< ELEMENT_CONVERTER > element_converter_
void allocateColumnarData(size_t num_rows) override
SQLTypeInfoCore get_elem_type() const
Definition: sqltypes.h:659
SQLTypeInfo columnType

+ Here is the call graph for this function:

template<typename ELEMENT_CONVERTER >
ArrayValueConverter< ELEMENT_CONVERTER >::~ArrayValueConverter ( )
inlineoverride

Definition at line 475 of file TargetValueConvertersImpl.h.

475 {}

Member Function Documentation

template<typename ELEMENT_CONVERTER >
void ArrayValueConverter< ELEMENT_CONVERTER >::addDataBlocksToInsertData ( Fragmenter_Namespace::InsertData insertData)
inlineoverridevirtual

Implements TargetValueConverter.

Definition at line 524 of file TargetValueConvertersImpl.h.

References DataBlockPtr::arraysPtr, ArrayValueConverter< ELEMENT_CONVERTER >::column_data_, TargetValueConverter::column_descriptor_, ColumnDescriptor::columnId, Fragmenter_Namespace::InsertData::columnIds, Fragmenter_Namespace::InsertData::data, and ArrayValueConverter< ELEMENT_CONVERTER >::finalizeDataBlocksForInsertData().

524  {
526  DataBlockPtr dataBlock;
527  dataBlock.arraysPtr = column_data_.get();
528  insertData.data.push_back(dataBlock);
529  insertData.columnIds.push_back(column_descriptor_->columnId);
530  }
std::vector< ArrayDatum > * arraysPtr
Definition: sqltypes.h:142
const ColumnDescriptor * column_descriptor_
void finalizeDataBlocksForInsertData() override
std::vector< DataBlockPtr > data
the number of rows being inserted
Definition: Fragmenter.h:64
std::unique_ptr< std::vector< ArrayDatum > > column_data_
std::vector< int > columnIds
identifies the table into which the data is being inserted
Definition: Fragmenter.h:62

+ Here is the call graph for this function:

template<typename ELEMENT_CONVERTER >
void ArrayValueConverter< ELEMENT_CONVERTER >::allocateColumnarData ( size_t  num_rows)
inlineoverridevirtual

Implements TargetValueConverter.

Definition at line 477 of file TargetValueConvertersImpl.h.

References CHECK(), ArrayValueConverter< ELEMENT_CONVERTER >::column_buffer_, ArrayValueConverter< ELEMENT_CONVERTER >::column_data_, and num_rows.

Referenced by ArrayValueConverter< ELEMENT_CONVERTER >::ArrayValueConverter().

477  {
478  CHECK(num_rows > 0);
479  column_data_ = std::make_unique<std::vector<ArrayDatum>>(num_rows);
480  column_buffer_ = std::make_unique<std::vector<
481  std::pair<size_t, typename ELEMENT_CONVERTER::ElementsBufferColumnPtr>>>(
482  num_rows);
483  }
const int8_t const int64_t * num_rows
CHECK(cgen_state)
std::unique_ptr< std::vector< std::pair< size_t, typename ELEMENT_CONVERTER::ElementsBufferColumnPtr > > > column_buffer_
std::unique_ptr< std::vector< ArrayDatum > > column_data_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename ELEMENT_CONVERTER >
void ArrayValueConverter< ELEMENT_CONVERTER >::convertToColumnarFormat ( size_t  row,
const TargetValue value 
)
inlineoverridevirtual

Implements TargetValueConverter.

Definition at line 485 of file TargetValueConvertersImpl.h.

References ArrayValueConverter< ELEMENT_CONVERTER >::ARRAY_VALUE_ACCESSOR, CHECK(), ArrayValueConverter< ELEMENT_CONVERTER >::column_buffer_, ArrayValueConverter< ELEMENT_CONVERTER >::element_converter_, and anonymous_namespace{TypedDataAccessors.h}::is_null().

485  {
486  const auto arrayValue =
487  checked_get<ArrayTargetValue>(row, value, ARRAY_VALUE_ACCESSOR);
488  CHECK(arrayValue);
489  if (arrayValue->is_initialized()) {
490  const auto& vec = arrayValue->get();
491  bool is_null = false;
492  if (vec.size()) {
493  typename ELEMENT_CONVERTER::ElementsBufferColumnPtr elementBuffer =
494  element_converter_->allocateColumnarBuffer(vec.size());
495 
496  int elementIndex = 0;
497  for (const auto& scalarValue : vec) {
498  element_converter_->convertElementToColumnarFormat(
499  elementIndex++, elementBuffer.get(), &scalarValue);
500  }
501 
502  column_buffer_->at(row) = {vec.size(), std::move(elementBuffer)};
503 
504  } else {
505  // Empty, not NULL
506  (*column_data_)[row] = ArrayDatum(0, nullptr, is_null, DoNothingDeleter());
507  }
508  } else {
509  // TODO: what does it mean if do_check_null_ is set to false and we get a NULL?
510  // CHECK(do_check_null_); // May need to check
511  bool is_null = true; // do_check_null_;
512  (*column_data_)[row] = ArrayDatum(0, nullptr, is_null, DoNothingDeleter());
513  (*column_data_)[row].is_null = is_null;
514  }
515  }
CHECK(cgen_state)
std::unique_ptr< ELEMENT_CONVERTER > element_converter_
bool is_null(const T &v, const SQLTypeInfo &t)
std::unique_ptr< std::vector< std::pair< size_t, typename ELEMENT_CONVERTER::ElementsBufferColumnPtr > > > column_buffer_
boost_variant_accessor< ArrayTargetValue > ARRAY_VALUE_ACCESSOR
std::conditional_t< isCudaCC(), DeviceArrayDatum, HostArrayDatum > ArrayDatum
Definition: sqltypes.h:122

+ Here is the call graph for this function:

template<typename ELEMENT_CONVERTER >
void ArrayValueConverter< ELEMENT_CONVERTER >::finalizeDataBlocksForInsertData ( )
inlineoverridevirtual

Reimplemented from TargetValueConverter.

Definition at line 517 of file TargetValueConvertersImpl.h.

References ArrayValueConverter< ELEMENT_CONVERTER >::column_buffer_, ArrayValueConverter< ELEMENT_CONVERTER >::column_data_, ArrayValueConverter< ELEMENT_CONVERTER >::data_finalized_, and ArrayValueConverter< ELEMENT_CONVERTER >::element_converter_.

Referenced by ArrayValueConverter< ELEMENT_CONVERTER >::addDataBlocksToInsertData().

517  {
518  if (!data_finalized_) {
519  element_converter_->processArrayBuffer(column_buffer_, column_data_.get());
520  data_finalized_ = true;
521  }
522  }
std::unique_ptr< ELEMENT_CONVERTER > element_converter_
std::unique_ptr< std::vector< std::pair< size_t, typename ELEMENT_CONVERTER::ElementsBufferColumnPtr > > > column_buffer_
std::unique_ptr< std::vector< ArrayDatum > > column_data_

+ Here is the caller graph for this function:

Member Data Documentation

template<typename ELEMENT_CONVERTER >
boost_variant_accessor<ArrayTargetValue> ArrayValueConverter< ELEMENT_CONVERTER >::ARRAY_VALUE_ACCESSOR
template<typename ELEMENT_CONVERTER >
std::unique_ptr< std::vector<std::pair<size_t, typename ELEMENT_CONVERTER::ElementsBufferColumnPtr> > > ArrayValueConverter< ELEMENT_CONVERTER >::column_buffer_
template<typename ELEMENT_CONVERTER >
bool ArrayValueConverter< ELEMENT_CONVERTER >::data_finalized_ = false
template<typename ELEMENT_CONVERTER >
bool ArrayValueConverter< ELEMENT_CONVERTER >::do_check_null_

Definition at line 457 of file TargetValueConvertersImpl.h.

template<typename ELEMENT_CONVERTER >
std::unique_ptr<ELEMENT_CONVERTER> ArrayValueConverter< ELEMENT_CONVERTER >::element_converter_
template<typename ELEMENT_CONVERTER >
SQLTypeInfo ArrayValueConverter< ELEMENT_CONVERTER >::element_type_info_

Definition at line 456 of file TargetValueConvertersImpl.h.


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