OmniSciDB  340b00dbf6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
result_set Namespace Reference

Functions

bool can_use_parallel_algorithms (const ResultSet &rows)
 
bool use_parallel_algorithms (const ResultSet &rows)
 
int64_t lazy_decode (const ColumnLazyFetchInfo &col_lazy_fetch, const int8_t *byte_stream, const int64_t pos)
 
void fill_empty_key (void *key_ptr, const size_t key_count, const size_t key_width)
 
int8_t get_width_for_slot (const size_t target_slot_idx, const bool float_argument_input, const QueryMemoryDescriptor &query_mem_desc)
 
size_t get_byteoff_of_slot (const size_t slot_idx, const QueryMemoryDescriptor &query_mem_desc)
 
GroupValueInfo get_group_value_reduction (int64_t *groups_buffer, const uint32_t groups_buffer_entry_count, const int64_t *key, const uint32_t key_count, const size_t key_width, const QueryMemoryDescriptor &query_mem_desc, const int64_t *that_buff_i64, const size_t that_entry_idx, const size_t that_entry_count, const uint32_t row_size_quad)
 
std::vector< int64_t > initialize_target_values_for_storage (const std::vector< TargetInfo > &targets)
 

Function Documentation

bool result_set::can_use_parallel_algorithms ( const ResultSet rows)

Definition at line 1032 of file ResultSet.cpp.

Referenced by anonymous_namespace{RelAlgTranslator.cpp}::get_in_values_expr(), RelAlgTranslator::getInIntegerSetExpr(), and use_parallel_algorithms().

1032  {
1033  return !rows.isTruncated();
1034 }

+ Here is the caller graph for this function:

void result_set::fill_empty_key ( void *  key_ptr,
const size_t  key_count,
const size_t  key_width 
)

Definition at line 183 of file ResultSetReduction.cpp.

References CHECK, anonymous_namespace{ResultSetReduction.cpp}::fill_empty_key_32(), and anonymous_namespace{ResultSetReduction.cpp}::fill_empty_key_64().

Referenced by QueryMemoryInitializer::initGroups().

185  {
186  switch (key_width) {
187  case 4: {
188  auto key_ptr_i32 = reinterpret_cast<int32_t*>(key_ptr);
189  fill_empty_key_32(key_ptr_i32, key_count);
190  break;
191  }
192  case 8: {
193  auto key_ptr_i64 = reinterpret_cast<int64_t*>(key_ptr);
194  fill_empty_key_64(key_ptr_i64, key_count);
195  break;
196  }
197  default:
198  CHECK(false);
199  }
200 }
ALWAYS_INLINE void fill_empty_key_32(int32_t *key_ptr_i32, const size_t key_count)
#define CHECK(condition)
Definition: Logger.h:197
ALWAYS_INLINE void fill_empty_key_64(int64_t *key_ptr_i64, const size_t key_count)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t result_set::get_byteoff_of_slot ( const size_t  slot_idx,
const QueryMemoryDescriptor query_mem_desc 
)

Definition at line 112 of file ResultSetIteration.cpp.

References QueryMemoryDescriptor::getPaddedColWidthForRange().

Referenced by ResultSetReductionJIT::isEmpty(), and ResultSetStorage::isEmptyEntry().

113  {
114  return query_mem_desc.getPaddedColWidthForRange(0, slot_idx);
115 }
size_t getPaddedColWidthForRange(const size_t offset, const size_t range) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

GroupValueInfo result_set::get_group_value_reduction ( int64_t *  groups_buffer,
const uint32_t  groups_buffer_entry_count,
const int64_t *  key,
const uint32_t  key_count,
const size_t  key_width,
const QueryMemoryDescriptor query_mem_desc,
const int64_t *  that_buff_i64,
const size_t  that_entry_idx,
const size_t  that_entry_count,
const uint32_t  row_size_quad 
)

Definition at line 758 of file ResultSetReduction.cpp.

References anonymous_namespace{ResultSetReduction.cpp}::get_matching_group_value_reduction(), and key_hash().

Referenced by get_group_value_reduction_rt().

768  {
769  uint32_t h = key_hash(key, key_count, key_width) % groups_buffer_entry_count;
770  auto matching_gvi = get_matching_group_value_reduction(groups_buffer,
771  h,
772  key,
773  key_count,
774  key_width,
775  query_mem_desc,
776  that_buff_i64,
777  that_entry_idx,
778  that_entry_count,
779  row_size_quad);
780  if (matching_gvi.first) {
781  return matching_gvi;
782  }
783  uint32_t h_probe = (h + 1) % groups_buffer_entry_count;
784  while (h_probe != h) {
785  matching_gvi = get_matching_group_value_reduction(groups_buffer,
786  h_probe,
787  key,
788  key_count,
789  key_width,
790  query_mem_desc,
791  that_buff_i64,
792  that_entry_idx,
793  that_entry_count,
794  row_size_quad);
795  if (matching_gvi.first) {
796  return matching_gvi;
797  }
798  h_probe = (h_probe + 1) % groups_buffer_entry_count;
799  }
800  return {nullptr, true};
801 }
ALWAYS_INLINE DEVICE uint32_t key_hash(const int64_t *key, const uint32_t key_count, const uint32_t key_byte_width)
GroupValueInfo get_matching_group_value_reduction(int64_t *groups_buffer, const uint32_t h, const T *key, const uint32_t key_count, const QueryMemoryDescriptor &query_mem_desc, const int64_t *that_buff_i64, const size_t that_entry_idx, const size_t that_entry_count, const uint32_t row_size_quad)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int8_t result_set::get_width_for_slot ( const size_t  target_slot_idx,
const bool  float_argument_input,
const QueryMemoryDescriptor query_mem_desc 
)

Definition at line 1371 of file ResultSetReduction.cpp.

References QueryMemoryDescriptor::getPaddedSlotWidthBytes().

Referenced by ResultSetReductionJIT::reduceOneSlot(), ResultSetStorage::reduceOneSlot(), and ResultSetStorage::reduceOneSlotSingleValue().

1373  {
1374  if (float_argument_input) {
1375  return sizeof(float);
1376  }
1377  return query_mem_desc.getPaddedSlotWidthBytes(target_slot_idx);
1378 }
const int8_t getPaddedSlotWidthBytes(const size_t slot_idx) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector< int64_t > result_set::initialize_target_values_for_storage ( const std::vector< TargetInfo > &  targets)

Definition at line 75 of file ResultSetStorage.cpp.

References kAPPROX_COUNT_DISTINCT, kAVG, kCOUNT, kSAMPLE, null_val_bit_pattern(), and takes_float_argument().

Referenced by GpuSharedMemCodeBuilder::codegenReduction().

76  {
77  std::vector<int64_t> target_init_vals;
78  for (const auto& target_info : targets) {
79  if (target_info.agg_kind == kCOUNT ||
80  target_info.agg_kind == kAPPROX_COUNT_DISTINCT) {
81  target_init_vals.push_back(0);
82  continue;
83  }
84  if (!target_info.sql_type.get_notnull()) {
85  int64_t init_val =
86  null_val_bit_pattern(target_info.sql_type, takes_float_argument(target_info));
87  target_init_vals.push_back(target_info.is_agg ? init_val : 0);
88  } else {
89  target_init_vals.push_back(target_info.is_agg ? 0xdeadbeef : 0);
90  }
91  if (target_info.agg_kind == kAVG) {
92  target_init_vals.push_back(0);
93  } else if (target_info.agg_kind == kSAMPLE && target_info.sql_type.is_geometry()) {
94  for (int i = 1; i < 2 * target_info.sql_type.get_physical_coord_cols(); i++) {
95  target_init_vals.push_back(0);
96  }
97  } else if (target_info.agg_kind == kSAMPLE && target_info.sql_type.is_varlen()) {
98  target_init_vals.push_back(0);
99  }
100  }
101  return target_init_vals;
102 }
bool takes_float_argument(const TargetInfo &target_info)
Definition: TargetInfo.h:134
int64_t null_val_bit_pattern(const SQLTypeInfo &ti, const bool float_argument_input)
Definition: sqldefs.h:76
Definition: sqldefs.h:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int64_t result_set::lazy_decode ( const ColumnLazyFetchInfo col_lazy_fetch,
const int8_t *  byte_stream,
const int64_t  pos 
)

Definition at line 104 of file ResultSetStorage.cpp.

References CHECK, CHECK_EQ, fixed_width_double_decode_noinline(), fixed_width_float_decode_noinline(), fixed_width_int_decode_noinline(), fixed_width_small_date_decode_noinline(), fixed_width_unsigned_decode_noinline(), get_bit_width(), inline_fixed_encoding_null_val(), inline_int_null_val(), ColumnLazyFetchInfo::is_lazily_fetched, kENCODING_DATE_IN_DAYS, kENCODING_DICT, kENCODING_FIXED, kENCODING_NONE, kFLOAT, NULL_BIGINT, NULL_INT, NULL_SMALLINT, and ColumnLazyFetchInfo::type.

Referenced by ResultSet::lazyReadInt(), and ResultSet::makeTargetValue().

106  {
107  CHECK(col_lazy_fetch.is_lazily_fetched);
108  const auto& type_info = col_lazy_fetch.type;
109  if (type_info.is_fp()) {
110  if (type_info.get_type() == kFLOAT) {
111  double fval = fixed_width_float_decode_noinline(byte_stream, pos);
112  return *reinterpret_cast<const int64_t*>(may_alias_ptr(&fval));
113  } else {
114  double fval = fixed_width_double_decode_noinline(byte_stream, pos);
115  return *reinterpret_cast<const int64_t*>(may_alias_ptr(&fval));
116  }
117  }
118  CHECK(type_info.is_integer() || type_info.is_decimal() || type_info.is_time() ||
119  type_info.is_timeinterval() || type_info.is_boolean() || type_info.is_string() ||
120  type_info.is_array());
121  size_t type_bitwidth = get_bit_width(type_info);
122  if (type_info.get_compression() == kENCODING_FIXED) {
123  type_bitwidth = type_info.get_comp_param();
124  } else if (type_info.get_compression() == kENCODING_DICT) {
125  type_bitwidth = 8 * type_info.get_size();
126  }
127  CHECK_EQ(size_t(0), type_bitwidth % 8);
128  int64_t val;
129  if (type_info.is_date_in_days()) {
130  val = type_info.get_comp_param() == 16
132  byte_stream, 2, NULL_SMALLINT, NULL_BIGINT, pos)
134  byte_stream, 4, NULL_INT, NULL_BIGINT, pos);
135  } else {
136  val = (type_info.get_compression() == kENCODING_DICT &&
137  type_info.get_size() < type_info.get_logical_size() &&
138  type_info.get_comp_param())
139  ? fixed_width_unsigned_decode_noinline(byte_stream, type_bitwidth / 8, pos)
140  : fixed_width_int_decode_noinline(byte_stream, type_bitwidth / 8, pos);
141  }
142  if (type_info.get_compression() != kENCODING_NONE &&
143  type_info.get_compression() != kENCODING_DATE_IN_DAYS) {
144  CHECK(type_info.get_compression() == kENCODING_FIXED ||
145  type_info.get_compression() == kENCODING_DICT);
146  auto encoding = type_info.get_compression();
147  if (encoding == kENCODING_FIXED) {
148  encoding = kENCODING_NONE;
149  }
150  SQLTypeInfo col_logical_ti(type_info.get_type(),
151  type_info.get_dimension(),
152  type_info.get_scale(),
153  false,
154  encoding,
155  0,
156  type_info.get_subtype());
157  if (val == inline_fixed_encoding_null_val(type_info)) {
158  return inline_int_null_val(col_logical_ti);
159  }
160  }
161  return val;
162 }
const SQLTypeInfo type
#define CHECK_EQ(x, y)
Definition: Logger.h:205
DEVICE NEVER_INLINE int64_t SUFFIX() fixed_width_int_decode_noinline(const int8_t *byte_stream, const int32_t byte_width, const int64_t pos)
Definition: DecodersImpl.h:83
#define NULL_BIGINT
Definition: sqltypes.h:255
size_t get_bit_width(const SQLTypeInfo &ti)
DEVICE NEVER_INLINE int64_t SUFFIX() fixed_width_unsigned_decode_noinline(const int8_t *byte_stream, const int32_t byte_width, const int64_t pos)
Definition: DecodersImpl.h:90
#define NULL_INT
Definition: sqltypes.h:254
DEVICE NEVER_INLINE int64_t SUFFIX() fixed_width_small_date_decode_noinline(const int8_t *byte_stream, const int32_t byte_width, const int32_t null_val, const int64_t ret_null_val, const int64_t pos)
Definition: DecodersImpl.h:141
const bool is_lazily_fetched
#define NULL_SMALLINT
Definition: sqltypes.h:253
#define CHECK(condition)
Definition: Logger.h:197
int64_t inline_int_null_val(const SQL_TYPE_INFO &ti)
int64_t inline_fixed_encoding_null_val(const SQL_TYPE_INFO &ti)
DEVICE NEVER_INLINE float SUFFIX() fixed_width_float_decode_noinline(const int8_t *byte_stream, const int64_t pos)
Definition: DecodersImpl.h:113
DEVICE NEVER_INLINE double SUFFIX() fixed_width_double_decode_noinline(const int8_t *byte_stream, const int64_t pos)
Definition: DecodersImpl.h:126

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool result_set::use_parallel_algorithms ( const ResultSet rows)

Definition at line 1036 of file ResultSet.cpp.

References can_use_parallel_algorithms().

Referenced by ColumnarResults::materializeAllLazyColumns(), and synthesize_metadata().

1036  {
1037  return result_set::can_use_parallel_algorithms(rows) && rows.entryCount() >= 20000;
1038 }
bool can_use_parallel_algorithms(const ResultSet &rows)
Definition: ResultSet.cpp:1032

+ Here is the call graph for this function:

+ Here is the caller graph for this function: