OmniSciDB  04ee39c94c
Parser::IntLiteral Class Reference

#include <ParserNode.h>

+ Inheritance diagram for Parser::IntLiteral:
+ Collaboration diagram for Parser::IntLiteral:

Public Member Functions

 IntLiteral (int64_t i)
 
int64_t get_intval () const
 
std::shared_ptr< Analyzer::Expranalyze (const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
 
std::string to_string () const override
 
- Public Member Functions inherited from Parser::Node
virtual ~Node ()
 

Static Public Member Functions

static std::shared_ptr< Analyzer::ExpranalyzeValue (const int64_t intval)
 

Private Attributes

int64_t intval
 

Additional Inherited Members

- Public Types inherited from Parser::Expr
enum  TlistRefType { TLIST_NONE, TLIST_REF, TLIST_COPY }
 

Detailed Description

Definition at line 154 of file ParserNode.h.

Constructor & Destructor Documentation

◆ IntLiteral()

Parser::IntLiteral::IntLiteral ( int64_t  i)
inlineexplicit

Definition at line 156 of file ParserNode.h.

156 : intval(i) {}

Member Function Documentation

◆ analyze()

std::shared_ptr< Analyzer::Expr > Parser::IntLiteral::analyze ( const Catalog_Namespace::Catalog catalog,
Analyzer::Query query,
TlistRefType  allow_tlist_ref = TLIST_NONE 
) const
overridevirtual

Implements Parser::Literal.

Definition at line 101 of file ParserNode.cpp.

104  {
105  return analyzeValue(intval);
106 }
static std::shared_ptr< Analyzer::Expr > analyzeValue(const int64_t intval)
Definition: ParserNode.cpp:108

◆ analyzeValue()

std::shared_ptr< Analyzer::Expr > Parser::IntLiteral::analyzeValue ( const int64_t  intval)
static

Definition at line 108 of file ParserNode.cpp.

References Datum::bigintval, anonymous_namespace{ImportTest.cpp}::d(), Datum::intval, kBIGINT, kINT, kSMALLINT, and Datum::smallintval.

Referenced by InValuesBitmap::codegen(), CodeGenerator::codegenDeciDiv(), RelAlgTranslator::translateLiteral(), and anonymous_namespace{CalciteAdapter.cpp}::CalciteAdapter::translateTypedLiteral().

108  {
109  SQLTypes t;
110  Datum d;
111  if (intval >= INT16_MIN && intval <= INT16_MAX) {
112  t = kSMALLINT;
113  d.smallintval = (int16_t)intval;
114  } else if (intval >= INT32_MIN && intval <= INT32_MAX) {
115  t = kINT;
116  d.intval = (int32_t)intval;
117  } else {
118  t = kBIGINT;
119  d.bigintval = intval;
120  }
121  return makeExpr<Analyzer::Constant>(t, false, d);
122 }
void d(const SQLTypes expected_type, const std::string &str)
Definition: ImportTest.cpp:268
SQLTypes
Definition: sqltypes.h:40
int32_t intval
Definition: sqltypes.h:125
int64_t bigintval
Definition: sqltypes.h:126
int16_t smallintval
Definition: sqltypes.h:124
Definition: sqltypes.h:47
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_intval()

int64_t Parser::IntLiteral::get_intval ( ) const
inline

Definition at line 157 of file ParserNode.h.

References anonymous_namespace{UpdateMetadataTest.cpp}::query.

Referenced by Parser::QuerySpec::analyze_group_by(), and Parser::CopyTableStmt::execute().

157 { return intval; }
+ Here is the caller graph for this function:

◆ to_string()

std::string Parser::IntLiteral::to_string ( ) const
inlineoverridevirtual

Implements Parser::Literal.

Definition at line 163 of file ParserNode.h.

163  {
164  return boost::lexical_cast<std::string>(intval);
165  }

Member Data Documentation

◆ intval

int64_t Parser::IntLiteral::intval
private

Definition at line 168 of file ParserNode.h.


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