OmniSciDB  16c4e035a1
 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 27 of file ParquetEncoder.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file ParquetEncoder.h.

29 : 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 61 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().

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

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

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

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

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

Referenced by validateNullCount().

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

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

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

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

81  {
82  bool has_nulls = null_count > 0;
83  if (has_nulls && column_type.get_notnull()) {
84  throwNotNullViolation(parquet_column_name);
85  }
86  }
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: