OmniSciDB  94e8789169
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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::ChunkMetadata ( const SQLTypeInfo sql_type,
const size_t  num_bytes,
const size_t  num_elements,
const ChunkStats chunk_stats 
)
inline

Definition at line 59 of file ChunkMetadata.h.

63  : sqlType(sql_type)
64  , numBytes(num_bytes)
65  , numElements(num_elements)
66  , chunkStats(chunk_stats) {}
ChunkStats chunkStats
Definition: ChunkMetadata.h:35
SQLTypeInfo sqlType
Definition: ChunkMetadata.h:32
size_t numElements
Definition: ChunkMetadata.h:34
ChunkMetadata::ChunkMetadata ( )
inline

Definition at line 68 of file ChunkMetadata.h.

68 {}

Member Function Documentation

std::string ChunkMetadata::dump ( )
inline

Definition at line 37 of file ChunkMetadata.h.

References chunkStats, DatumToString(), SQLTypeInfo::get_elem_type(), SQLTypeInfo::get_type_name(), ChunkStats::has_nulls, Datum::intval, SQLTypeInfo::is_array(), kENCODING_NONE, ChunkStats::max, ChunkStats::min, numBytes, numElements, sqlType, to_string(), and run_benchmark_import::type.

37  {
39  // Unencoded strings have no min/max.
40  if (type.is_string() && type.get_compression() == kENCODING_NONE) {
41  return "type: " + sqlType.get_type_name() + " numBytes: " + to_string(numBytes) +
42  " numElements " + to_string(numElements) + " min: <invalid>" +
43  " max: <invalid>" + " has_nulls: " + to_string(chunkStats.has_nulls);
44  } else if (type.is_string()) {
45  return "type: " + sqlType.get_type_name() + " numBytes: " + to_string(numBytes) +
46  " numElements " + to_string(numElements) +
47  " min: " + to_string(chunkStats.min.intval) +
48  " max: " + to_string(chunkStats.max.intval) +
49  " has_nulls: " + to_string(chunkStats.has_nulls);
50  } else {
51  return "type: " + sqlType.get_type_name() + " numBytes: " + to_string(numBytes) +
52  " numElements " + to_string(numElements) +
53  " min: " + DatumToString(chunkStats.min, type) +
54  " max: " + DatumToString(chunkStats.max, type) +
55  " has_nulls: " + to_string(chunkStats.has_nulls);
56  }
57  }
std::string DatumToString(Datum d, const SQLTypeInfo &ti)
Definition: Datum.cpp:240
bool has_nulls
Definition: ChunkMetadata.h:28
int32_t intval
Definition: sqltypes.h:205
std::string to_string(char const *&&v)
ChunkStats chunkStats
Definition: ChunkMetadata.h:35
std::string get_type_name() const
Definition: sqltypes.h:414
SQLTypeInfo get_elem_type() const
Definition: sqltypes.h:697
SQLTypeInfo sqlType
Definition: ChunkMetadata.h:32
bool is_array() const
Definition: sqltypes.h:486
size_t numElements
Definition: ChunkMetadata.h:34

+ Here is the call graph for this function:

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

Definition at line 71 of file ChunkMetadata.h.

References Datum::bigintval, chunkStats, 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, sqlType, and Datum::tinyintval.

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

71  {
72  chunkStats.has_nulls = has_nulls;
73  switch (sqlType.get_type()) {
74  case kBOOLEAN: {
77  break;
78  }
79  case kTINYINT: {
82  break;
83  }
84  case kSMALLINT: {
87  break;
88  }
89  case kINT: {
90  chunkStats.min.intval = min;
91  chunkStats.max.intval = max;
92  break;
93  }
94  case kBIGINT:
95  case kNUMERIC:
96  case kDECIMAL: {
97  chunkStats.min.bigintval = min;
98  chunkStats.max.bigintval = max;
99  break;
100  }
101  case kTIME:
102  case kTIMESTAMP:
103  case kDATE: {
104  chunkStats.min.bigintval = min;
105  chunkStats.max.bigintval = max;
106  break;
107  }
108  case kFLOAT: {
109  chunkStats.min.floatval = min;
110  chunkStats.max.floatval = max;
111  break;
112  }
113  case kDOUBLE: {
114  chunkStats.min.doubleval = min;
115  chunkStats.max.doubleval = max;
116  break;
117  }
118  case kVARCHAR:
119  case kCHAR:
120  case kTEXT:
122  chunkStats.min.intval = min;
123  chunkStats.max.intval = max;
124  }
125  break;
126  default: {
127  break;
128  }
129  }
130  }
int8_t tinyintval
Definition: sqltypes.h:203
Definition: sqltypes.h:48
bool has_nulls
Definition: ChunkMetadata.h:28
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:311
int32_t intval
Definition: sqltypes.h:205
ChunkStats chunkStats
Definition: ChunkMetadata.h:35
float floatval
Definition: sqltypes.h:207
int64_t bigintval
Definition: sqltypes.h:206
int16_t smallintval
Definition: sqltypes.h:204
Definition: sqltypes.h:51
Definition: sqltypes.h:52
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:319
Definition: sqltypes.h:40
Definition: sqltypes.h:44
SQLTypeInfo sqlType
Definition: ChunkMetadata.h:32
double doubleval
Definition: sqltypes.h:208

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 132 of file ChunkMetadata.h.

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

132  {
133  chunkStats.has_nulls = has_nulls;
134  chunkStats.min = min;
135  chunkStats.max = max;
136  }
bool has_nulls
Definition: ChunkMetadata.h:28
ChunkStats chunkStats
Definition: ChunkMetadata.h:35
bool ChunkMetadata::operator== ( const ChunkMetadata that) const
inline

Definition at line 138 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.

138  {
139  return sqlType == that.sqlType && numBytes == that.numBytes &&
140  numElements == that.numElements &&
142  that.chunkStats.min,
145  that.chunkStats.max,
148  }
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:190
SQLTypeInfo get_elem_type() const
Definition: sqltypes.h:697
SQLTypeInfo sqlType
Definition: ChunkMetadata.h:32
bool is_array() const
Definition: sqltypes.h:486
size_t numElements
Definition: ChunkMetadata.h:34

+ Here is the call graph for this function:

Member Data Documentation

size_t ChunkMetadata::numBytes
size_t ChunkMetadata::numElements

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