OmniSciDB  04ee39c94c
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

◆ adjusted_range_table_index()

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

Definition at line 86 of file ColumnIR.cpp.

References Analyzer::ColumnVar::get_rte_idx().

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

86  {
87  return col_var->get_rte_idx() == -1 ? 0 : col_var->get_rte_idx();
88 }
int get_rte_idx() const
Definition: Analyzer.h:195
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_col_bit_width()

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

Definition at line 81 of file ColumnIR.cpp.

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

Referenced by CodeGenerator::codegenFixedLengthColVar().

81  {
82  const auto& type_info = col_var->get_type_info();
83  return get_bit_width(type_info);
84 }
size_t get_bit_width(const SQLTypeInfo &ti)
const SQLTypeInfo & get_type_info() const
Definition: Analyzer.h:77
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_col_decoder()

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(), Analyzer::ColumnVar::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_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_comp_param() == 16 ? std::make_shared<FixedWidthSmallDate>(2)
74  : std::make_shared<FixedWidthSmallDate>(4);
75  }
76  default:
77  abort();
78  }
79 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
Definition: sqltypes.h:51
SQLTypes decimal_to_int_type(const SQLTypeInfo &ti)
Definition: Datum.cpp:268
Definition: sqltypes.h:55
EncodingType get_compression() const
Definition: Analyzer.h:196
const SQLTypeInfo & get_type_info() const
Definition: Analyzer.h:77
#define CHECK(condition)
Definition: Logger.h:187
Definition: sqltypes.h:47
int get_comp_param() const
Definition: Analyzer.h:197
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_phys_int_type()

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

Definition at line 346 of file ColumnIR.cpp.

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

Referenced by CodeGenerator::codgenAdjustFixedEncNull().

346  {
347  switch (byte_sz) {
348  case 1:
349  return kBOOLEAN;
350  // TODO: kTINYINT
351  case 2:
352  return kSMALLINT;
353  case 4:
354  return kINT;
355  case 8:
356  return kBIGINT;
357  default:
358  CHECK(false);
359  }
360  return kNULLT;
361 }
#define CHECK(condition)
Definition: Logger.h:187
Definition: sqltypes.h:47
+ Here is the caller graph for this function: