OmniSciDB  a5dc49c757
 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 38 of file ParquetDataWrapper.cpp.

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

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

39  {
40  CHECK(reduce_to->sqlType == reduce_from->sqlType);
41  reduce_to->numBytes += reduce_from->numBytes;
42  reduce_to->numElements += reduce_from->numElements;
43  reduce_to->chunkStats.has_nulls |= reduce_from->chunkStats.has_nulls;
44 
45  auto column_type = reduce_to->sqlType;
46  column_type = column_type.is_array() ? column_type.get_elem_type() : column_type;
47 
48  // metadata reducution is done at metadata scan time, both string & geometry
49  // columns have no valid stats to reduce beyond `has_nulls`
50  if (column_type.is_string() || column_type.is_geometry()) {
51  // Reset to invalid range, as formerly valid metadata
52  // needs to be invalidated during an append for these types
53  reduce_to->chunkStats.max = reduce_from->chunkStats.max;
54  reduce_to->chunkStats.min = reduce_from->chunkStats.min;
55  return;
56  }
57 
58  ForeignStorageBuffer buffer_to;
59  buffer_to.initEncoder(column_type);
60  auto encoder_to = buffer_to.getEncoder();
61  encoder_to->resetChunkStats(reduce_to->chunkStats);
62 
63  ForeignStorageBuffer buffer_from;
64  buffer_from.initEncoder(column_type);
65  auto encoder_from = buffer_from.getEncoder();
66  encoder_from->resetChunkStats(reduce_from->chunkStats);
67 
68  encoder_to->reduceStats(*encoder_from);
69  auto updated_metadata = std::make_shared<ChunkMetadata>();
70  encoder_to->getMetadata(updated_metadata);
71  reduce_to->chunkStats = updated_metadata->chunkStats;
72 }
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:291

+ Here is the call graph for this function:

+ Here is the caller graph for this function: