OmniSciDB  6686921089
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 1135 of file ResultSet.cpp.

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

1135  {
1136  return !rows.isTruncated();
1137 }

+ 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 185 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::initRowGroups().

187  {
188  switch (key_width) {
189  case 4: {
190  auto key_ptr_i32 = reinterpret_cast<int32_t*>(key_ptr);
191  fill_empty_key_32(key_ptr_i32, key_count);
192  break;
193  }
194  case 8: {
195  auto key_ptr_i64 = reinterpret_cast<int64_t*>(key_ptr);
196  fill_empty_key_64(key_ptr_i64, key_count);
197  break;
198  }
199  default:
200  CHECK(false);
201  }
202 }
ALWAYS_INLINE void fill_empty_key_32(int32_t *key_ptr_i32, const size_t key_count)
#define CHECK(condition)
Definition: Logger.h:209
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 114 of file ResultSetIteration.cpp.

References QueryMemoryDescriptor::getPaddedColWidthForRange().

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

115  {
116  return query_mem_desc.getPaddedColWidthForRange(0, slot_idx);
117 }
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 784 of file ResultSetReduction.cpp.

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

Referenced by get_group_value_reduction_rt().

794  {
795  uint32_t h = key_hash(key, key_count, key_width) % groups_buffer_entry_count;
796  auto matching_gvi = get_matching_group_value_reduction(groups_buffer,
797  h,
798  key,
799  key_count,
800  key_width,
801  query_mem_desc,
802  that_buff_i64,
803  that_entry_idx,
804  that_entry_count,
805  row_size_quad);
806  if (matching_gvi.first) {
807  return matching_gvi;
808  }
809  uint32_t h_probe = (h + 1) % groups_buffer_entry_count;
810  while (h_probe != h) {
811  matching_gvi = get_matching_group_value_reduction(groups_buffer,
812  h_probe,
813  key,
814  key_count,
815  key_width,
816  query_mem_desc,
817  that_buff_i64,
818  that_entry_idx,
819  that_entry_count,
820  row_size_quad);
821  if (matching_gvi.first) {
822  return matching_gvi;
823  }
824  h_probe = (h_probe + 1) % groups_buffer_entry_count;
825  }
826  return {nullptr, true};
827 }
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)
RUNTIME_EXPORT ALWAYS_INLINE DEVICE uint32_t key_hash(const int64_t *key, const uint32_t key_count, const uint32_t key_byte_width)

+ 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 1400 of file ResultSetReduction.cpp.

References QueryMemoryDescriptor::getPaddedSlotWidthBytes().

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

1402  {
1403  if (float_argument_input) {
1404  return sizeof(float);
1405  }
1406  return query_mem_desc.getPaddedSlotWidthBytes(target_slot_idx);
1407 }
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 85 of file ResultSetStorage.cpp.

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

Referenced by GpuSharedMemCodeBuilder::codegenReduction().

86  {
87  std::vector<int64_t> target_init_vals;
88  for (const auto& target_info : targets) {
89  if (target_info.agg_kind == kCOUNT ||
90  target_info.agg_kind == kAPPROX_COUNT_DISTINCT) {
91  target_init_vals.push_back(0);
92  continue;
93  }
94  if (!target_info.sql_type.get_notnull()) {
95  int64_t init_val =
96  null_val_bit_pattern(target_info.sql_type, takes_float_argument(target_info));
97  target_init_vals.push_back(target_info.is_agg ? init_val : 0);
98  } else {
99  target_init_vals.push_back(target_info.is_agg ? 0xdeadbeef : 0);
100  }
101  if (target_info.agg_kind == kAVG) {
102  target_init_vals.push_back(0);
103  } else if (target_info.agg_kind == kSAMPLE && target_info.sql_type.is_geometry()) {
104  for (int i = 1; i < 2 * target_info.sql_type.get_physical_coord_cols(); i++) {
105  target_init_vals.push_back(0);
106  }
107  } else if (target_info.agg_kind == kSAMPLE && target_info.sql_type.is_varlen()) {
108  target_init_vals.push_back(0);
109  }
110  }
111  return target_init_vals;
112 }
bool takes_float_argument(const TargetInfo &target_info)
Definition: TargetInfo.h:157
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 114 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().

116  {
117  CHECK(col_lazy_fetch.is_lazily_fetched);
118  const auto& type_info = col_lazy_fetch.type;
119  if (type_info.is_fp()) {
120  if (type_info.get_type() == kFLOAT) {
121  double fval = fixed_width_float_decode_noinline(byte_stream, pos);
122  return *reinterpret_cast<const int64_t*>(may_alias_ptr(&fval));
123  } else {
124  double fval = fixed_width_double_decode_noinline(byte_stream, pos);
125  return *reinterpret_cast<const int64_t*>(may_alias_ptr(&fval));
126  }
127  }
128  CHECK(type_info.is_integer() || type_info.is_decimal() || type_info.is_time() ||
129  type_info.is_timeinterval() || type_info.is_boolean() || type_info.is_string() ||
130  type_info.is_array());
131  size_t type_bitwidth = get_bit_width(type_info);
132  if (type_info.get_compression() == kENCODING_FIXED) {
133  type_bitwidth = type_info.get_comp_param();
134  } else if (type_info.get_compression() == kENCODING_DICT) {
135  type_bitwidth = 8 * type_info.get_size();
136  }
137  CHECK_EQ(size_t(0), type_bitwidth % 8);
138  int64_t val;
139  if (type_info.is_date_in_days()) {
140  val = type_info.get_comp_param() == 16
142  byte_stream, 2, NULL_SMALLINT, NULL_BIGINT, pos)
144  byte_stream, 4, NULL_INT, NULL_BIGINT, pos);
145  } else {
146  val = (type_info.get_compression() == kENCODING_DICT &&
147  type_info.get_size() < type_info.get_logical_size() &&
148  type_info.get_comp_param())
149  ? fixed_width_unsigned_decode_noinline(byte_stream, type_bitwidth / 8, pos)
150  : fixed_width_int_decode_noinline(byte_stream, type_bitwidth / 8, pos);
151  }
152  if (type_info.get_compression() != kENCODING_NONE &&
153  type_info.get_compression() != kENCODING_DATE_IN_DAYS) {
154  CHECK(type_info.get_compression() == kENCODING_FIXED ||
155  type_info.get_compression() == kENCODING_DICT);
156  auto encoding = type_info.get_compression();
157  if (encoding == kENCODING_FIXED) {
158  encoding = kENCODING_NONE;
159  }
160  SQLTypeInfo col_logical_ti(type_info.get_type(),
161  type_info.get_dimension(),
162  type_info.get_scale(),
163  false,
164  encoding,
165  0,
166  type_info.get_subtype());
167  if (val == inline_fixed_encoding_null_val(type_info)) {
168  return inline_int_null_val(col_logical_ti);
169  }
170  }
171  return val;
172 }
const SQLTypeInfo type
#define CHECK_EQ(x, y)
Definition: Logger.h:217
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:91
#define NULL_BIGINT
#define NULL_INT
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:98
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:149
const bool is_lazily_fetched
#define CHECK(condition)
Definition: Logger.h:209
int64_t inline_int_null_val(const SQL_TYPE_INFO &ti)
#define NULL_SMALLINT
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:121
DEVICE NEVER_INLINE double SUFFIX() fixed_width_double_decode_noinline(const int8_t *byte_stream, const int64_t pos)
Definition: DecodersImpl.h:134

+ 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 1139 of file ResultSet.cpp.

References can_use_parallel_algorithms().

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

1139  {
1140  return result_set::can_use_parallel_algorithms(rows) && rows.entryCount() >= 20000;
1141 }
bool can_use_parallel_algorithms(const ResultSet &rows)
Definition: ResultSet.cpp:1135

+ Here is the call graph for this function:

+ Here is the caller graph for this function: