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

Functions

std::shared_ptr< Decoderget_col_decoder (const Analyzer::ColumnVar *col_var)
 
size_t get_col_bit_width (const Analyzer::ColumnVar *col_var)
 
int adjusted_range_table_index (const Analyzer::ColumnVar *col_var)
 
SQLTypes get_phys_int_type (const size_t byte_sz)
 

Function Documentation

int anonymous_namespace{ColumnIR.cpp}::adjusted_range_table_index ( const Analyzer::ColumnVar col_var)

Definition at line 87 of file ColumnIR.cpp.

References Analyzer::ColumnVar::get_rte_idx().

Referenced by CodeGenerator::codegenColVar(), and CodeGenerator::codegenRowId().

87  {
88  return col_var->get_rte_idx() == -1 ? 0 : col_var->get_rte_idx();
89 }
int32_t get_rte_idx() const
Definition: Analyzer.h:202

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t anonymous_namespace{ColumnIR.cpp}::get_col_bit_width ( const Analyzer::ColumnVar col_var)

Definition at line 82 of file ColumnIR.cpp.

References get_bit_width(), and Analyzer::Expr::get_type_info().

Referenced by CodeGenerator::codegenFixedLengthColVar().

82  {
83  const auto& type_info = col_var->get_type_info();
84  return get_bit_width(type_info);
85 }
size_t get_bit_width(const SQLTypeInfo &ti)
const SQLTypeInfo & get_type_info() const
Definition: Analyzer.h:79

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::shared_ptr<Decoder> anonymous_namespace{ColumnIR.cpp}::get_col_decoder ( const Analyzer::ColumnVar col_var)

Definition at line 28 of file ColumnIR.cpp.

References CHECK, CHECK_EQ, decimal_to_int_type(), SQLTypeInfo::get_comp_param(), Analyzer::ColumnVar::get_compression(), Analyzer::Expr::get_type_info(), kBIGINT, kBOOLEAN, kDATE, kDOUBLE, kENCODING_DATE_IN_DAYS, kENCODING_DICT, kENCODING_FIXED, kENCODING_NONE, kFLOAT, kINT, kSMALLINT, kTIME, kTIMESTAMP, and kTINYINT.

Referenced by CodeGenerator::codegenFixedLengthColVar().

28  {
29  const auto enc_type = col_var->get_compression();
30  const auto& ti = col_var->get_type_info();
31  switch (enc_type) {
32  case kENCODING_NONE: {
33  const auto int_type = ti.is_decimal() ? decimal_to_int_type(ti) : ti.get_type();
34  switch (int_type) {
35  case kBOOLEAN:
36  return std::make_shared<FixedWidthInt>(1);
37  case kTINYINT:
38  return std::make_shared<FixedWidthInt>(1);
39  case kSMALLINT:
40  return std::make_shared<FixedWidthInt>(2);
41  case kINT:
42  return std::make_shared<FixedWidthInt>(4);
43  case kBIGINT:
44  return std::make_shared<FixedWidthInt>(8);
45  case kFLOAT:
46  return std::make_shared<FixedWidthReal>(false);
47  case kDOUBLE:
48  return std::make_shared<FixedWidthReal>(true);
49  case kTIME:
50  case kTIMESTAMP:
51  case kDATE:
52  return std::make_shared<FixedWidthInt>(8);
53  default:
54  CHECK(false);
55  }
56  }
57  case kENCODING_DICT:
58  CHECK(ti.is_string());
59  // For dictionary-encoded columns encoded on less than 4 bytes, we can use
60  // unsigned representation for double the maximum cardinality. The inline
61  // null value is going to be the maximum value of the underlying type.
62  if (ti.get_size() < ti.get_logical_size()) {
63  return std::make_shared<FixedWidthUnsigned>(ti.get_size());
64  }
65  return std::make_shared<FixedWidthInt>(ti.get_size());
66  case kENCODING_FIXED: {
67  const auto bit_width = col_var->get_type_info().get_comp_param();
68  CHECK_EQ(0, bit_width % 8);
69  return std::make_shared<FixedWidthInt>(bit_width / 8);
70  }
72  CHECK(ti.is_date_in_days());
73  return col_var->get_type_info().get_comp_param() == 16
74  ? std::make_shared<FixedWidthSmallDate>(2)
75  : std::make_shared<FixedWidthSmallDate>(4);
76  }
77  default:
78  abort();
79  }
80 }
#define CHECK_EQ(x, y)
Definition: Logger.h:301
Definition: sqltypes.h:66
EncodingType get_compression() const
Definition: Analyzer.h:204
const SQLTypeInfo & get_type_info() const
Definition: Analyzer.h:79
SQLTypes decimal_to_int_type(const SQLTypeInfo &ti)
Definition: Datum.cpp:559
Definition: sqltypes.h:70
HOST DEVICE int get_comp_param() const
Definition: sqltypes.h:392
#define CHECK(condition)
Definition: Logger.h:291
Definition: sqltypes.h:62

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SQLTypes anonymous_namespace{ColumnIR.cpp}::get_phys_int_type ( const size_t  byte_sz)

Definition at line 414 of file ColumnIR.cpp.

References CHECK, kBIGINT, kBOOLEAN, kINT, kNULLT, and kSMALLINT.

Referenced by CodeGenerator::codegenHoistedConstantsLoads(), and CodeGenerator::codgenAdjustFixedEncNull().

414  {
415  switch (byte_sz) {
416  case 1:
417  return kBOOLEAN;
418  // TODO: kTINYINT
419  case 2:
420  return kSMALLINT;
421  case 4:
422  return kINT;
423  case 8:
424  return kBIGINT;
425  default:
426  CHECK(false);
427  }
428  return kNULLT;
429 }
#define CHECK(condition)
Definition: Logger.h:291
Definition: sqltypes.h:62

+ Here is the caller graph for this function: