OmniSciDB  06b3bd477c
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 }
int get_rte_idx() const
Definition: Analyzer.h:197

+ 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(), 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:50
EncodingType get_compression() const
Definition: Analyzer.h:198
CHECK(cgen_state)
const SQLTypeInfo & get_type_info() const
Definition: Analyzer.h:79
SQLTypes decimal_to_int_type(const SQLTypeInfo &ti)
Definition: Datum.cpp:311
Definition: sqltypes.h:54
int get_comp_param() const
Definition: Analyzer.h:199
Definition: sqltypes.h:46

+ 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 352 of file ColumnIR.cpp.

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

Referenced by CodeGenerator::codgenAdjustFixedEncNull().

352  {
353  switch (byte_sz) {
354  case 1:
355  return kBOOLEAN;
356  // TODO: kTINYINT
357  case 2:
358  return kSMALLINT;
359  case 4:
360  return kINT;
361  case 8:
362  return kBIGINT;
363  default:
364  CHECK(false);
365  }
366  return kNULLT;
367 }
CHECK(cgen_state)
Definition: sqltypes.h:46

+ Here is the call graph for this function:

+ Here is the caller graph for this function: