OmniSciDB  dfae7c3b14
ChunkMetadata Struct Reference

#include <ChunkMetadata.h>

+ Collaboration diagram for ChunkMetadata:

Public Member Functions

std::string dump ()
 
 ChunkMetadata (const SQLTypeInfo &sql_type, const size_t num_bytes, const size_t num_elements, const ChunkStats &chunk_stats)
 
 ChunkMetadata ()
 
template<typename T >
void fillChunkStats (const T min, const T max, const bool has_nulls)
 
void fillChunkStats (const Datum min, const Datum max, const bool has_nulls)
 
bool operator== (const ChunkMetadata &that) const
 

Public Attributes

SQLTypeInfo sqlType
 
size_t numBytes
 
size_t numElements
 
ChunkStats chunkStats
 

Detailed Description

Definition at line 31 of file ChunkMetadata.h.

Constructor & Destructor Documentation

◆ ChunkMetadata() [1/2]

ChunkMetadata::ChunkMetadata ( const SQLTypeInfo sql_type,
const size_t  num_bytes,
const size_t  num_elements,
const ChunkStats chunk_stats 
)
inline

Definition at line 44 of file ChunkMetadata.h.

48  : sqlType(sql_type)
49  , numBytes(num_bytes)
50  , numElements(num_elements)
51  , chunkStats(chunk_stats) {}
ChunkStats chunkStats
Definition: ChunkMetadata.h:35
SQLTypeInfo sqlType
Definition: ChunkMetadata.h:32
size_t numElements
Definition: ChunkMetadata.h:34

◆ ChunkMetadata() [2/2]

ChunkMetadata::ChunkMetadata ( )
inline

Definition at line 53 of file ChunkMetadata.h.

53 {}

Member Function Documentation

◆ dump()

std::string ChunkMetadata::dump ( )
inline

Definition at line 37 of file ChunkMetadata.h.

References DatumToString(), ChunkStats::has_nulls, ChunkStats::max, ChunkStats::min, and to_string().

37  {
38  return "numBytes: " + to_string(numBytes) + " numElements " + to_string(numElements) +
39  " min: " + DatumToString(chunkStats.min, sqlType) +
40  " max: " + DatumToString(chunkStats.max, sqlType) +
41  " has_nulls: " + to_string(chunkStats.has_nulls);
42  }
std::string DatumToString(Datum d, const SQLTypeInfo &ti)
Definition: Datum.cpp:239
bool has_nulls
Definition: ChunkMetadata.h:28
std::string to_string(char const *&&v)
ChunkStats chunkStats
Definition: ChunkMetadata.h:35
SQLTypeInfo sqlType
Definition: ChunkMetadata.h:32
size_t numElements
Definition: ChunkMetadata.h:34
+ Here is the call graph for this function:

◆ fillChunkStats() [1/2]

template<typename T >
void ChunkMetadata::fillChunkStats ( const T  min,
const T  max,
const bool  has_nulls 
)
inline

Definition at line 56 of file ChunkMetadata.h.

References Datum::bigintval, Datum::doubleval, Datum::floatval, SQLTypeInfo::get_compression(), SQLTypeInfo::get_type(), ChunkStats::has_nulls, Datum::intval, kBIGINT, kBOOLEAN, kCHAR, kDATE, kDECIMAL, kDOUBLE, kENCODING_DICT, kFLOAT, kINT, kNUMERIC, kSMALLINT, kTEXT, kTIME, kTIMESTAMP, kTINYINT, kVARCHAR, ChunkStats::max, ChunkStats::min, Datum::smallintval, and Datum::tinyintval.

Referenced by anonymous_namespace{TableOptimizer.cpp}::set_metadata_from_results().

56  {
57  chunkStats.has_nulls = has_nulls;
58  switch (sqlType.get_type()) {
59  case kBOOLEAN: {
62  break;
63  }
64  case kTINYINT: {
67  break;
68  }
69  case kSMALLINT: {
72  break;
73  }
74  case kINT: {
75  chunkStats.min.intval = min;
76  chunkStats.max.intval = max;
77  break;
78  }
79  case kBIGINT:
80  case kNUMERIC:
81  case kDECIMAL: {
82  chunkStats.min.bigintval = min;
83  chunkStats.max.bigintval = max;
84  break;
85  }
86  case kTIME:
87  case kTIMESTAMP:
88  case kDATE: {
89  chunkStats.min.bigintval = min;
90  chunkStats.max.bigintval = max;
91  break;
92  }
93  case kFLOAT: {
94  chunkStats.min.floatval = min;
95  chunkStats.max.floatval = max;
96  break;
97  }
98  case kDOUBLE: {
99  chunkStats.min.doubleval = min;
100  chunkStats.max.doubleval = max;
101  break;
102  }
103  case kVARCHAR:
104  case kCHAR:
105  case kTEXT:
107  chunkStats.min.intval = min;
108  chunkStats.max.intval = max;
109  }
110  break;
111  default: {
112  break;
113  }
114  }
115  }
int8_t tinyintval
Definition: sqltypes.h:135
Definition: sqltypes.h:51
bool has_nulls
Definition: ChunkMetadata.h:28
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:267
int32_t intval
Definition: sqltypes.h:137
ChunkStats chunkStats
Definition: ChunkMetadata.h:35
float floatval
Definition: sqltypes.h:139
int64_t bigintval
Definition: sqltypes.h:138
int16_t smallintval
Definition: sqltypes.h:136
Definition: sqltypes.h:54
Definition: sqltypes.h:55
Definition: sqltypes.h:43
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:259
Definition: sqltypes.h:47
SQLTypeInfo sqlType
Definition: ChunkMetadata.h:32
double doubleval
Definition: sqltypes.h:140
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillChunkStats() [2/2]

void ChunkMetadata::fillChunkStats ( const Datum  min,
const Datum  max,
const bool  has_nulls 
)
inline

Definition at line 117 of file ChunkMetadata.h.

References ChunkStats::has_nulls, ChunkStats::max, and ChunkStats::min.

117  {
118  chunkStats.has_nulls = has_nulls;
119  chunkStats.min = min;
120  chunkStats.max = max;
121  }
bool has_nulls
Definition: ChunkMetadata.h:28
ChunkStats chunkStats
Definition: ChunkMetadata.h:35

◆ operator==()

bool ChunkMetadata::operator== ( const ChunkMetadata that) const
inline

Definition at line 123 of file ChunkMetadata.h.

References chunkStats, DatumEqual(), SQLTypeInfo::get_elem_type(), ChunkStats::has_nulls, SQLTypeInfo::is_array(), ChunkStats::max, ChunkStats::min, numBytes, numElements, and sqlType.

123  {
124  return sqlType == that.sqlType && numBytes == that.numBytes &&
125  numElements == that.numElements &&
127  that.chunkStats.min,
130  that.chunkStats.max,
133  }
bool is_array() const
Definition: sqltypes.h:425
bool has_nulls
Definition: ChunkMetadata.h:28
ChunkStats chunkStats
Definition: ChunkMetadata.h:35
bool DatumEqual(const Datum a, const Datum b, const SQLTypeInfo &ti)
Definition: Datum.cpp:189
SQLTypeInfo get_elem_type() const
Definition: sqltypes.h:624
SQLTypeInfo sqlType
Definition: ChunkMetadata.h:32
size_t numElements
Definition: ChunkMetadata.h:34
+ Here is the call graph for this function:

Member Data Documentation

◆ chunkStats

◆ numBytes

size_t ChunkMetadata::numBytes

◆ numElements

size_t ChunkMetadata::numElements

◆ sqlType


The documentation for this struct was generated from the following file: