OmniSciDB  a5dc49c757
 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 88 of file ColumnIR.cpp.

References Analyzer::ColumnVar::get_rte_idx().

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

88  {
89  return col_var->get_rte_idx() == -1 ? 0 : col_var->get_rte_idx();
90 }
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 83 of file ColumnIR.cpp.

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

Referenced by CodeGenerator::codegenFixedLengthColVar().

83  {
84  const auto& type_info = col_var->get_type_info();
85  return get_bit_width(type_info);
86 }
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 29 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().

29  {
30  const auto enc_type = col_var->get_compression();
31  const auto& ti = col_var->get_type_info();
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) << "ti=" << ti;
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_type_info().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_type_info().get_comp_param() == 16
75  ? std::make_shared<FixedWidthSmallDate>(2)
76  : std::make_shared<FixedWidthSmallDate>(4);
77  }
78  default:
79  abort();
80  }
81 }
#define CHECK_EQ(x, y)
Definition: Logger.h:301
Definition: sqltypes.h:76
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:561
Definition: sqltypes.h:80
HOST DEVICE int get_comp_param() const
Definition: sqltypes.h:402
#define CHECK(condition)
Definition: Logger.h:291
Definition: sqltypes.h:72

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

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

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

429  {
430  switch (byte_sz) {
431  case 1:
432  return kBOOLEAN;
433  // TODO: kTINYINT
434  case 2:
435  return kSMALLINT;
436  case 4:
437  return kINT;
438  case 8:
439  return kBIGINT;
440  default:
441  CHECK(false);
442  }
443  return kNULLT;
444 }
#define CHECK(condition)
Definition: Logger.h:291
Definition: sqltypes.h:72

+ Here is the caller graph for this function: