OmniSciDB  fe05a0c208
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 69 of file RelAlgDagBuilder.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 71 of file RelAlgDagBuilder.h.

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

78  : literal_(val)
79  , type_(type)
80  , target_type_(target_type)
81  , scale_(scale)
82  , precision_(precision)
83  , type_scale_(type_scale)
84  , type_precision_(type_precision) {
87  type == kINT);
88  }
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:203
Definition: sqltypes.h:44
const unsigned scale_
constexpr auto is_datetime(SQLTypes type)
Definition: sqltypes.h:257

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

References CHECK_EQ, and kDOUBLE.

97  : literal_(val)
98  , type_(type)
99  , target_type_(target_type)
100  , scale_(scale)
101  , precision_(precision)
102  , type_scale_(type_scale)
103  , type_precision_(type_precision) {
105  }
#define CHECK_EQ(x, y)
Definition: Logger.h:211
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 107 of file RelAlgDagBuilder.h.

References CHECK_EQ, and kTEXT.

114  : literal_(val)
115  , type_(type)
116  , target_type_(target_type)
117  , scale_(scale)
118  , precision_(precision)
119  , type_scale_(type_scale)
120  , type_precision_(type_precision) {
121  CHECK_EQ(kTEXT, type);
122  }
#define CHECK_EQ(x, y)
Definition: Logger.h:211
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::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 124 of file RelAlgDagBuilder.h.

References CHECK_EQ, and kBOOLEAN.

131  : literal_(val)
132  , type_(type)
133  , target_type_(target_type)
134  , scale_(scale)
135  , precision_(precision)
136  , type_scale_(type_scale)
137  , type_precision_(type_precision) {
139  }
#define CHECK_EQ(x, y)
Definition: Logger.h:211
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 141 of file RelAlgDagBuilder.h.

142  : literal_(nullptr)
143  , type_(kNULLT)
144  , target_type_(target_type)
145  , scale_(0)
146  , precision_(0)
147  , type_scale_(0)
148  , 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 180 of file RelAlgDagBuilder.h.

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

180  {
181  switch (literal_.which()) {
182  case 0: {
183  int64_t val = getVal<int64_t>();
184  return std::make_unique<RexLiteral>(
186  }
187  case 1: {
188  double val = getVal<double>();
189  return std::make_unique<RexLiteral>(
191  }
192  case 2: {
193  auto val = getVal<std::string>();
194  return std::make_unique<RexLiteral>(
196  }
197  case 3: {
198  bool val = getVal<bool>();
199  return std::make_unique<RexLiteral>(
201  }
202  case 4: {
203  return std::make_unique<RexLiteral>(target_type_);
204  }
205  default:
206  CHECK(false);
207  }
208  return nullptr;
209  }
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:203
const unsigned scale_
unsigned RexLiteral::getPrecision ( ) const
inline

Definition at line 163 of file RelAlgDagBuilder.h.

References precision_.

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

Definition at line 161 of file RelAlgDagBuilder.h.

References scale_.

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

Definition at line 159 of file RelAlgDagBuilder.h.

References target_type_.

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

Definition at line 157 of file RelAlgDagBuilder.h.

References type_.

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

Definition at line 167 of file RelAlgDagBuilder.h.

References type_precision_.

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

Definition at line 165 of file RelAlgDagBuilder.h.

References type_scale_.

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

Definition at line 151 of file RelAlgDagBuilder.h.

References CHECK, and literal_.

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

Implements Rex.

Definition at line 169 of file RelAlgDagBuilder.h.

References cat(), kNULLT, literal_, target_type_, Rex::toString(), type_, and typeName().

169  {
170  return cat(::typeName(this),
171  "(",
172  boost::lexical_cast<std::string>(literal_),
173  ", type=",
174  (type_ == kNULLT ? "null" : ::toString(type_)),
175  ", target_type=",
176  (target_type_ == kNULLT ? "null" : ::toString(target_type_)),
177  ")");
178  }
std::string toString() const override
std::string cat(Ts &&...args)
const boost::variant< int64_t, double, std::string, bool, void * > literal_
const SQLTypes type_
std::string typeName(const T *v)
Definition: toString.h:82
const SQLTypes target_type_

+ Here is the call graph for this function:

Member Data Documentation

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

Definition at line 212 of file RelAlgDagBuilder.h.

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

const unsigned RexLiteral::precision_
private

Definition at line 216 of file RelAlgDagBuilder.h.

Referenced by deepCopy(), and getPrecision().

const unsigned RexLiteral::scale_
private

Definition at line 215 of file RelAlgDagBuilder.h.

Referenced by deepCopy(), and getScale().

const SQLTypes RexLiteral::target_type_
private

Definition at line 214 of file RelAlgDagBuilder.h.

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

const SQLTypes RexLiteral::type_
private

Definition at line 213 of file RelAlgDagBuilder.h.

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

const unsigned RexLiteral::type_precision_
private

Definition at line 218 of file RelAlgDagBuilder.h.

Referenced by deepCopy(), and getTypePrecision().

const unsigned RexLiteral::type_scale_
private

Definition at line 217 of file RelAlgDagBuilder.h.

Referenced by deepCopy(), and getTypeScale().


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