OmniSciDB  a5dc49c757
 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

 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
 
bool isPlaceholder () const
 

Public Attributes

SQLTypeInfo sqlType
 
size_t numBytes
 
size_t numElements
 
ChunkStats chunkStats
 

Detailed Description

Definition at line 33 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 39 of file ChunkMetadata.h.

43  : sqlType(sql_type)
44  , numBytes(num_bytes)
45  , numElements(num_elements)
46  , chunkStats(chunk_stats) {}
ChunkStats chunkStats
Definition: ChunkMetadata.h:37
SQLTypeInfo sqlType
Definition: ChunkMetadata.h:34
size_t numElements
Definition: ChunkMetadata.h:36
ChunkMetadata::ChunkMetadata ( )
inline

Definition at line 48 of file ChunkMetadata.h.

48 {}

Member Function Documentation

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

Definition at line 51 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().

51  {
52  chunkStats.has_nulls = has_nulls;
53  switch (sqlType.get_type()) {
54  case kBOOLEAN: {
57  break;
58  }
59  case kTINYINT: {
62  break;
63  }
64  case kSMALLINT: {
67  break;
68  }
69  case kINT: {
70  chunkStats.min.intval = min;
71  chunkStats.max.intval = max;
72  break;
73  }
74  case kBIGINT:
75  case kNUMERIC:
76  case kDECIMAL: {
77  chunkStats.min.bigintval = min;
78  chunkStats.max.bigintval = max;
79  break;
80  }
81  case kTIME:
82  case kTIMESTAMP:
83  case kDATE: {
84  chunkStats.min.bigintval = min;
85  chunkStats.max.bigintval = max;
86  break;
87  }
88  case kFLOAT: {
89  chunkStats.min.floatval = min;
90  chunkStats.max.floatval = max;
91  break;
92  }
93  case kDOUBLE: {
94  chunkStats.min.doubleval = min;
95  chunkStats.max.doubleval = max;
96  break;
97  }
98  case kVARCHAR:
99  case kCHAR:
100  case kTEXT:
102  chunkStats.min.intval = min;
103  chunkStats.max.intval = max;
104  }
105  break;
106  default: {
107  break;
108  }
109  }
110  }
int8_t tinyintval
Definition: Datum.h:73
Definition: sqltypes.h:76
bool has_nulls
Definition: ChunkMetadata.h:30
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:391
int32_t intval
Definition: Datum.h:75
ChunkStats chunkStats
Definition: ChunkMetadata.h:37
float floatval
Definition: Datum.h:77
int64_t bigintval
Definition: Datum.h:76
int16_t smallintval
Definition: Datum.h:74
Definition: sqltypes.h:79
Definition: sqltypes.h:80
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:399
Definition: sqltypes.h:68
Definition: sqltypes.h:72
SQLTypeInfo sqlType
Definition: ChunkMetadata.h:34
double doubleval
Definition: Datum.h:78

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

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

112  {
113  chunkStats.has_nulls = has_nulls;
114  chunkStats.min = min;
115  chunkStats.max = max;
116  }
bool has_nulls
Definition: ChunkMetadata.h:30
ChunkStats chunkStats
Definition: ChunkMetadata.h:37
bool ChunkMetadata::isPlaceholder ( ) const
inline

Definition at line 130 of file ChunkMetadata.h.

References chunkStats, decimal_to_int_type(), extract_int_type_from_datum(), SQLTypeInfo::get_compression(), SQLTypeInfo::get_type(), ChunkStats::has_nulls, SQLTypeInfo::is_decimal(), kBIGINT, kBOOLEAN, kCHAR, kDATE, kENCODING_DICT, kINT, kSMALLINT, kTEXT, kTIME, kTIMESTAMP, kTINYINT, kVARCHAR, ChunkStats::max, ChunkStats::min, numElements, sqlType, and run_benchmark_import::type.

130  {
131  // Currently needed because a lot of our Datum operations (in this case
132  // extract_int_type_from_datum()) are not safe for all types.
133  const auto type =
135  switch (type) {
136  case kCHAR:
137  case kVARCHAR:
138  case kTEXT:
140  return false;
141  }
142  case kBOOLEAN:
143  case kTINYINT:
144  case kSMALLINT:
145  case kINT:
146  case kBIGINT:
147  case kTIME:
148  case kTIMESTAMP:
149  case kDATE: {
152  return (numElements > 0 && !chunkStats.has_nulls && (min > max));
153  }
154  default:
155  return false;
156  }
157  return false;
158  }
Definition: sqltypes.h:76
bool has_nulls
Definition: ChunkMetadata.h:30
ChunkStats chunkStats
Definition: ChunkMetadata.h:37
int64_t extract_int_type_from_datum(const Datum datum, const SQLTypeInfo &ti)
Definition: Datum.cpp:523
SQLTypes decimal_to_int_type(const SQLTypeInfo &ti)
Definition: Datum.cpp:561
Definition: sqltypes.h:79
Definition: sqltypes.h:80
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:399
Definition: sqltypes.h:68
Definition: sqltypes.h:72
bool is_decimal() const
Definition: sqltypes.h:570
SQLTypeInfo sqlType
Definition: ChunkMetadata.h:34
size_t numElements
Definition: ChunkMetadata.h:36

+ Here is the call graph for this function:

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

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

118  {
119  return sqlType == that.sqlType && numBytes == that.numBytes &&
120  numElements == that.numElements &&
122  that.chunkStats.min,
125  that.chunkStats.max,
128  }
bool has_nulls
Definition: ChunkMetadata.h:30
ChunkStats chunkStats
Definition: ChunkMetadata.h:37
bool DatumEqual(const Datum a, const Datum b, const SQLTypeInfo &ti)
Definition: Datum.cpp:408
SQLTypeInfo get_elem_type() const
Definition: sqltypes.h:977
SQLTypeInfo sqlType
Definition: ChunkMetadata.h:34
bool is_array() const
Definition: sqltypes.h:585
size_t numElements
Definition: ChunkMetadata.h:36

+ Here is the call graph for this function:

Member Data Documentation

size_t ChunkMetadata::numBytes

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