OmniSciDB  7bf56492aa
 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 63 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 65 of file RelAlgDagBuilder.h.

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

72  : literal_(val)
73  , type_(type)
74  , target_type_(target_type)
75  , scale_(scale)
76  , precision_(precision)
77  , type_scale_(type_scale)
78  , type_precision_(type_precision) {
81  }
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_
constexpr auto is_datetime(SQLTypes type)
Definition: sqltypes.h:191

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

References CHECK_EQ, and kDOUBLE.

90  : literal_(val)
91  , type_(type)
92  , target_type_(target_type)
93  , scale_(scale)
94  , precision_(precision)
95  , type_scale_(type_scale)
96  , type_precision_(type_precision) {
98  }
#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::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 100 of file RelAlgDagBuilder.h.

References CHECK_EQ, and kTEXT.

107  : literal_(val)
108  , type_(type)
109  , target_type_(target_type)
110  , scale_(scale)
111  , precision_(precision)
112  , type_scale_(type_scale)
113  , type_precision_(type_precision) {
114  CHECK_EQ(kTEXT, type);
115  }
#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:53
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 117 of file RelAlgDagBuilder.h.

References CHECK_EQ, and kBOOLEAN.

124  : literal_(val)
125  , type_(type)
126  , target_type_(target_type)
127  , scale_(scale)
128  , precision_(precision)
129  , type_scale_(type_scale)
130  , type_precision_(type_precision) {
132  }
#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::RexLiteral ( const SQLTypes  target_type)
inline

Definition at line 134 of file RelAlgDagBuilder.h.

135  : literal_(nullptr)
136  , type_(kNULLT)
137  , target_type_(target_type)
138  , scale_(0)
139  , precision_(0)
140  , type_scale_(0)
141  , 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 166 of file RelAlgDagBuilder.h.

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

166  {
167  switch (literal_.which()) {
168  case 0: {
169  int64_t val = getVal<int64_t>();
170  return std::make_unique<RexLiteral>(
172  }
173  case 1: {
174  double val = getVal<double>();
175  return std::make_unique<RexLiteral>(
177  }
178  case 2: {
179  auto val = getVal<std::string>();
180  return std::make_unique<RexLiteral>(
182  }
183  case 3: {
184  bool val = getVal<bool>();
185  return std::make_unique<RexLiteral>(
187  }
188  case 4: {
189  return std::make_unique<RexLiteral>(target_type_);
190  }
191  default:
192  CHECK(false);
193  }
194  return nullptr;
195  }
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 156 of file RelAlgDagBuilder.h.

References precision_.

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

Definition at line 154 of file RelAlgDagBuilder.h.

References scale_.

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

Definition at line 152 of file RelAlgDagBuilder.h.

References target_type_.

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

Definition at line 150 of file RelAlgDagBuilder.h.

References type_.

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

Definition at line 160 of file RelAlgDagBuilder.h.

References type_precision_.

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

Definition at line 158 of file RelAlgDagBuilder.h.

References type_scale_.

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

Definition at line 144 of file RelAlgDagBuilder.h.

References CHECK(), and literal_.

144  {
145  const auto ptr = boost::get<T>(&literal_);
146  CHECK(ptr);
147  return *ptr;
148  }
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 162 of file RelAlgDagBuilder.h.

References literal_.

162  {
163  return "(RexLiteral " + boost::lexical_cast<std::string>(literal_) + ")";
164  }
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 198 of file RelAlgDagBuilder.h.

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

const unsigned RexLiteral::precision_
private

Definition at line 202 of file RelAlgDagBuilder.h.

Referenced by deepCopy(), and getPrecision().

const unsigned RexLiteral::scale_
private

Definition at line 201 of file RelAlgDagBuilder.h.

Referenced by deepCopy(), and getScale().

const SQLTypes RexLiteral::target_type_
private

Definition at line 200 of file RelAlgDagBuilder.h.

Referenced by deepCopy(), and getTargetType().

const SQLTypes RexLiteral::type_
private

Definition at line 199 of file RelAlgDagBuilder.h.

Referenced by deepCopy(), and getType().

const unsigned RexLiteral::type_precision_
private

Definition at line 204 of file RelAlgDagBuilder.h.

Referenced by deepCopy(), and getTypePrecision().

const unsigned RexLiteral::type_scale_
private

Definition at line 203 of file RelAlgDagBuilder.h.

Referenced by deepCopy(), and getTypeScale().


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