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

#include <ParquetStringImportEncoder.h>

+ Inheritance diagram for foreign_storage::ParquetStringImportEncoder:
+ Collaboration diagram for foreign_storage::ParquetStringImportEncoder:

Public Member Functions

 ParquetStringImportEncoder (Data_Namespace::AbstractBuffer *buffer)
 
void appendData (const int16_t *def_levels, const int16_t *rep_levels, const int64_t values_read, const int64_t levels_read, int8_t *values) override
 
void appendDataTrackErrors (const int16_t *def_levels, const int16_t *rep_levels, const int64_t values_read, const int64_t levels_read, int8_t *values) override
 
void validateAndAppendData (const int16_t *def_levels, const int16_t *rep_levels, const int64_t values_read, const int64_t levels_read, int8_t *values, const SQLTypeInfo &column_type, InvalidRowGroupIndices &invalid_indices) override
 
void eraseInvalidIndicesInBuffer (const InvalidRowGroupIndices &invalid_indices) override
 
- Public Member Functions inherited from foreign_storage::ParquetEncoder
 ParquetEncoder (Data_Namespace::AbstractBuffer *buffer)
 
virtual ~ParquetEncoder ()=default
 
virtual std::shared_ptr
< ChunkMetadata
getRowGroupMetadata (const parquet::RowGroupMetaData *group_metadata, const int parquet_column_index, const SQLTypeInfo &column_type)
 
RejectedRowIndices getRejectedRowIndices () const
 
virtual void disableMetadataStatsValidation ()
 
virtual void initializeErrorTracking ()
 
virtual void initializeColumnType (const SQLTypeInfo &column_type)
 

Private Attributes

TypedParquetStorageBuffer
< std::string > * 
string_buffer_
 

Additional Inherited Members

- Static Protected Member Functions inherited from foreign_storage::ParquetEncoder
static std::shared_ptr
< ChunkMetadata
createMetadata (const SQLTypeInfo &column_type)
 
static void throwNotNullViolation (const std::string &parquet_column_name)
 
static void validateNullCount (const std::string &parquet_column_name, int64_t null_count, const SQLTypeInfo &column_type)
 
- Protected Attributes inherited from foreign_storage::ParquetEncoder
Data_Namespace::AbstractBufferbuffer_
 
bool is_error_tracking_enabled_
 
RejectedRowIndices invalid_indices_
 
size_t current_chunk_offset_
 
SQLTypeInfo column_type_
 
bool validate_metadata_stats_
 

Detailed Description

Definition at line 27 of file ParquetStringImportEncoder.h.

Constructor & Destructor Documentation

foreign_storage::ParquetStringImportEncoder::ParquetStringImportEncoder ( Data_Namespace::AbstractBuffer buffer)
inline

Definition at line 29 of file ParquetStringImportEncoder.h.

References CHECK, and string_buffer_.

30  : ParquetEncoder(buffer)
31  , string_buffer_(dynamic_cast<TypedParquetStorageBuffer<std::string>*>(buffer)) {
32  CHECK(string_buffer_); // verify dynamic_cast succeeded
33  }
ParquetEncoder(Data_Namespace::AbstractBuffer *buffer)
TypedParquetStorageBuffer< std::string > * string_buffer_
#define CHECK(condition)
Definition: Logger.h:291

Member Function Documentation

void foreign_storage::ParquetStringImportEncoder::appendData ( const int16_t *  def_levels,
const int16_t *  rep_levels,
const int64_t  values_read,
const int64_t  levels_read,
int8_t *  values 
)
inlineoverridevirtual

Implements foreign_storage::ParquetEncoder.

Definition at line 35 of file ParquetStringImportEncoder.h.

References foreign_storage::TypedParquetStorageBuffer< Type >::appendElement(), CHECK, foreign_storage::TypedParquetStorageBuffer< Type >::reserveNumElements(), and string_buffer_.

Referenced by validateAndAppendData().

39  {
40  auto parquet_data_ptr = reinterpret_cast<const parquet::ByteArray*>(values);
41  string_buffer_->reserveNumElements(levels_read);
42  for (int64_t i = 0, j = 0; i < levels_read; ++i) {
43  if (def_levels[i]) {
44  CHECK(j < values_read);
45  auto& byte_array = parquet_data_ptr[j++];
47  std::string{reinterpret_cast<const char*>(byte_array.ptr), byte_array.len});
48  } else {
49  string_buffer_->appendElement(""); // empty strings encode nulls
50  }
51  }
52  }
TypedParquetStorageBuffer< std::string > * string_buffer_
#define CHECK(condition)
Definition: Logger.h:291
void reserveNumElements(size_t additional_num_elements)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void foreign_storage::ParquetStringImportEncoder::appendDataTrackErrors ( const int16_t *  def_levels,
const int16_t *  rep_levels,
const int64_t  values_read,
const int64_t  levels_read,
int8_t *  values 
)
inlineoverridevirtual

Implements foreign_storage::ParquetEncoder.

Definition at line 54 of file ParquetStringImportEncoder.h.

References UNREACHABLE.

58  {
59  UNREACHABLE() << "unexpected call to appendDataTrackErrors from unsupported encoder";
60  }
#define UNREACHABLE()
Definition: Logger.h:338
void foreign_storage::ParquetStringImportEncoder::eraseInvalidIndicesInBuffer ( const InvalidRowGroupIndices invalid_indices)
inlineoverridevirtual

Implements foreign_storage::ParquetImportEncoder.

Definition at line 72 of file ParquetStringImportEncoder.h.

References foreign_storage::TypedParquetStorageBuffer< Type >::eraseInvalidData(), and string_buffer_.

73  {
74  if (invalid_indices.empty()) {
75  return;
76  }
77  string_buffer_->eraseInvalidData(invalid_indices);
78  }
void eraseInvalidData(const FindContainer &invalid_indices)
TypedParquetStorageBuffer< std::string > * string_buffer_

+ Here is the call graph for this function:

void foreign_storage::ParquetStringImportEncoder::validateAndAppendData ( const int16_t *  def_levels,
const int16_t *  rep_levels,
const int64_t  values_read,
const int64_t  levels_read,
int8_t *  values,
const SQLTypeInfo column_type,
InvalidRowGroupIndices invalid_indices 
)
inlineoverridevirtual

Implements foreign_storage::ParquetImportEncoder.

Definition at line 62 of file ParquetStringImportEncoder.h.

References appendData().

68  {
69  appendData(def_levels, rep_levels, values_read, levels_read, values);
70  }
void appendData(const int16_t *def_levels, const int16_t *rep_levels, const int64_t values_read, const int64_t levels_read, int8_t *values) override

+ Here is the call graph for this function:

Member Data Documentation

TypedParquetStorageBuffer<std::string>* foreign_storage::ParquetStringImportEncoder::string_buffer_
private

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