OmniSciDB  fe05a0c208
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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, const bool is_last_batch, 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 63 of file ParquetEncoder.h.

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

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

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

+ 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 >, foreign_storage::TypedParquetInPlaceEncoder< V, V >, foreign_storage::TypedParquetInPlaceEncoder< int64_t, int32_t >, foreign_storage::ParquetStringEncoder< V >, foreign_storage::ParquetArrayEncoder, and foreign_storage::ParquetFixedLengthArrayEncoder.

Definition at line 40 of file ParquetEncoder.h.

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

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

43  {
44  // update statistics
45  auto column_metadata = group_metadata->ColumnChunk(parquet_column_index);
46  auto stats = validate_and_get_column_metadata_statistics(column_metadata.get());
47  auto metadata = createMetadata(column_type);
48 
49  auto null_count = stats->null_count();
50  validateNullCount(group_metadata->schema()->Column(parquet_column_index)->name(),
51  null_count,
52  column_type);
53  metadata->chunkStats.has_nulls = null_count > 0;
54 
55  // update sizing
56  metadata->numElements = group_metadata->num_rows();
57  return metadata;
58  }
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 74 of file ParquetEncoder.h.

Referenced by validateNullCount().

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

+ 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 81 of file ParquetEncoder.h.

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

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

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

+ 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: