OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
anonymous_namespace{StorageIOFacility.h} Namespace Reference

Functions

bool is_chunk_min_max_updated (const Fragmenter_Namespace::ChunkUpdateStats &update_stats, int64_t min, int64_t max)
 
bool is_chunk_min_max_updated (const Fragmenter_Namespace::ChunkUpdateStats &update_stats, double min, double max)
 
bool should_recompute_metadata (const std::optional< Fragmenter_Namespace::ChunkUpdateStats > &update_stats)
 

Function Documentation

bool anonymous_namespace{StorageIOFacility.h}::is_chunk_min_max_updated ( const Fragmenter_Namespace::ChunkUpdateStats update_stats,
int64_t  min,
int64_t  max 
)

Checks to see if any of the updated values match the current min/max stat for the chunk.

Definition at line 39 of file StorageIOFacility.h.

References Fragmenter_Namespace::UpdateValuesStats::max_int64t, Fragmenter_Namespace::UpdateValuesStats::min_int64t, Fragmenter_Namespace::ChunkUpdateStats::new_values_stats, and Fragmenter_Namespace::ChunkUpdateStats::old_values_stats.

Referenced by should_recompute_metadata().

41  {
42  if (update_stats.old_values_stats.min_int64t <
43  update_stats.new_values_stats.min_int64t &&
44  update_stats.old_values_stats.min_int64t == min) {
45  return true;
46  }
47  if (update_stats.old_values_stats.max_int64t >
48  update_stats.new_values_stats.max_int64t &&
49  update_stats.old_values_stats.max_int64t == max) {
50  return true;
51  }
52  return false;
53 }

+ Here is the caller graph for this function:

bool anonymous_namespace{StorageIOFacility.h}::is_chunk_min_max_updated ( const Fragmenter_Namespace::ChunkUpdateStats update_stats,
double  min,
double  max 
)
bool anonymous_namespace{StorageIOFacility.h}::should_recompute_metadata ( const std::optional< Fragmenter_Namespace::ChunkUpdateStats > &  update_stats)

Definition at line 71 of file StorageIOFacility.h.

References CHECK, extract_max_stat_int_type(), extract_min_stat_int_type(), g_enable_auto_metadata_update, is_chunk_min_max_updated(), kDOUBLE, kFLOAT, and UNREACHABLE.

Referenced by StorageIOFacility::yieldUpdateCallback().

72  {
73  if (!g_enable_auto_metadata_update || !update_stats.has_value()) {
74  return false;
75  }
76 
77  CHECK(update_stats->chunk);
78  CHECK(update_stats->chunk->getBuffer());
79  CHECK(update_stats->chunk->getBuffer()->getEncoder());
80 
81  auto chunk_metadata = std::make_shared<ChunkMetadata>();
82  update_stats->chunk->getBuffer()->getEncoder()->getMetadata(chunk_metadata);
83  auto cd = update_stats.value().chunk->getColumnDesc();
84  if (cd->columnType.is_fp()) {
85  double min, max;
86  if (cd->columnType.get_type() == kDOUBLE) {
87  min = chunk_metadata->chunkStats.min.doubleval;
88  max = chunk_metadata->chunkStats.max.doubleval;
89  } else if (cd->columnType.get_type() == kFLOAT) {
90  min = chunk_metadata->chunkStats.min.floatval;
91  max = chunk_metadata->chunkStats.max.floatval;
92  } else {
93  min = 0; // resolve compiler warning about uninitialized variables
94  max = -1;
95  UNREACHABLE();
96  }
97  return is_chunk_min_max_updated(update_stats.value(), min, max);
98  } else {
99  auto min = extract_min_stat_int_type(chunk_metadata->chunkStats, cd->columnType);
100  auto max = extract_max_stat_int_type(chunk_metadata->chunkStats, cd->columnType);
101  return is_chunk_min_max_updated(update_stats.value(), min, max);
102  }
103 }
void update_stats(Encoder *encoder, const SQLTypeInfo &column_type, DataBlockPtr data_block, const size_t row_count)
bool is_chunk_min_max_updated(const Fragmenter_Namespace::ChunkUpdateStats &update_stats, int64_t min, int64_t max)
#define UNREACHABLE()
Definition: Logger.h:338
bool g_enable_auto_metadata_update
int64_t extract_max_stat_int_type(const ChunkStats &stats, const SQLTypeInfo &ti)
int64_t extract_min_stat_int_type(const ChunkStats &stats, const SQLTypeInfo &ti)
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call graph for this function:

+ Here is the caller graph for this function: