OmniSciDB  c0231cc57d
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
foreign_storage::anonymous_namespace{ParquetDataWrapper.cpp} Namespace Reference

Functions

void reduce_metadata (std::shared_ptr< ChunkMetadata > reduce_to, std::shared_ptr< ChunkMetadata > reduce_from)
 

Function Documentation

void foreign_storage::anonymous_namespace{ParquetDataWrapper.cpp}::reduce_metadata ( std::shared_ptr< ChunkMetadata reduce_to,
std::shared_ptr< ChunkMetadata reduce_from 
)

Definition at line 39 of file ParquetDataWrapper.cpp.

References CHECK, Data_Namespace::AbstractBuffer::getEncoder(), Data_Namespace::AbstractBuffer::initEncoder(), and Encoder::resetChunkStats().

Referenced by foreign_storage::ParquetDataWrapper::updateChunkMetadataForFragment().

40  {
41  CHECK(reduce_to->sqlType == reduce_from->sqlType);
42  reduce_to->numBytes += reduce_from->numBytes;
43  reduce_to->numElements += reduce_from->numElements;
44  reduce_to->chunkStats.has_nulls |= reduce_from->chunkStats.has_nulls;
45 
46  auto column_type = reduce_to->sqlType;
47  column_type = column_type.is_array() ? column_type.get_elem_type() : column_type;
48 
49  // metadata reducution is done at metadata scan time, both string & geometry
50  // columns have no valid stats to reduce beyond `has_nulls`
51  if (column_type.is_string() || column_type.is_geometry()) {
52  // Reset to invalid range, as formerly valid metadata
53  // needs to be invalidated during an append for these types
54  reduce_to->chunkStats.max = reduce_from->chunkStats.max;
55  reduce_to->chunkStats.min = reduce_from->chunkStats.min;
56  return;
57  }
58 
59  ForeignStorageBuffer buffer_to;
60  buffer_to.initEncoder(column_type);
61  auto encoder_to = buffer_to.getEncoder();
62  encoder_to->resetChunkStats(reduce_to->chunkStats);
63 
64  ForeignStorageBuffer buffer_from;
65  buffer_from.initEncoder(column_type);
66  auto encoder_from = buffer_from.getEncoder();
67  encoder_from->resetChunkStats(reduce_from->chunkStats);
68 
69  encoder_to->reduceStats(*encoder_from);
70  auto updated_metadata = std::make_shared<ChunkMetadata>();
71  encoder_to->getMetadata(updated_metadata);
72  reduce_to->chunkStats = updated_metadata->chunkStats;
73 }
void initEncoder(const SQLTypeInfo &tmp_sql_type)
virtual bool resetChunkStats(const ChunkStats &)
: Reset chunk level stats (min, max, nulls) using new values from the argument.
Definition: Encoder.h:274
#define CHECK(condition)
Definition: Logger.h:222

+ Here is the call graph for this function:

+ Here is the caller graph for this function: