OmniSciDB  471d68cefb
 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 36 of file ParquetDataWrapper.cpp.

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

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function: