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

#include <RelAlgDag.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 target_scale, const unsigned target_precision)
 
 RexLiteral (const double val, const SQLTypes type, const SQLTypes target_type, const unsigned scale, const unsigned precision, const unsigned target_scale, const unsigned target_precision)
 
 RexLiteral (const std::string &val, const SQLTypes type, const SQLTypes target_type, const unsigned scale, const unsigned precision, const unsigned target_scale, const unsigned target_precision)
 
 RexLiteral (const bool val, const SQLTypes type, const SQLTypes target_type, const unsigned scale, const unsigned precision, const unsigned target_scale, const unsigned target_precision)
 
 RexLiteral (const SQLTypes target_type)
 
template<class T >
getVal () const
 
SQLTypes getType () const
 
SQLTypes getTargetType () const
 
unsigned getScale () const
 
unsigned getPrecision () const
 
unsigned getTargetScale () const
 
unsigned getTargetPrecision () const
 
std::string toString (RelRexToStringConfig config=RelRexToStringConfig::defaults()) const override
 
size_t toHash () 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 target_scale_
 
const unsigned target_precision_
 

Additional Inherited Members

- Protected Attributes inherited from Rex
std::optional< size_t > hash_
 

Detailed Description

Definition at line 93 of file RelAlgDag.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  target_scale,
const unsigned  target_precision 
)
inline

Definition at line 95 of file RelAlgDag.h.

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

Referenced by toHash().

102  : literal_(val)
103  , type_(type)
104  , target_type_(target_type)
105  , scale_(scale)
106  , precision_(precision)
107  , target_scale_(target_scale)
108  , target_precision_(target_precision) {
111  type == kINT);
112  }
const boost::variant< int64_t, double, std::string, bool, void * > literal_
Definition: RelAlgDag.h:221
const unsigned precision_
Definition: RelAlgDag.h:225
const SQLTypes type_
Definition: RelAlgDag.h:222
const SQLTypes target_type_
Definition: RelAlgDag.h:223
#define CHECK(condition)
Definition: Logger.h:222
const unsigned target_precision_
Definition: RelAlgDag.h:227
const unsigned target_scale_
Definition: RelAlgDag.h:226
Definition: sqltypes.h:59
const unsigned scale_
Definition: RelAlgDag.h:224
constexpr auto is_datetime(SQLTypes type)
Definition: sqltypes.h:338

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

RexLiteral::RexLiteral ( const double  val,
const SQLTypes  type,
const SQLTypes  target_type,
const unsigned  scale,
const unsigned  precision,
const unsigned  target_scale,
const unsigned  target_precision 
)
inline

Definition at line 114 of file RelAlgDag.h.

References CHECK_EQ, and kDOUBLE.

121  : literal_(val)
122  , type_(type)
123  , target_type_(target_type)
124  , scale_(scale)
125  , precision_(precision)
126  , target_scale_(target_scale)
127  , target_precision_(target_precision) {
129  }
#define CHECK_EQ(x, y)
Definition: Logger.h:230
const boost::variant< int64_t, double, std::string, bool, void * > literal_
Definition: RelAlgDag.h:221
const unsigned precision_
Definition: RelAlgDag.h:225
const SQLTypes type_
Definition: RelAlgDag.h:222
const SQLTypes target_type_
Definition: RelAlgDag.h:223
const unsigned target_precision_
Definition: RelAlgDag.h:227
const unsigned target_scale_
Definition: RelAlgDag.h:226
const unsigned scale_
Definition: RelAlgDag.h:224
RexLiteral::RexLiteral ( const std::string &  val,
const SQLTypes  type,
const SQLTypes  target_type,
const unsigned  scale,
const unsigned  precision,
const unsigned  target_scale,
const unsigned  target_precision 
)
inline

Definition at line 131 of file RelAlgDag.h.

References CHECK_EQ, and kTEXT.

138  : literal_(val)
139  , type_(type)
140  , target_type_(target_type)
141  , scale_(scale)
142  , precision_(precision)
143  , target_scale_(target_scale)
144  , target_precision_(target_precision) {
145  CHECK_EQ(kTEXT, type);
146  }
#define CHECK_EQ(x, y)
Definition: Logger.h:230
const boost::variant< int64_t, double, std::string, bool, void * > literal_
Definition: RelAlgDag.h:221
const unsigned precision_
Definition: RelAlgDag.h:225
const SQLTypes type_
Definition: RelAlgDag.h:222
Definition: sqltypes.h:66
const SQLTypes target_type_
Definition: RelAlgDag.h:223
const unsigned target_precision_
Definition: RelAlgDag.h:227
const unsigned target_scale_
Definition: RelAlgDag.h:226
const unsigned scale_
Definition: RelAlgDag.h:224
RexLiteral::RexLiteral ( const bool  val,
const SQLTypes  type,
const SQLTypes  target_type,
const unsigned  scale,
const unsigned  precision,
const unsigned  target_scale,
const unsigned  target_precision 
)
inline

Definition at line 148 of file RelAlgDag.h.

References CHECK_EQ, and kBOOLEAN.

155  : literal_(val)
156  , type_(type)
157  , target_type_(target_type)
158  , scale_(scale)
159  , precision_(precision)
160  , target_scale_(target_scale)
161  , target_precision_(target_precision) {
163  }
#define CHECK_EQ(x, y)
Definition: Logger.h:230
const boost::variant< int64_t, double, std::string, bool, void * > literal_
Definition: RelAlgDag.h:221
const unsigned precision_
Definition: RelAlgDag.h:225
const SQLTypes type_
Definition: RelAlgDag.h:222
const SQLTypes target_type_
Definition: RelAlgDag.h:223
const unsigned target_precision_
Definition: RelAlgDag.h:227
const unsigned target_scale_
Definition: RelAlgDag.h:226
const unsigned scale_
Definition: RelAlgDag.h:224
RexLiteral::RexLiteral ( const SQLTypes  target_type)
inline

Definition at line 165 of file RelAlgDag.h.

166  : literal_(nullptr)
167  , type_(kNULLT)
168  , target_type_(target_type)
169  , scale_(0)
170  , precision_(0)
171  , target_scale_(0)
172  , target_precision_(0) {}
const boost::variant< int64_t, double, std::string, bool, void * > literal_
Definition: RelAlgDag.h:221
const unsigned precision_
Definition: RelAlgDag.h:225
const SQLTypes type_
Definition: RelAlgDag.h:222
const SQLTypes target_type_
Definition: RelAlgDag.h:223
const unsigned target_precision_
Definition: RelAlgDag.h:227
const unsigned target_scale_
Definition: RelAlgDag.h:226
const unsigned scale_
Definition: RelAlgDag.h:224

Member Function Documentation

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

Definition at line 216 of file RelAlgDag.h.

216  {
217  return std::make_unique<RexLiteral>(*this);
218  }
unsigned RexLiteral::getPrecision ( ) const
inline

Definition at line 187 of file RelAlgDag.h.

References precision_.

187 { return precision_; }
const unsigned precision_
Definition: RelAlgDag.h:225
unsigned RexLiteral::getScale ( ) const
inline

Definition at line 185 of file RelAlgDag.h.

References scale_.

185 { return scale_; }
const unsigned scale_
Definition: RelAlgDag.h:224
unsigned RexLiteral::getTargetPrecision ( ) const
inline

Definition at line 191 of file RelAlgDag.h.

References target_precision_.

191 { return target_precision_; }
const unsigned target_precision_
Definition: RelAlgDag.h:227
unsigned RexLiteral::getTargetScale ( ) const
inline

Definition at line 189 of file RelAlgDag.h.

References target_scale_.

189 { return target_scale_; }
const unsigned target_scale_
Definition: RelAlgDag.h:226
SQLTypes RexLiteral::getTargetType ( ) const
inline

Definition at line 183 of file RelAlgDag.h.

References target_type_.

183 { return target_type_; }
const SQLTypes target_type_
Definition: RelAlgDag.h:223
SQLTypes RexLiteral::getType ( ) const
inline

Definition at line 181 of file RelAlgDag.h.

References type_.

181 { return type_; }
const SQLTypes type_
Definition: RelAlgDag.h:222
template<class T >
T RexLiteral::getVal ( ) const
inline

Definition at line 175 of file RelAlgDag.h.

References CHECK, and literal_.

175  {
176  const auto ptr = boost::get<T>(&literal_);
177  CHECK(ptr);
178  return *ptr;
179  }
const boost::variant< int64_t, double, std::string, bool, void * > literal_
Definition: RelAlgDag.h:221
#define CHECK(condition)
Definition: Logger.h:222
size_t RexLiteral::toHash ( ) const
inlineoverridevirtual

Implements Rex.

Definition at line 202 of file RelAlgDag.h.

References Rex::hash_, literal_, precision_, RexLiteral(), scale_, target_precision_, target_scale_, target_type_, and type_.

202  {
203  if (!hash_) {
204  hash_ = typeid(RexLiteral).hash_code();
205  boost::hash_combine(*hash_, literal_);
206  boost::hash_combine(*hash_, type_);
207  boost::hash_combine(*hash_, target_type_);
208  boost::hash_combine(*hash_, scale_);
209  boost::hash_combine(*hash_, precision_);
210  boost::hash_combine(*hash_, target_scale_);
211  boost::hash_combine(*hash_, target_precision_);
212  }
213  return *hash_;
214  }
const boost::variant< int64_t, double, std::string, bool, void * > literal_
Definition: RelAlgDag.h:221
const unsigned precision_
Definition: RelAlgDag.h:225
RexLiteral(const int64_t val, const SQLTypes type, const SQLTypes target_type, const unsigned scale, const unsigned precision, const unsigned target_scale, const unsigned target_precision)
Definition: RelAlgDag.h:95
std::optional< size_t > hash_
Definition: RelAlgDag.h:62
const SQLTypes type_
Definition: RelAlgDag.h:222
const SQLTypes target_type_
Definition: RelAlgDag.h:223
const unsigned target_precision_
Definition: RelAlgDag.h:227
const unsigned target_scale_
Definition: RelAlgDag.h:226
const unsigned scale_
Definition: RelAlgDag.h:224

+ Here is the call graph for this function:

std::string RexLiteral::toString ( RelRexToStringConfig  config = RelRexToStringConfig::defaults()) const
inlineoverridevirtual

Implements Rex.

Definition at line 193 of file RelAlgDag.h.

References literal_, precision_, scale_, target_precision_, target_scale_, target_type_, and type_.

194  {
195  std::ostringstream oss;
196  oss << "RexLiteral(" << literal_ << " type=" << type_ << '(' << precision_ << ','
197  << scale_ << ") target_type=" << target_type_ << '(' << target_precision_ << ','
198  << target_scale_ << "))";
199  return oss.str();
200  }
const boost::variant< int64_t, double, std::string, bool, void * > literal_
Definition: RelAlgDag.h:221
const unsigned precision_
Definition: RelAlgDag.h:225
const SQLTypes type_
Definition: RelAlgDag.h:222
const SQLTypes target_type_
Definition: RelAlgDag.h:223
const unsigned target_precision_
Definition: RelAlgDag.h:227
const unsigned target_scale_
Definition: RelAlgDag.h:226
const unsigned scale_
Definition: RelAlgDag.h:224

Member Data Documentation

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

Definition at line 221 of file RelAlgDag.h.

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

const unsigned RexLiteral::precision_
private

Definition at line 225 of file RelAlgDag.h.

Referenced by getPrecision(), toHash(), and toString().

const unsigned RexLiteral::scale_
private

Definition at line 224 of file RelAlgDag.h.

Referenced by getScale(), toHash(), and toString().

const unsigned RexLiteral::target_precision_
private

Definition at line 227 of file RelAlgDag.h.

Referenced by getTargetPrecision(), toHash(), and toString().

const unsigned RexLiteral::target_scale_
private

Definition at line 226 of file RelAlgDag.h.

Referenced by getTargetScale(), toHash(), and toString().

const SQLTypes RexLiteral::target_type_
private

Definition at line 223 of file RelAlgDag.h.

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

const SQLTypes RexLiteral::type_
private

Definition at line 222 of file RelAlgDag.h.

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


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