OmniSciDB  085a039ca4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
anonymous_namespace{ColumnarResults.cpp} Namespace Reference

Functions

int64_t fixed_encoding_nullable_val (const int64_t val, const SQLTypeInfo &type_info)
 
std::vector< size_t > get_padded_target_sizes (const ResultSet &rows, const std::vector< SQLTypeInfo > &target_types)
 
int64_t invalid_read_func (const ResultSet &rows, const size_t input_buffer_entry_idx, const size_t target_idx, const size_t slot_idx)
 
template<QueryDescriptionType QUERY_TYPE, bool COLUMNAR_OUTPUT>
int64_t read_float_key_baseline (const ResultSet &rows, const size_t input_buffer_entry_idx, const size_t target_idx, const size_t slot_idx)
 
template<QueryDescriptionType QUERY_TYPE, bool COLUMNAR_OUTPUT>
int64_t read_int64_func (const ResultSet &rows, const size_t input_buffer_entry_idx, const size_t target_idx, const size_t slot_idx)
 
template<QueryDescriptionType QUERY_TYPE, bool COLUMNAR_OUTPUT>
int64_t read_int32_func (const ResultSet &rows, const size_t input_buffer_entry_idx, const size_t target_idx, const size_t slot_idx)
 
template<QueryDescriptionType QUERY_TYPE, bool COLUMNAR_OUTPUT>
int64_t read_int16_func (const ResultSet &rows, const size_t input_buffer_entry_idx, const size_t target_idx, const size_t slot_idx)
 
template<QueryDescriptionType QUERY_TYPE, bool COLUMNAR_OUTPUT>
int64_t read_int8_func (const ResultSet &rows, const size_t input_buffer_entry_idx, const size_t target_idx, const size_t slot_idx)
 
template<QueryDescriptionType QUERY_TYPE, bool COLUMNAR_OUTPUT>
int64_t read_float_func (const ResultSet &rows, const size_t input_buffer_entry_idx, const size_t target_idx, const size_t slot_idx)
 
template<QueryDescriptionType QUERY_TYPE, bool COLUMNAR_OUTPUT>
int64_t read_double_func (const ResultSet &rows, const size_t input_buffer_entry_idx, const size_t target_idx, const size_t slot_idx)
 

Function Documentation

int64_t anonymous_namespace{ColumnarResults.cpp}::fixed_encoding_nullable_val ( const int64_t  val,
const SQLTypeInfo type_info 
)
inline

Definition at line 31 of file ColumnarResults.cpp.

References CHECK, SQLTypeInfo::get_compression(), get_logical_type_info(), inline_fixed_encoding_null_val(), inline_int_null_val(), kENCODING_DICT, kENCODING_FIXED, and kENCODING_NONE.

Referenced by ColumnarResults::writeBackCell(), and ColumnarResults::writeBackCellDirect().

32  {
33  if (type_info.get_compression() != kENCODING_NONE) {
34  CHECK(type_info.get_compression() == kENCODING_FIXED ||
35  type_info.get_compression() == kENCODING_DICT);
36  auto logical_ti = get_logical_type_info(type_info);
37  if (val == inline_int_null_val(logical_ti)) {
38  return inline_fixed_encoding_null_val(type_info);
39  }
40  }
41  return val;
42 }
SQLTypeInfo get_logical_type_info(const SQLTypeInfo &type_info)
Definition: sqltypes.h:1087
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:337
#define CHECK(condition)
Definition: Logger.h:223
int64_t inline_int_null_val(const SQL_TYPE_INFO &ti)
int64_t inline_fixed_encoding_null_val(const SQL_TYPE_INFO &ti)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector<size_t> anonymous_namespace{ColumnarResults.cpp}::get_padded_target_sizes ( const ResultSet rows,
const std::vector< SQLTypeInfo > &  target_types 
)

Definition at line 44 of file ColumnarResults.cpp.

46  {
47  std::vector<size_t> padded_target_sizes;
48  // We have to check that the result set is valid as one entry point
49  // to columnar results constructs effectively a fake result set.
50  // In these cases it should be safe to assume that we can use the type
51  // target widths
52  if (!rows.hasValidBuffer() ||
53  rows.getQueryMemDesc().getColCount() < target_types.size()) {
54  for (const auto& target_type : target_types) {
55  padded_target_sizes.emplace_back(target_type.get_size());
56  }
57  return padded_target_sizes;
58  }
59 
60  // If here we have a valid result set, so use it's QMD padded widths
61  const auto col_context = rows.getQueryMemDesc().getColSlotContext();
62  for (size_t col_idx = 0; col_idx < target_types.size(); col_idx++) {
63  // Lazy fetch columns will have 0 as a padded with, so use the type's
64  // logical width for those
65  const auto idx = col_context.getSlotsForCol(col_idx).front();
66  const size_t padded_slot_width =
67  static_cast<size_t>(rows.getPaddedSlotWidthBytes(idx));
68  padded_target_sizes.emplace_back(
69  padded_slot_width == 0UL ? target_types[col_idx].get_size() : padded_slot_width);
70  }
71  return padded_target_sizes;
72 }
int64_t anonymous_namespace{ColumnarResults.cpp}::invalid_read_func ( const ResultSet rows,
const size_t  input_buffer_entry_idx,
const size_t  target_idx,
const size_t  slot_idx 
)

Definition at line 1075 of file ColumnarResults.cpp.

References UNREACHABLE.

Referenced by ColumnarResults::initReadFunctions().

1078  {
1079  UNREACHABLE() << "Invalid read function used, target should have been skipped.";
1080  return static_cast<int64_t>(0);
1081 }
#define UNREACHABLE()
Definition: Logger.h:267

+ Here is the caller graph for this function:

template<QueryDescriptionType QUERY_TYPE, bool COLUMNAR_OUTPUT>
int64_t anonymous_namespace{ColumnarResults.cpp}::read_double_func ( const ResultSet rows,
const size_t  input_buffer_entry_idx,
const size_t  target_idx,
const size_t  slot_idx 
)

Definition at line 1143 of file ColumnarResults.cpp.

1146  {
1147  auto dval = rows.getEntryAt<double, QUERY_TYPE, COLUMNAR_OUTPUT>(
1148  input_buffer_entry_idx, target_idx, slot_idx);
1149  return *reinterpret_cast<int64_t*>(may_alias_ptr(&dval));
1150 }
template<QueryDescriptionType QUERY_TYPE, bool COLUMNAR_OUTPUT>
int64_t anonymous_namespace{ColumnarResults.cpp}::read_float_func ( const ResultSet rows,
const size_t  input_buffer_entry_idx,
const size_t  target_idx,
const size_t  slot_idx 
)

Definition at line 1133 of file ColumnarResults.cpp.

1136  {
1137  auto fval = rows.getEntryAt<float, QUERY_TYPE, COLUMNAR_OUTPUT>(
1138  input_buffer_entry_idx, target_idx, slot_idx);
1139  return *reinterpret_cast<int32_t*>(may_alias_ptr(&fval));
1140 }
template<QueryDescriptionType QUERY_TYPE, bool COLUMNAR_OUTPUT>
int64_t anonymous_namespace{ColumnarResults.cpp}::read_float_key_baseline ( const ResultSet rows,
const size_t  input_buffer_entry_idx,
const size_t  target_idx,
const size_t  slot_idx 
)

Definition at line 1084 of file ColumnarResults.cpp.

1087  {
1088  // float keys in baseline hash are written as doubles in the buffer, so
1089  // the result should properly be casted before being written in the output
1090  // columns
1091  auto fval = static_cast<float>(rows.getEntryAt<double, QUERY_TYPE, COLUMNAR_OUTPUT>(
1092  input_buffer_entry_idx, target_idx, slot_idx));
1093  return *reinterpret_cast<int32_t*>(may_alias_ptr(&fval));
1094 }
template<QueryDescriptionType QUERY_TYPE, bool COLUMNAR_OUTPUT>
int64_t anonymous_namespace{ColumnarResults.cpp}::read_int16_func ( const ResultSet rows,
const size_t  input_buffer_entry_idx,
const size_t  target_idx,
const size_t  slot_idx 
)

Definition at line 1115 of file ColumnarResults.cpp.

1118  {
1119  return rows.getEntryAt<int16_t, QUERY_TYPE, COLUMNAR_OUTPUT>(
1120  input_buffer_entry_idx, target_idx, slot_idx);
1121 }
template<QueryDescriptionType QUERY_TYPE, bool COLUMNAR_OUTPUT>
int64_t anonymous_namespace{ColumnarResults.cpp}::read_int32_func ( const ResultSet rows,
const size_t  input_buffer_entry_idx,
const size_t  target_idx,
const size_t  slot_idx 
)

Definition at line 1106 of file ColumnarResults.cpp.

1109  {
1110  return rows.getEntryAt<int32_t, QUERY_TYPE, COLUMNAR_OUTPUT>(
1111  input_buffer_entry_idx, target_idx, slot_idx);
1112 }
template<QueryDescriptionType QUERY_TYPE, bool COLUMNAR_OUTPUT>
int64_t anonymous_namespace{ColumnarResults.cpp}::read_int64_func ( const ResultSet rows,
const size_t  input_buffer_entry_idx,
const size_t  target_idx,
const size_t  slot_idx 
)

Definition at line 1097 of file ColumnarResults.cpp.

1100  {
1101  return rows.getEntryAt<int64_t, QUERY_TYPE, COLUMNAR_OUTPUT>(
1102  input_buffer_entry_idx, target_idx, slot_idx);
1103 }
template<QueryDescriptionType QUERY_TYPE, bool COLUMNAR_OUTPUT>
int64_t anonymous_namespace{ColumnarResults.cpp}::read_int8_func ( const ResultSet rows,
const size_t  input_buffer_entry_idx,
const size_t  target_idx,
const size_t  slot_idx 
)

Definition at line 1124 of file ColumnarResults.cpp.

1127  {
1128  return rows.getEntryAt<int8_t, QUERY_TYPE, COLUMNAR_OUTPUT>(
1129  input_buffer_entry_idx, target_idx, slot_idx);
1130 }