OmniSciDB  6686921089
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ChunkMetadata Struct Reference

#include <ChunkMetadata.h>

+ Collaboration diagram for ChunkMetadata:

Public Member Functions

std::string dump () const
 
std::string toString () const
 
 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 61 of file ChunkMetadata.h.

65  : sqlType(sql_type)
66  , numBytes(num_bytes)
67  , numElements(num_elements)
68  , 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 70 of file ChunkMetadata.h.

70 {}

Member Function Documentation

std::string ChunkMetadata::dump ( ) const
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.

Referenced by toString().

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:392
bool has_nulls
Definition: ChunkMetadata.h:28
int32_t intval
Definition: sqltypes.h:214
std::string to_string(char const *&&v)
ChunkStats chunkStats
Definition: ChunkMetadata.h:35
std::string get_type_name() const
Definition: sqltypes.h:432
SQLTypeInfo get_elem_type() const
Definition: sqltypes.h:850
SQLTypeInfo sqlType
Definition: ChunkMetadata.h:32
bool is_array() const
Definition: sqltypes.h:517
size_t numElements
Definition: ChunkMetadata.h:34

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 73 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(), and foreign_storage::ParquetStringEncoder< V >::updateMetadataStats().

73  {
74  chunkStats.has_nulls = has_nulls;
75  switch (sqlType.get_type()) {
76  case kBOOLEAN: {
79  break;
80  }
81  case kTINYINT: {
84  break;
85  }
86  case kSMALLINT: {
89  break;
90  }
91  case kINT: {
92  chunkStats.min.intval = min;
93  chunkStats.max.intval = max;
94  break;
95  }
96  case kBIGINT:
97  case kNUMERIC:
98  case kDECIMAL: {
99  chunkStats.min.bigintval = min;
100  chunkStats.max.bigintval = max;
101  break;
102  }
103  case kTIME:
104  case kTIMESTAMP:
105  case kDATE: {
106  chunkStats.min.bigintval = min;
107  chunkStats.max.bigintval = max;
108  break;
109  }
110  case kFLOAT: {
111  chunkStats.min.floatval = min;
112  chunkStats.max.floatval = max;
113  break;
114  }
115  case kDOUBLE: {
116  chunkStats.min.doubleval = min;
117  chunkStats.max.doubleval = max;
118  break;
119  }
120  case kVARCHAR:
121  case kCHAR:
122  case kTEXT:
124  chunkStats.min.intval = min;
125  chunkStats.max.intval = max;
126  }
127  break;
128  default: {
129  break;
130  }
131  }
132  }
int8_t tinyintval
Definition: sqltypes.h:212
Definition: sqltypes.h:49
bool has_nulls
Definition: ChunkMetadata.h:28
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:329
int32_t intval
Definition: sqltypes.h:214
ChunkStats chunkStats
Definition: ChunkMetadata.h:35
float floatval
Definition: sqltypes.h:216
int64_t bigintval
Definition: sqltypes.h:215
int16_t smallintval
Definition: sqltypes.h:213
Definition: sqltypes.h:52
Definition: sqltypes.h:53
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:337
Definition: sqltypes.h:41
Definition: sqltypes.h:45
SQLTypeInfo sqlType
Definition: ChunkMetadata.h:32
double doubleval
Definition: sqltypes.h:217

+ 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 134 of file ChunkMetadata.h.

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

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

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

140  {
141  return sqlType == that.sqlType && numBytes == that.numBytes &&
142  numElements == that.numElements &&
144  that.chunkStats.min,
147  that.chunkStats.max,
150  }
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:342
SQLTypeInfo get_elem_type() const
Definition: sqltypes.h:850
SQLTypeInfo sqlType
Definition: ChunkMetadata.h:32
bool is_array() const
Definition: sqltypes.h:517
size_t numElements
Definition: ChunkMetadata.h:34

+ Here is the call graph for this function:

std::string ChunkMetadata::toString ( ) const
inline

Definition at line 59 of file ChunkMetadata.h.

References dump().

59 { return dump(); }
std::string dump() const
Definition: ChunkMetadata.h:37

+ 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: