OmniSciDB  0264ff685a
RexLiteral Class Reference

#include <RelAlgDagBuilder.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 68 of file RelAlgDagBuilder.h.

Constructor & Destructor Documentation

◆ RexLiteral() [1/5]

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 70 of file RelAlgDagBuilder.h.

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

77  : literal_(val)
78  , type_(type)
79  , target_type_(target_type)
80  , scale_(scale)
81  , precision_(precision)
82  , type_scale_(type_scale)
83  , type_precision_(type_precision) {
86  type == kINT);
87  }
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_
#define CHECK(condition)
Definition: Logger.h:197
Definition: sqltypes.h:44
const unsigned scale_
constexpr auto is_datetime(SQLTypes type)
Definition: sqltypes.h:254
+ Here is the call graph for this function:

◆ RexLiteral() [2/5]

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 89 of file RelAlgDagBuilder.h.

References CHECK_EQ, and kDOUBLE.

96  : literal_(val)
97  , type_(type)
98  , target_type_(target_type)
99  , scale_(scale)
100  , precision_(precision)
101  , type_scale_(type_scale)
102  , type_precision_(type_precision) {
104  }
#define CHECK_EQ(x, y)
Definition: Logger.h:205
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() [3/5]

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 106 of file RelAlgDagBuilder.h.

References CHECK_EQ, and kTEXT.

113  : literal_(val)
114  , type_(type)
115  , target_type_(target_type)
116  , scale_(scale)
117  , precision_(precision)
118  , type_scale_(type_scale)
119  , type_precision_(type_precision) {
120  CHECK_EQ(kTEXT, type);
121  }
#define CHECK_EQ(x, y)
Definition: Logger.h:205
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:51
const SQLTypes target_type_
const unsigned scale_

◆ RexLiteral() [4/5]

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 123 of file RelAlgDagBuilder.h.

References CHECK_EQ, and kBOOLEAN.

130  : literal_(val)
131  , type_(type)
132  , target_type_(target_type)
133  , scale_(scale)
134  , precision_(precision)
135  , type_scale_(type_scale)
136  , type_precision_(type_precision) {
138  }
#define CHECK_EQ(x, y)
Definition: Logger.h:205
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() [5/5]

RexLiteral::RexLiteral ( const SQLTypes  target_type)
inline

Definition at line 140 of file RelAlgDagBuilder.h.

141  : literal_(nullptr)
142  , type_(kNULLT)
143  , target_type_(target_type)
144  , scale_(0)
145  , precision_(0)
146  , type_scale_(0)
147  , 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

◆ deepCopy()

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

Definition at line 179 of file RelAlgDagBuilder.h.

References CHECK.

179  {
180  switch (literal_.which()) {
181  case 0: {
182  int64_t val = getVal<int64_t>();
183  return std::make_unique<RexLiteral>(
185  }
186  case 1: {
187  double val = getVal<double>();
188  return std::make_unique<RexLiteral>(
190  }
191  case 2: {
192  auto val = getVal<std::string>();
193  return std::make_unique<RexLiteral>(
195  }
196  case 3: {
197  bool val = getVal<bool>();
198  return std::make_unique<RexLiteral>(
200  }
201  case 4: {
202  return std::make_unique<RexLiteral>(target_type_);
203  }
204  default:
205  CHECK(false);
206  }
207  return nullptr;
208  }
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_
#define CHECK(condition)
Definition: Logger.h:197
const unsigned scale_

◆ getPrecision()

unsigned RexLiteral::getPrecision ( ) const
inline

Definition at line 162 of file RelAlgDagBuilder.h.

162 { return precision_; }
const unsigned precision_

◆ getScale()

unsigned RexLiteral::getScale ( ) const
inline

Definition at line 160 of file RelAlgDagBuilder.h.

160 { return scale_; }
const unsigned scale_

◆ getTargetType()

SQLTypes RexLiteral::getTargetType ( ) const
inline

Definition at line 158 of file RelAlgDagBuilder.h.

158 { return target_type_; }
const SQLTypes target_type_

◆ getType()

SQLTypes RexLiteral::getType ( ) const
inline

Definition at line 156 of file RelAlgDagBuilder.h.

156 { return type_; }
const SQLTypes type_

◆ getTypePrecision()

unsigned RexLiteral::getTypePrecision ( ) const
inline

Definition at line 166 of file RelAlgDagBuilder.h.

166 { return type_precision_; }
const unsigned type_precision_

◆ getTypeScale()

unsigned RexLiteral::getTypeScale ( ) const
inline

Definition at line 164 of file RelAlgDagBuilder.h.

164 { return type_scale_; }
const unsigned type_scale_

◆ getVal()

template<class T >
T RexLiteral::getVal ( ) const
inline

Definition at line 150 of file RelAlgDagBuilder.h.

References CHECK.

150  {
151  const auto ptr = boost::get<T>(&literal_);
152  CHECK(ptr);
153  return *ptr;
154  }
const boost::variant< int64_t, double, std::string, bool, void * > literal_
#define CHECK(condition)
Definition: Logger.h:197

◆ toString()

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

Implements Rex.

Definition at line 168 of file RelAlgDagBuilder.h.

References cat(), kNULLT, and Rex::toString().

168  {
169  return cat(::typeName(this),
170  "(",
171  boost::lexical_cast<std::string>(literal_),
172  ", type=",
173  (type_ == kNULLT ? "null" : ::toString(type_)),
174  ", target_type=",
175  (target_type_ == kNULLT ? "null" : ::toString(target_type_)),
176  ")");
177  }
std::string toString() const override
const boost::variant< int64_t, double, std::string, bool, void * > literal_
std::string cat(Ts &&... args)
const SQLTypes type_
const SQLTypes target_type_
+ Here is the call graph for this function:

Member Data Documentation

◆ literal_

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

Definition at line 211 of file RelAlgDagBuilder.h.

◆ precision_

const unsigned RexLiteral::precision_
private

Definition at line 215 of file RelAlgDagBuilder.h.

◆ scale_

const unsigned RexLiteral::scale_
private

Definition at line 214 of file RelAlgDagBuilder.h.

◆ target_type_

const SQLTypes RexLiteral::target_type_
private

Definition at line 213 of file RelAlgDagBuilder.h.

◆ type_

const SQLTypes RexLiteral::type_
private

Definition at line 212 of file RelAlgDagBuilder.h.

◆ type_precision_

const unsigned RexLiteral::type_precision_
private

Definition at line 217 of file RelAlgDagBuilder.h.

◆ type_scale_

const unsigned RexLiteral::type_scale_
private

Definition at line 216 of file RelAlgDagBuilder.h.


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