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

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

79  : literal_(val)
80  , type_(type)
81  , target_type_(target_type)
82  , scale_(scale)
83  , precision_(precision)
84  , type_scale_(type_scale)
85  , type_precision_(type_precision) {
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:197
const unsigned scale_
constexpr auto is_datetime(SQLTypes type)
Definition: sqltypes.h:202
+ 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 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: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 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: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:54
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 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: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 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

◆ deepCopy()

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

Definition at line 180 of file RelAlgDagBuilder.h.

References CHECK.

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:197
const unsigned scale_

◆ getPrecision()

unsigned RexLiteral::getPrecision ( ) const
inline

Definition at line 163 of file RelAlgDagBuilder.h.

163 { return precision_; }
const unsigned precision_

◆ getScale()

unsigned RexLiteral::getScale ( ) const
inline

Definition at line 161 of file RelAlgDagBuilder.h.

161 { return scale_; }
const unsigned scale_

◆ getTargetType()

SQLTypes RexLiteral::getTargetType ( ) const
inline

Definition at line 159 of file RelAlgDagBuilder.h.

159 { return target_type_; }
const SQLTypes target_type_

◆ getType()

SQLTypes RexLiteral::getType ( ) const
inline

Definition at line 157 of file RelAlgDagBuilder.h.

157 { return type_; }
const SQLTypes type_

◆ getTypePrecision()

unsigned RexLiteral::getTypePrecision ( ) const
inline

Definition at line 167 of file RelAlgDagBuilder.h.

167 { return type_precision_; }
const unsigned type_precision_

◆ getTypeScale()

unsigned RexLiteral::getTypeScale ( ) const
inline

Definition at line 165 of file RelAlgDagBuilder.h.

165 { return type_scale_; }
const unsigned type_scale_

◆ getVal()

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

Definition at line 151 of file RelAlgDagBuilder.h.

References CHECK.

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:197

◆ toString()

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

Implements Rex.

Definition at line 169 of file RelAlgDagBuilder.h.

References cat(), kNULLT, and sql_type_to_str().

169  {
170  return cat(::typeName(this),
171  "(",
172  boost::lexical_cast<std::string>(literal_),
173  ", type=",
174  (type_ == kNULLT ? "null" : sql_type_to_str(type_)),
175  ", target_type=",
177  ")");
178  }
const boost::variant< int64_t, double, std::string, bool, void * > literal_
std::string cat(Ts &&... args)
const SQLTypes type_
const SQLTypes target_type_
std::string sql_type_to_str(const SQLTypes &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 212 of file RelAlgDagBuilder.h.

◆ precision_

const unsigned RexLiteral::precision_
private

Definition at line 216 of file RelAlgDagBuilder.h.

◆ scale_

const unsigned RexLiteral::scale_
private

Definition at line 215 of file RelAlgDagBuilder.h.

◆ target_type_

const SQLTypes RexLiteral::target_type_
private

Definition at line 214 of file RelAlgDagBuilder.h.

◆ type_

const SQLTypes RexLiteral::type_
private

Definition at line 213 of file RelAlgDagBuilder.h.

◆ type_precision_

const unsigned RexLiteral::type_precision_
private

Definition at line 218 of file RelAlgDagBuilder.h.

◆ type_scale_

const unsigned RexLiteral::type_scale_
private

Definition at line 217 of file RelAlgDagBuilder.h.


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