OmniSciDB  b24e664e58
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RexLiteral Class Reference

#include <RelAlgAbstractInterpreter.h>

+ Inheritance diagram for RexLiteral:
+ Collaboration diagram for RexLiteral:

Public Member Functions

 RexLiteral (const int64_t val, const SQLTypes type, const SQLTypes target_type, const unsigned scale, const unsigned precision, const unsigned type_scale, const unsigned type_precision)
 
 RexLiteral (const double val, const SQLTypes type, const SQLTypes target_type, const unsigned scale, const unsigned precision, const unsigned type_scale, const unsigned type_precision)
 
 RexLiteral (const std::string &val, const SQLTypes type, const SQLTypes target_type, const unsigned scale, const unsigned precision, const unsigned type_scale, const unsigned type_precision)
 
 RexLiteral (const bool val, const SQLTypes type, const SQLTypes target_type, const unsigned scale, const unsigned precision, const unsigned type_scale, const unsigned type_precision)
 
 RexLiteral (const SQLTypes target_type)
 
template<class T >
getVal () const
 
SQLTypes getType () const
 
SQLTypes getTargetType () const
 
unsigned getScale () const
 
unsigned getPrecision () const
 
unsigned getTypeScale () const
 
unsigned getTypePrecision () const
 
std::string toString () const override
 
std::unique_ptr< RexLiteraldeepCopy () const
 
- Public Member Functions inherited from Rex
virtual ~Rex ()
 

Private Attributes

const boost::variant< int64_t,
double, std::string, bool,
void * > 
literal_
 
const SQLTypes type_
 
const SQLTypes target_type_
 
const unsigned scale_
 
const unsigned precision_
 
const unsigned type_scale_
 
const unsigned type_precision_
 

Detailed Description

Definition at line 66 of file RelAlgAbstractInterpreter.h.

Constructor & Destructor Documentation

RexLiteral::RexLiteral ( const int64_t  val,
const SQLTypes  type,
const SQLTypes  target_type,
const unsigned  scale,
const unsigned  precision,
const unsigned  type_scale,
const unsigned  type_precision 
)
inline

Definition at line 68 of file RelAlgAbstractInterpreter.h.

References CHECK(), is_datetime(), kDECIMAL, kINTERVAL_DAY_TIME, and kINTERVAL_YEAR_MONTH.

75  : literal_(val)
76  , type_(type)
77  , target_type_(target_type)
78  , scale_(scale)
79  , precision_(precision)
80  , type_scale_(type_scale)
81  , type_precision_(type_precision) {
84  }
const unsigned type_scale_
const boost::variant< int64_t, double, std::string, bool, void * > literal_
constexpr auto is_datetime(T sql_type)
Definition: sqltypes.h:194
const unsigned precision_
CHECK(cgen_state)
const unsigned type_precision_
const SQLTypes type_
const SQLTypes target_type_
const unsigned scale_

+ Here is the call graph for this function:

RexLiteral::RexLiteral ( const double  val,
const SQLTypes  type,
const SQLTypes  target_type,
const unsigned  scale,
const unsigned  precision,
const unsigned  type_scale,
const unsigned  type_precision 
)
inline

Definition at line 86 of file RelAlgAbstractInterpreter.h.

References CHECK_EQ, and kDOUBLE.

93  : literal_(val)
94  , type_(type)
95  , target_type_(target_type)
96  , scale_(scale)
97  , precision_(precision)
98  , type_scale_(type_scale)
99  , type_precision_(type_precision) {
101  }
#define CHECK_EQ(x, y)
Definition: Logger.h:198
const unsigned type_scale_
const boost::variant< int64_t, double, std::string, bool, void * > literal_
const unsigned precision_
const unsigned type_precision_
const SQLTypes type_
const SQLTypes target_type_
const unsigned scale_
RexLiteral::RexLiteral ( const std::string &  val,
const SQLTypes  type,
const SQLTypes  target_type,
const unsigned  scale,
const unsigned  precision,
const unsigned  type_scale,
const unsigned  type_precision 
)
inline

Definition at line 103 of file RelAlgAbstractInterpreter.h.

References CHECK_EQ, and kTEXT.

110  : literal_(val)
111  , type_(type)
112  , target_type_(target_type)
113  , scale_(scale)
114  , precision_(precision)
115  , type_scale_(type_scale)
116  , type_precision_(type_precision) {
117  CHECK_EQ(kTEXT, type);
118  }
#define CHECK_EQ(x, y)
Definition: Logger.h:198
const unsigned type_scale_
const boost::variant< int64_t, double, std::string, bool, void * > literal_
const unsigned precision_
const unsigned type_precision_
const SQLTypes type_
Definition: sqltypes.h:55
const SQLTypes target_type_
const unsigned scale_
RexLiteral::RexLiteral ( const bool  val,
const SQLTypes  type,
const SQLTypes  target_type,
const unsigned  scale,
const unsigned  precision,
const unsigned  type_scale,
const unsigned  type_precision 
)
inline

Definition at line 120 of file RelAlgAbstractInterpreter.h.

References CHECK_EQ, and kBOOLEAN.

127  : literal_(val)
128  , type_(type)
129  , target_type_(target_type)
130  , scale_(scale)
131  , precision_(precision)
132  , type_scale_(type_scale)
133  , type_precision_(type_precision) {
135  }
#define CHECK_EQ(x, y)
Definition: Logger.h:198
const unsigned type_scale_
const boost::variant< int64_t, double, std::string, bool, void * > literal_
const unsigned precision_
const unsigned type_precision_
const SQLTypes type_
const SQLTypes target_type_
const unsigned scale_
RexLiteral::RexLiteral ( const SQLTypes  target_type)
inline

Definition at line 137 of file RelAlgAbstractInterpreter.h.

138  : literal_(nullptr)
139  , type_(kNULLT)
140  , target_type_(target_type)
141  , scale_(0)
142  , precision_(0)
143  , type_scale_(0)
144  , type_precision_(0) {}
const unsigned type_scale_
const boost::variant< int64_t, double, std::string, bool, void * > literal_
const unsigned precision_
const unsigned type_precision_
const SQLTypes type_
const SQLTypes target_type_
const unsigned scale_

Member Function Documentation

std::unique_ptr<RexLiteral> RexLiteral::deepCopy ( ) const
inline

Definition at line 169 of file RelAlgAbstractInterpreter.h.

References CHECK(), literal_, precision_, scale_, target_type_, type_, type_precision_, and type_scale_.

169  {
170  switch (literal_.which()) {
171  case 0: {
172  int64_t val = getVal<int64_t>();
173  return std::make_unique<RexLiteral>(
175  }
176  case 1: {
177  double val = getVal<double>();
178  return std::make_unique<RexLiteral>(
180  }
181  case 2: {
182  auto val = getVal<std::string>();
183  return std::make_unique<RexLiteral>(
185  }
186  case 3: {
187  bool val = getVal<bool>();
188  return std::make_unique<RexLiteral>(
190  }
191  case 4: {
192  return std::make_unique<RexLiteral>(target_type_);
193  }
194  default:
195  CHECK(false);
196  }
197  return nullptr;
198  }
const unsigned type_scale_
const boost::variant< int64_t, double, std::string, bool, void * > literal_
const unsigned precision_
CHECK(cgen_state)
const unsigned type_precision_
const SQLTypes type_
const SQLTypes target_type_
const unsigned scale_

+ Here is the call graph for this function:

unsigned RexLiteral::getPrecision ( ) const
inline

Definition at line 159 of file RelAlgAbstractInterpreter.h.

References precision_.

159 { return precision_; }
const unsigned precision_
unsigned RexLiteral::getScale ( ) const
inline

Definition at line 157 of file RelAlgAbstractInterpreter.h.

References scale_.

157 { return scale_; }
const unsigned scale_
SQLTypes RexLiteral::getTargetType ( ) const
inline

Definition at line 155 of file RelAlgAbstractInterpreter.h.

References target_type_.

155 { return target_type_; }
const SQLTypes target_type_
SQLTypes RexLiteral::getType ( ) const
inline

Definition at line 153 of file RelAlgAbstractInterpreter.h.

References type_.

153 { return type_; }
const SQLTypes type_
unsigned RexLiteral::getTypePrecision ( ) const
inline

Definition at line 163 of file RelAlgAbstractInterpreter.h.

References type_precision_.

163 { return type_precision_; }
const unsigned type_precision_
unsigned RexLiteral::getTypeScale ( ) const
inline

Definition at line 161 of file RelAlgAbstractInterpreter.h.

References type_scale_.

161 { return type_scale_; }
const unsigned type_scale_
template<class T >
T RexLiteral::getVal ( ) const
inline

Definition at line 147 of file RelAlgAbstractInterpreter.h.

References CHECK(), and literal_.

147  {
148  const auto ptr = boost::get<T>(&literal_);
149  CHECK(ptr);
150  return *ptr;
151  }
const boost::variant< int64_t, double, std::string, bool, void * > literal_
CHECK(cgen_state)

+ Here is the call graph for this function:

std::string RexLiteral::toString ( ) const
inlineoverridevirtual

Implements Rex.

Definition at line 165 of file RelAlgAbstractInterpreter.h.

References literal_.

165  {
166  return "(RexLiteral " + boost::lexical_cast<std::string>(literal_) + ")";
167  }
const boost::variant< int64_t, double, std::string, bool, void * > literal_

Member Data Documentation

const boost::variant<int64_t, double, std::string, bool, void*> RexLiteral::literal_
private

Definition at line 201 of file RelAlgAbstractInterpreter.h.

Referenced by deepCopy(), getVal(), and toString().

const unsigned RexLiteral::precision_
private

Definition at line 205 of file RelAlgAbstractInterpreter.h.

Referenced by deepCopy(), and getPrecision().

const unsigned RexLiteral::scale_
private

Definition at line 204 of file RelAlgAbstractInterpreter.h.

Referenced by deepCopy(), and getScale().

const SQLTypes RexLiteral::target_type_
private

Definition at line 203 of file RelAlgAbstractInterpreter.h.

Referenced by deepCopy(), and getTargetType().

const SQLTypes RexLiteral::type_
private

Definition at line 202 of file RelAlgAbstractInterpreter.h.

Referenced by deepCopy(), and getType().

const unsigned RexLiteral::type_precision_
private

Definition at line 207 of file RelAlgAbstractInterpreter.h.

Referenced by deepCopy(), and getTypePrecision().

const unsigned RexLiteral::type_scale_
private

Definition at line 206 of file RelAlgAbstractInterpreter.h.

Referenced by deepCopy(), and getTypeScale().


The documentation for this class was generated from the following file: