OmniSciDB  dfae7c3b14
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 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 }
int get_rte_idx() const
Definition: Analyzer.h:196
+ 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 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:78
+ 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  const auto& ti = (ti_.is_column() ? ti_.get_elem_type() : ti_);
32  switch (enc_type) {
33  case kENCODING_NONE: {
34  const auto int_type = ti.is_decimal() ? decimal_to_int_type(ti) : ti.get_type();
35  switch (int_type) {
36  case kBOOLEAN:
37  return std::make_shared<FixedWidthInt>(1);
38  case kTINYINT:
39  return std::make_shared<FixedWidthInt>(1);
40  case kSMALLINT:
41  return std::make_shared<FixedWidthInt>(2);
42  case kINT:
43  return std::make_shared<FixedWidthInt>(4);
44  case kBIGINT:
45  return std::make_shared<FixedWidthInt>(8);
46  case kFLOAT:
47  return std::make_shared<FixedWidthReal>(false);
48  case kDOUBLE:
49  return std::make_shared<FixedWidthReal>(true);
50  case kTIME:
51  case kTIMESTAMP:
52  case kDATE:
53  return std::make_shared<FixedWidthInt>(8);
54  default:
55  CHECK(false);
56  }
57  }
58  case kENCODING_DICT:
59  CHECK(ti.is_string());
60  // For dictionary-encoded columns encoded on less than 4 bytes, we can use
61  // unsigned representation for double the maximum cardinality. The inline
62  // null value is going to be the maximum value of the underlying type.
63  if (ti.get_size() < ti.get_logical_size()) {
64  return std::make_shared<FixedWidthUnsigned>(ti.get_size());
65  }
66  return std::make_shared<FixedWidthInt>(ti.get_size());
67  case kENCODING_FIXED: {
68  const auto bit_width = col_var->get_comp_param();
69  CHECK_EQ(0, bit_width % 8);
70  return std::make_shared<FixedWidthInt>(bit_width / 8);
71  }
73  CHECK(ti.is_date_in_days());
74  return col_var->get_comp_param() == 16 ? 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:205
Definition: sqltypes.h:51
SQLTypes decimal_to_int_type(const SQLTypeInfo &ti)
Definition: Datum.cpp:302
Definition: sqltypes.h:55
EncodingType get_compression() const
Definition: Analyzer.h:197
const SQLTypeInfo & get_type_info() const
Definition: Analyzer.h:78
#define CHECK(condition)
Definition: Logger.h:197
Definition: sqltypes.h:47
int get_comp_param() const
Definition: Analyzer.h:198
+ 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 358 of file ColumnIR.cpp.

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

Referenced by CodeGenerator::codgenAdjustFixedEncNull().

358  {
359  switch (byte_sz) {
360  case 1:
361  return kBOOLEAN;
362  // TODO: kTINYINT
363  case 2:
364  return kSMALLINT;
365  case 4:
366  return kINT;
367  case 8:
368  return kBIGINT;
369  default:
370  CHECK(false);
371  }
372  return kNULLT;
373 }
#define CHECK(condition)
Definition: Logger.h:197
Definition: sqltypes.h:47
+ Here is the caller graph for this function: