OmniSciDB  04ee39c94c
InlineNullValues.h File Reference
#include "Logger.h"
+ Include dependency graph for InlineNullValues.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename T >
inline_fp_null_value ()
 
template<>
constexpr float inline_fp_null_value< float > ()
 
template<>
constexpr double inline_fp_null_value< double > ()
 
template<typename T >
inline_fp_null_array_value ()
 
template<>
constexpr float inline_fp_null_array_value< float > ()
 
template<>
constexpr double inline_fp_null_array_value< double > ()
 
template<typename SQL_TYPE_INFO >
int64_t inline_int_null_val (const SQL_TYPE_INFO &ti)
 
template<typename SQL_TYPE_INFO >
int64_t inline_fixed_encoding_null_val (const SQL_TYPE_INFO &ti)
 
template<typename SQL_TYPE_INFO >
double inline_fp_null_val (const SQL_TYPE_INFO &ti)
 
template<typename SQL_TYPE_INFO >
int64_t inline_int_null_array_val (const SQL_TYPE_INFO &ti)
 
template<typename SQL_TYPE_INFO >
int64_t inline_fixed_encoding_null_array_val (const SQL_TYPE_INFO &ti)
 

Function Documentation

◆ inline_fixed_encoding_null_array_val()

template<typename SQL_TYPE_INFO >
int64_t inline_fixed_encoding_null_array_val ( const SQL_TYPE_INFO &  ti)
inline

Definition at line 180 of file InlineNullValues.h.

References CHECK, CHECK_EQ, inline_int_null_array_val(), kENCODING_DATE_IN_DAYS, kENCODING_DICT, kENCODING_FIXED, and kENCODING_NONE.

Referenced by Importer_NS::NullArrayDatum().

180  {
181  if (ti.get_compression() == kENCODING_NONE) {
182  return inline_int_null_array_val(ti);
183  }
184  if (ti.get_compression() == kENCODING_DATE_IN_DAYS) {
185  switch (ti.get_comp_param()) {
186  case 0:
187  case 32:
188  return inline_int_null_array_value<int32_t>();
189  case 16:
190  return inline_int_null_array_value<int16_t>();
191  default:
192 #ifndef __CUDACC__
193  CHECK(false) << "Unknown encoding width for date in days: "
194  << ti.get_comp_param();
195 #else
196  CHECK(false);
197 #endif
198  }
199  }
200  if (ti.get_compression() == kENCODING_DICT) {
201  CHECK(ti.is_string());
202 #ifndef __CUDACC__
203  CHECK(false) << "Currently don't support fixed length arrays of dict encoded strings";
204 #else
205  CHECK(false);
206 #endif
207  switch (ti.get_size()) {
208  case 1:
209  return inline_int_null_array_value<uint8_t>();
210  case 2:
211  return inline_int_null_array_value<uint16_t>();
212  case 4:
213  return inline_int_null_array_value<int32_t>();
214  default:
215 #ifndef __CUDACC__
216  CHECK(false) << "Unknown size for dictionary encoded type: " << ti.get_size();
217 #else
218  CHECK(false);
219 #endif
220  }
221  }
222 #ifndef __CUDACC__
223  CHECK(false) << "Currently don't support fixed length arrays with fixed encoding";
224 #else
225  CHECK(false);
226 #endif
227  CHECK_EQ(kENCODING_FIXED, ti.get_compression());
228  CHECK(ti.is_integer() || ti.is_time() || ti.is_decimal());
229  CHECK_EQ(0, ti.get_comp_param() % 8);
230  // The value of the NULL sentinel for fixed encoding is:
231  // -(1L << (ti.get_comp_param() - 1))
232  // NULL_ARRAY sentinel would have to be the value just above NULL:
233  return -(1L << (ti.get_comp_param() - 1)) + 1;
234 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
int64_t inline_int_null_array_val(const SQL_TYPE_INFO &ti)
#define CHECK(condition)
Definition: Logger.h:187
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ inline_fixed_encoding_null_val()

template<typename SQL_TYPE_INFO >
int64_t inline_fixed_encoding_null_val ( const SQL_TYPE_INFO &  ti)
inline

Definition at line 84 of file InlineNullValues.h.

References CHECK, CHECK_EQ, inline_int_null_val(), kENCODING_DATE_IN_DAYS, kENCODING_DICT, kENCODING_FIXED, and kENCODING_NONE.

Referenced by Importer_NS::TypedImportBuffer::add_value(), Importer_NS::TypedImportBuffer::add_values(), Parser::InsertValuesStmt::determineLeafIndex(), Executor::executeSimpleInsert(), BaselineJoinHashTable::fetchColumnsForDevice(), anonymous_namespace{ColumnarResults.cpp}::fixed_encoding_nullable_val(), JoinHashTable::getHashJoinArgs(), JoinHashTable::initHashTableForDevice(), JoinHashTable::initHashTableOnCpu(), JoinHashTable::initOneToManyHashTable(), JoinHashTable::initOneToManyHashTableOnCpu(), anonymous_namespace{Execute.cpp}::insert_one_dict_str(), anonymous_namespace{WindowContext.cpp}::integer_comparator(), lazy_decode(), Importer_NS::NullDatum(), anonymous_namespace{ArrowImporter.h}::ArrowValue< void * >::operator const DATA_TYPE(), anonymous_namespace{ArrowImporter.h}::ArrowValue< std::string >::operator const DATA_TYPE(), and Importer_NS::TDatumToDatum().

84  {
85  if (ti.get_compression() == kENCODING_NONE) {
86  return inline_int_null_val(ti);
87  }
88  if (ti.get_compression() == kENCODING_DATE_IN_DAYS) {
89  switch (ti.get_comp_param()) {
90  case 0:
91  case 32:
92  return inline_int_null_value<int32_t>();
93  case 16:
94  return inline_int_null_value<int16_t>();
95  default:
96 #ifndef __CUDACC__
97  CHECK(false) << "Unknown encoding width for date in days: "
98  << ti.get_comp_param();
99 #else
100  CHECK(false);
101 #endif
102  }
103  }
104  if (ti.get_compression() == kENCODING_DICT) {
105  CHECK(ti.is_string());
106  switch (ti.get_size()) {
107  case 1:
108  return inline_int_null_value<uint8_t>();
109  case 2:
110  return inline_int_null_value<uint16_t>();
111  case 4:
112  return inline_int_null_value<int32_t>();
113  default:
114 #ifndef __CUDACC__
115  CHECK(false) << "Unknown size for dictionary encoded type: " << ti.get_size();
116 #else
117  CHECK(false);
118 #endif
119  }
120  }
121  CHECK_EQ(kENCODING_FIXED, ti.get_compression());
122  CHECK(ti.is_integer() || ti.is_time() || ti.is_decimal());
123  CHECK_EQ(0, ti.get_comp_param() % 8);
124  return -(1L << (ti.get_comp_param() - 1));
125 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
#define CHECK(condition)
Definition: Logger.h:187
int64_t inline_int_null_val(const SQL_TYPE_INFO &ti)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ inline_fp_null_array_value()

template<typename T >
T inline_fp_null_array_value ( )

Referenced by inline_fp_null_value< double >().

+ Here is the caller graph for this function:

◆ inline_fp_null_array_value< double >()

template<>
constexpr double inline_fp_null_array_value< double > ( )
inline

Definition at line 44 of file InlineNullValues.h.

References NULL_ARRAY_DOUBLE.

Referenced by anonymous_namespace{TypedDataAccessors.h}::put_null_array().

44  {
45  return NULL_ARRAY_DOUBLE;
46 }
#define NULL_ARRAY_DOUBLE
Definition: sqltypes.h:184
+ Here is the caller graph for this function:

◆ inline_fp_null_array_value< float >()

template<>
constexpr float inline_fp_null_array_value< float > ( )
inline

Definition at line 39 of file InlineNullValues.h.

References NULL_ARRAY_FLOAT.

Referenced by anonymous_namespace{TypedDataAccessors.h}::put_null_array().

39  {
40  return NULL_ARRAY_FLOAT;
41 }
#define NULL_ARRAY_FLOAT
Definition: sqltypes.h:183
+ Here is the caller graph for this function:

◆ inline_fp_null_val()

template<typename SQL_TYPE_INFO >
double inline_fp_null_val ( const SQL_TYPE_INFO &  ti)
inline

Definition at line 128 of file InlineNullValues.h.

References CHECK, inline_fp_null_value< double >(), inline_fp_null_value< float >(), kDOUBLE, kFLOAT, and run-benchmark-import::type.

Referenced by GroupByAndAggregate::codegenOutputSlot(), anonymous_namespace{TopKTest.cpp}::SQLiteComparator::compare_impl(), anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::compare_impl(), anonymous_namespace{ArrowResultSetConverter.cpp}::create_or_append_validity(), anonymous_namespace{RelAlgTranslator.cpp}::datum_from_scalar_tv(), datum_to_string(), get_agg_initial_val(), anonymous_namespace{TypedDataAccessors.h}::NullSentinelSupplier::get_null_sentinel_for_type(), CgenState::getOrAddLiteral(), anonymous_namespace{Execute.cpp}::inline_null_val(), null_val_bit_pattern(), anonymous_namespace{ArrowImporter.h}::ArrowValue< void * >::operator DATA_TYPE(), pair_to_double(), and anonymous_namespace{InputMetadata.cpp}::synthesize_metadata().

128  {
129  CHECK(ti.is_fp());
130  const auto type = ti.get_type();
131  switch (type) {
132  case kFLOAT:
134  case kDOUBLE:
136  default:
137  abort();
138  }
139 }
constexpr float inline_fp_null_value< float >()
constexpr double inline_fp_null_value< double >()
#define CHECK(condition)
Definition: Logger.h:187
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ inline_fp_null_value()

template<typename T >
T inline_fp_null_value ( )

◆ inline_fp_null_value< double >()

template<>
constexpr double inline_fp_null_value< double > ( )
inline

Definition at line 31 of file InlineNullValues.h.

References inline_fp_null_array_value(), and NULL_DOUBLE.

Referenced by NumericConverterFactory< SOURCE_TYPE, TARGET_TYPE >::create(), anonymous_namespace{TypedDataAccessors.h}::get_scalar(), ArrowResultSet::getRowAt(), inline_fp_null_val(), and anonymous_namespace{TypedDataAccessors.h}::put_null().

31  {
32  return NULL_DOUBLE;
33 }
#define NULL_DOUBLE
Definition: sqltypes.h:176
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ inline_fp_null_value< float >()

template<>
constexpr float inline_fp_null_value< float > ( )
inline

Definition at line 26 of file InlineNullValues.h.

References NULL_FLOAT.

Referenced by NumericConverterFactory< SOURCE_TYPE, TARGET_TYPE >::create(), anonymous_namespace{TypedDataAccessors.h}::get_scalar(), ArrowResultSet::getRowAt(), inline_fp_null_val(), and anonymous_namespace{TypedDataAccessors.h}::put_null().

26  {
27  return NULL_FLOAT;
28 }
#define NULL_FLOAT
Definition: sqltypes.h:175
+ Here is the caller graph for this function:

◆ inline_int_null_array_val()

template<typename SQL_TYPE_INFO >
int64_t inline_int_null_array_val ( const SQL_TYPE_INFO &  ti)
inline

Definition at line 143 of file InlineNullValues.h.

References CHECK_EQ, kBIGINT, kBOOLEAN, kDATE, kDECIMAL, kENCODING_DICT, kENCODING_NONE, kINT, kINTERVAL_DAY_TIME, kINTERVAL_YEAR_MONTH, kNUMERIC, kSMALLINT, kTIME, kTIMESTAMP, kTINYINT, and run-benchmark-import::type.

Referenced by inline_fixed_encoding_null_array_val().

143  {
144  auto type = ti.get_type();
145  if (ti.is_string()) {
146  CHECK_EQ(kENCODING_DICT, ti.get_compression());
147  CHECK_EQ(4, ti.get_logical_size());
148  type = kINT;
149  } else {
150  CHECK_EQ(kENCODING_NONE, ti.get_compression());
151  }
152  // For all of the types below NULL sentinel is min of the range,
153  // the value right above it is the NULL_ARRAY sentinel
154  switch (type) {
155  case kBOOLEAN:
156  return inline_int_null_array_value<int8_t>();
157  case kTINYINT:
158  return inline_int_null_array_value<int8_t>();
159  case kSMALLINT:
160  return inline_int_null_array_value<int16_t>();
161  case kINT:
162  return inline_int_null_array_value<int32_t>();
163  case kBIGINT:
164  return inline_int_null_array_value<int64_t>();
165  case kTIMESTAMP:
166  case kTIME:
167  case kDATE:
168  case kINTERVAL_DAY_TIME:
170  return inline_int_null_array_value<int64_t>();
171  case kDECIMAL:
172  case kNUMERIC:
173  return inline_int_null_array_value<int64_t>();
174  default:
175  abort();
176  }
177 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
Definition: sqltypes.h:51
Definition: sqltypes.h:55
Definition: sqltypes.h:47
+ Here is the caller graph for this function:

◆ inline_int_null_val()

template<typename SQL_TYPE_INFO >
int64_t inline_int_null_val ( const SQL_TYPE_INFO &  ti)
inline

Definition at line 49 of file InlineNullValues.h.

References CHECK_EQ, kBIGINT, kBOOLEAN, kDATE, kDECIMAL, kENCODING_DICT, kENCODING_NONE, kINT, kINTERVAL_DAY_TIME, kINTERVAL_YEAR_MONTH, kNUMERIC, kSMALLINT, kTIME, kTIMESTAMP, kTINYINT, and run-benchmark-import::type.

Referenced by anonymous_namespace{ExecuteTest.cpp}::check_date_trunc_groups(), InValuesBitmap::codegen(), CodeGenerator::codegen(), CodeGenerator::codegenAdd(), CodeGenerator::codegenBinOpWithOverflowForCPU(), CodeGenerator::codegenCastBetweenIntTypes(), CodeGenerator::codegenCastBetweenIntTypesOverflowChecks(), CodeGenerator::codegenCmp(), CodeGenerator::codegenDiv(), CodeGenerator::codegenMod(), CodeGenerator::codegenMul(), GroupByAndAggregate::codegenOutputSlot(), CodeGenerator::codegenSub(), anonymous_namespace{TopKTest.cpp}::SQLiteComparator::compare_impl(), anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::compare_impl(), anonymous_namespace{ArrowResultSetConverter.cpp}::create_or_append_validity(), CodeGenerator::createInValuesBitmap(), anonymous_namespace{RelAlgTranslator.cpp}::datum_from_scalar_tv(), datum_to_string(), fill_one_entry_no_collisions(), fill_one_entry_one_col(), anonymous_namespace{ColumnarResults.cpp}::fixed_encoding_nullable_val(), get_agg_initial_val(), anonymous_namespace{TypedDataAccessors.h}::NullSentinelSupplier::get_null_sentinel_for_type(), getExpressionRange(), RelAlgTranslator::getInIntegerSetExpr(), CgenState::getOrAddLiteral(), ArrowResultSet::getRowAt(), Executor::groupByColumnCodegen(), inline_fixed_encoding_null_val(), anonymous_namespace{Execute.cpp}::inline_null_val(), CgenState::inlineIntNull(), lazy_decode(), ResultSet::makeTargetValue(), null_val_bit_pattern(), pair_to_double(), anonymous_namespace{ResultSetTest.cpp}::ResultSetEmulator::rse_fill_storage_buffer_baseline_colwise(), anonymous_namespace{ResultSetTest.cpp}::ResultSetEmulator::rse_fill_storage_buffer_baseline_rowwise(), anonymous_namespace{ResultSetTest.cpp}::ResultSetEmulator::rse_get_null_val(), and anonymous_namespace{InputMetadata.cpp}::synthesize_metadata().

49  {
50  auto type = ti.get_type();
51  if (ti.is_string()) {
52  CHECK_EQ(kENCODING_DICT, ti.get_compression());
53  CHECK_EQ(4, ti.get_logical_size());
54  type = kINT;
55  } else {
56  CHECK_EQ(kENCODING_NONE, ti.get_compression());
57  }
58  switch (type) {
59  case kBOOLEAN:
60  return inline_int_null_value<int8_t>();
61  case kTINYINT:
62  return inline_int_null_value<int8_t>();
63  case kSMALLINT:
64  return inline_int_null_value<int16_t>();
65  case kINT:
66  return inline_int_null_value<int32_t>();
67  case kBIGINT:
68  return inline_int_null_value<int64_t>();
69  case kTIMESTAMP:
70  case kTIME:
71  case kDATE:
72  case kINTERVAL_DAY_TIME:
74  return inline_int_null_value<int64_t>();
75  case kDECIMAL:
76  case kNUMERIC:
77  return inline_int_null_value<int64_t>();
78  default:
79  abort();
80  }
81 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
Definition: sqltypes.h:51
Definition: sqltypes.h:55
Definition: sqltypes.h:47
+ Here is the caller graph for this function: