OmniSciDB  6686921089
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
foreign_storage::ParquetEncoder Class Referenceabstract

#include <ParquetEncoder.h>

+ Inheritance diagram for foreign_storage::ParquetEncoder:
+ Collaboration diagram for foreign_storage::ParquetEncoder:

Public Member Functions

 ParquetEncoder (Data_Namespace::AbstractBuffer *buffer)
 
virtual ~ParquetEncoder ()=default
 
virtual 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)=0
 
virtual std::shared_ptr
< ChunkMetadata
getRowGroupMetadata (const parquet::RowGroupMetaData *group_metadata, const int parquet_column_index, const SQLTypeInfo &column_type)
 

Static Protected Member Functions

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

Data_Namespace::AbstractBufferbuffer_
 

Detailed Description

Definition at line 28 of file ParquetEncoder.h.

Constructor & Destructor Documentation

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

Definition at line 30 of file ParquetEncoder.h.

30 : buffer_(buffer) {}
Data_Namespace::AbstractBuffer * buffer_
virtual foreign_storage::ParquetEncoder::~ParquetEncoder ( )
virtualdefault

Member Function Documentation

static std::shared_ptr<ChunkMetadata> foreign_storage::ParquetEncoder::createMetadata ( const SQLTypeInfo column_type)
inlinestaticprotected

Definition at line 62 of file ParquetEncoder.h.

References SQLTypeInfo::get_elem_type(), Data_Namespace::AbstractBuffer::initEncoder(), and SQLTypeInfo::is_array().

Referenced by getRowGroupMetadata(), and foreign_storage::TypedParquetInPlaceEncoder< V, V >::getRowGroupMetadata().

62  {
63  auto metadata = std::make_shared<ChunkMetadata>();
64  ForeignStorageBuffer buffer;
65  buffer.initEncoder(column_type.is_array() ? column_type.get_elem_type()
66  : column_type);
67  auto encoder = buffer.getEncoder();
68  encoder->getMetadata(metadata);
69  metadata->sqlType = column_type;
70  return metadata;
71  }
void initEncoder(const SQLTypeInfo &tmp_sql_type)
SQLTypeInfo get_elem_type() const
Definition: sqltypes.h:850
bool is_array() const
Definition: sqltypes.h:517

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual std::shared_ptr<ChunkMetadata> foreign_storage::ParquetEncoder::getRowGroupMetadata ( const parquet::RowGroupMetaData *  group_metadata,
const int  parquet_column_index,
const SQLTypeInfo column_type 
)
inlinevirtual

Reimplemented in foreign_storage::TypedParquetInPlaceEncoder< V, T, NullType >, foreign_storage::TypedParquetInPlaceEncoder< int64_t, int32_t, NullType >, foreign_storage::TypedParquetInPlaceEncoder< V, V >, foreign_storage::ParquetStringEncoder< V >, foreign_storage::ParquetArrayEncoder, and foreign_storage::ParquetFixedLengthArrayEncoder.

Definition at line 39 of file ParquetEncoder.h.

References createMetadata(), foreign_storage::validate_and_get_column_metadata_statistics(), and validateNullCount().

Referenced by foreign_storage::ParquetStringEncoder< V >::getRowGroupMetadata().

42  {
43  // update statistics
44  auto column_metadata = group_metadata->ColumnChunk(parquet_column_index);
45  auto stats = validate_and_get_column_metadata_statistics(column_metadata.get());
46  auto metadata = createMetadata(column_type);
47 
48  auto null_count = stats->null_count();
49  validateNullCount(group_metadata->schema()->Column(parquet_column_index)->name(),
50  null_count,
51  column_type);
52  metadata->chunkStats.has_nulls = null_count > 0;
53 
54  // update sizing
55  metadata->numElements = group_metadata->num_rows();
56  return metadata;
57  }
std::shared_ptr< parquet::Statistics > validate_and_get_column_metadata_statistics(const parquet::ColumnChunkMetaData *column_metadata)
static void validateNullCount(const std::string &parquet_column_name, int64_t null_count, const SQLTypeInfo &column_type)
static std::shared_ptr< ChunkMetadata > createMetadata(const SQLTypeInfo &column_type)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void foreign_storage::ParquetEncoder::throwNotNullViolation ( const std::string &  parquet_column_name)
inlinestaticprotected

Definition at line 73 of file ParquetEncoder.h.

Referenced by validateNullCount().

73  {
74  std::stringstream error_message;
75  error_message << "A null value was detected in Parquet column '"
76  << parquet_column_name << "' but OmniSci column is set to not null";
77  throw std::runtime_error(error_message.str());
78  }

+ Here is the caller graph for this function:

static void foreign_storage::ParquetEncoder::validateNullCount ( const std::string &  parquet_column_name,
int64_t  null_count,
const SQLTypeInfo column_type 
)
inlinestaticprotected

Definition at line 80 of file ParquetEncoder.h.

References SQLTypeInfo::get_notnull(), and throwNotNullViolation().

Referenced by getRowGroupMetadata(), and foreign_storage::TypedParquetInPlaceEncoder< V, V >::getRowGroupMetadata().

82  {
83  bool has_nulls = null_count > 0;
84  if (has_nulls && column_type.get_notnull()) {
85  throwNotNullViolation(parquet_column_name);
86  }
87  }
static void throwNotNullViolation(const std::string &parquet_column_name)
HOST DEVICE bool get_notnull() const
Definition: sqltypes.h:336

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation


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