OmniSciDB  dfae7c3b14
ResultSetIteration.cpp File Reference

Iteration part of the row set interface. More...

#include "Execute.h"
#include "Geospatial/Compression.h"
#include "Geospatial/Types.h"
#include "ParserNode.h"
#include "QueryEngine/TargetValue.h"
#include "ResultSet.h"
#include "ResultSetGeoSerialization.h"
#include "RuntimeFunctions.h"
#include "Shared/SqlTypesLayout.h"
#include "Shared/likely.h"
#include "Shared/sqltypes.h"
#include "TypePunning.h"
#include <memory>
#include <utility>
+ Include dependency graph for ResultSetIteration.cpp:

Go to the source code of this file.

Classes

struct  anonymous_namespace{ResultSetIteration.cpp}::GeoLazyFetchHandler
 
struct  anonymous_namespace{ResultSetIteration.cpp}::GeoQueryOutputFetchHandler
 
struct  anonymous_namespace{ResultSetIteration.cpp}::GeoTargetValueBuilder< GEO_SOURCE_TYPE, GeoTargetFetcher >
 

Namespaces

 anonymous_namespace{ResultSetIteration.cpp}
 

Macros

#define DEF_GET_ENTRY_AT(query_type, columnar_output)
 
#define DATA_T   int64_t
 
#define DATA_T   int32_t
 
#define DATA_T   int16_t
 
#define DATA_T   int8_t
 
#define DATA_T   float
 
#define DATA_T   double
 

Functions

TargetValue anonymous_namespace{ResultSetIteration.cpp}::make_avg_target_value (const int8_t *ptr1, const int8_t compact_sz1, const int8_t *ptr2, const int8_t compact_sz2, const TargetInfo &target_info)
 
const int8_t * anonymous_namespace{ResultSetIteration.cpp}::advance_col_buff_to_slot (const int8_t *buff, const QueryMemoryDescriptor &query_mem_desc, const std::vector< TargetInfo > &targets, const size_t slot_idx, const bool separate_varlen_storage)
 
size_t get_byteoff_of_slot (const size_t slot_idx, const QueryMemoryDescriptor &query_mem_desc)
 
const int8_t * anonymous_namespace{ResultSetIteration.cpp}::columnar_elem_ptr (const size_t entry_idx, const int8_t *col1_ptr, const int8_t compact_sz1)
 
int64_t anonymous_namespace{ResultSetIteration.cpp}::int_resize_cast (const int64_t ival, const size_t sz)
 
int64_t lazy_decode (const ColumnLazyFetchInfo &col_lazy_fetch, const int8_t *byte_stream, const int64_t pos)
 
template<class T >
ScalarTargetValue anonymous_namespace{ResultSetIteration.cpp}::make_scalar_tv (const T val)
 
template<>
ScalarTargetValue anonymous_namespace{ResultSetIteration.cpp}::make_scalar_tv (const float val)
 
template<>
ScalarTargetValue anonymous_namespace{ResultSetIteration.cpp}::make_scalar_tv (const double val)
 
template<class T >
TargetValue anonymous_namespace{ResultSetIteration.cpp}::build_array_target_value (const int8_t *buff, const size_t buff_sz, std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner)
 
TargetValue anonymous_namespace{ResultSetIteration.cpp}::build_string_array_target_value (const int32_t *buff, const size_t buff_sz, const int dict_id, const bool translate_strings, std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner, const Executor *executor)
 
TargetValue anonymous_namespace{ResultSetIteration.cpp}::build_array_target_value (const SQLTypeInfo &array_ti, const int8_t *buff, const size_t buff_sz, const bool translate_strings, std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner, const Executor *executor)
 
template<class Tuple , size_t... indices>
std::vector< std::pair< const int8_t *, const int64_t > > anonymous_namespace{ResultSetIteration.cpp}::make_vals_vector (std::index_sequence< indices... >, const Tuple &tuple)
 
std::unique_ptr< ArrayDatumanonymous_namespace{ResultSetIteration.cpp}::lazy_fetch_chunk (const int8_t *ptr, const int64_t varlen_ptr)
 
std::unique_ptr< ArrayDatumanonymous_namespace{ResultSetIteration.cpp}::fetch_data_from_gpu (int64_t varlen_ptr, const int64_t length, Data_Namespace::DataMgr *data_mgr, const int device_id)
 
template<typename T >
std::pair< int64_t, int64_t > anonymous_namespace{ResultSetIteration.cpp}::get_frag_id_and_local_idx (const std::vector< std::vector< T >> &frag_offsets, const size_t tab_or_col_idx, const int64_t global_idx)
 
template<typename T >
size_t anonymous_namespace{ResultSetIteration.cpp}::make_bin_search (size_t l, size_t r, T &&is_empty_fn)
 

Detailed Description

Iteration part of the row set interface.

Author
Alex Suhan alex@.nosp@m.mapd.nosp@m..com Copyright (c) 2014 MapD Technologies, Inc. All rights reserved.

Definition in file ResultSetIteration.cpp.

Macro Definition Documentation

◆ DATA_T [1/6]

#define DATA_T   int64_t

Definition at line 1274 of file ResultSetIteration.cpp.

◆ DATA_T [2/6]

#define DATA_T   int32_t

Definition at line 1274 of file ResultSetIteration.cpp.

◆ DATA_T [3/6]

#define DATA_T   int16_t

Definition at line 1274 of file ResultSetIteration.cpp.

◆ DATA_T [4/6]

#define DATA_T   int8_t

Definition at line 1274 of file ResultSetIteration.cpp.

◆ DATA_T [5/6]

#define DATA_T   float

Definition at line 1274 of file ResultSetIteration.cpp.

◆ DATA_T [6/6]

#define DATA_T   double

Definition at line 1274 of file ResultSetIteration.cpp.

◆ DEF_GET_ENTRY_AT

#define DEF_GET_ENTRY_AT (   query_type,
  columnar_output 
)
Value:
template DATA_T ResultSet::getEntryAt<DATA_T, query_type, columnar_output>( \
const size_t row_idx, const size_t target_idx, const size_t slot_idx) const;
#define DATA_T

Definition at line 1235 of file ResultSetIteration.cpp.

Function Documentation

◆ get_byteoff_of_slot()

size_t get_byteoff_of_slot ( const size_t  slot_idx,
const QueryMemoryDescriptor query_mem_desc 
)

Definition at line 111 of file ResultSetIteration.cpp.

References advance_slot(), advance_target_ptr_col_wise(), advance_target_ptr_row_wise(), align_to_int64(), CHECK, anonymous_namespace{TypedDataAccessors.h}::decimal_to_double(), get_cols_ptr(), get_key_bytes_rowwise(), QueryMemoryDescriptor::getPaddedColWidthForRange(), ResultSet::getRowAt(), row_ptr_rowwise(), and UNLIKELY.

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

112  {
113  return query_mem_desc.getPaddedColWidthForRange(0, slot_idx);
114 }
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:

◆ lazy_decode()

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

Definition at line 762 of file ResultSetIteration.cpp.

References CHECK, CHECK_EQ, setup::encoding, 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(), SQLTypeInfo::get_elem_type(), inline_fixed_encoding_null_val(), inline_int_null_val(), SQLTypeInfo::is_column(), 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(), ResultSet::makeTargetValue(), and RowSortException::RowSortException().

764  {
765  CHECK(col_lazy_fetch.is_lazily_fetched);
766  const auto& type_info =
767  (col_lazy_fetch.type.is_column() ? col_lazy_fetch.type.get_elem_type()
768  : col_lazy_fetch.type);
769  if (type_info.is_fp()) {
770  if (type_info.get_type() == kFLOAT) {
771  double fval = fixed_width_float_decode_noinline(byte_stream, pos);
772  return *reinterpret_cast<const int64_t*>(may_alias_ptr(&fval));
773  } else {
774  double fval = fixed_width_double_decode_noinline(byte_stream, pos);
775  return *reinterpret_cast<const int64_t*>(may_alias_ptr(&fval));
776  }
777  }
778  CHECK(type_info.is_integer() || type_info.is_decimal() || type_info.is_time() ||
779  type_info.is_timeinterval() || type_info.is_boolean() || type_info.is_string() ||
780  type_info.is_array());
781  size_t type_bitwidth = get_bit_width(type_info);
782  if (type_info.get_compression() == kENCODING_FIXED) {
783  type_bitwidth = type_info.get_comp_param();
784  } else if (type_info.get_compression() == kENCODING_DICT) {
785  type_bitwidth = 8 * type_info.get_size();
786  }
787  CHECK_EQ(size_t(0), type_bitwidth % 8);
788  int64_t val;
789  if (type_info.is_date_in_days()) {
790  val = type_info.get_comp_param() == 16
792  byte_stream, 2, NULL_SMALLINT, NULL_BIGINT, pos)
794  byte_stream, 4, NULL_INT, NULL_BIGINT, pos);
795  } else {
796  val = (type_info.get_compression() == kENCODING_DICT &&
797  type_info.get_size() < type_info.get_logical_size() &&
798  type_info.get_comp_param())
799  ? fixed_width_unsigned_decode_noinline(byte_stream, type_bitwidth / 8, pos)
800  : fixed_width_int_decode_noinline(byte_stream, type_bitwidth / 8, pos);
801  }
802  if (type_info.get_compression() != kENCODING_NONE &&
803  type_info.get_compression() != kENCODING_DATE_IN_DAYS) {
804  CHECK(type_info.get_compression() == kENCODING_FIXED ||
805  type_info.get_compression() == kENCODING_DICT);
806  auto encoding = type_info.get_compression();
807  if (encoding == kENCODING_FIXED) {
808  encoding = kENCODING_NONE;
809  }
810  SQLTypeInfo col_logical_ti(type_info.get_type(),
811  type_info.get_dimension(),
812  type_info.get_scale(),
813  false,
814  encoding,
815  0,
816  type_info.get_subtype());
817  if (val == inline_fixed_encoding_null_val(type_info)) {
818  return inline_int_null_val(col_logical_ti);
819  }
820  }
821  return val;
822 }
const SQLTypeInfo type
Definition: ResultSet.h:236
#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:184
size_t get_bit_width(const SQLTypeInfo &ti)
bool is_column() const
Definition: sqltypes.h:430
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:183
encoding
Definition: setup.py:9
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
Definition: ResultSet.h:234
#define NULL_SMALLINT
Definition: sqltypes.h:182
SQLTypeInfo get_elem_type() const
Definition: sqltypes.h:624
#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: