OmniSciDB  b24e664e58
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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::Expr
analyzeValue (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 165 of file ParserNode.h.

Constructor & Destructor Documentation

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

Definition at line 167 of file ParserNode.h.

167 : intval(i) {}

Member Function Documentation

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 105 of file ParserNode.cpp.

108  {
109  return analyzeValue(intval);
110 }
static std::shared_ptr< Analyzer::Expr > analyzeValue(const int64_t intval)
Definition: ParserNode.cpp:112
std::shared_ptr< Analyzer::Expr > Parser::IntLiteral::analyzeValue ( const int64_t  intval)
static

Definition at line 112 of file ParserNode.cpp.

References Datum::bigintval, Datum::intval, kBIGINT, kINT, kSMALLINT, and Datum::smallintval.

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

112  {
113  SQLTypes t;
114  Datum d;
115  if (intval >= INT16_MIN && intval <= INT16_MAX) {
116  t = kSMALLINT;
117  d.smallintval = (int16_t)intval;
118  } else if (intval >= INT32_MIN && intval <= INT32_MAX) {
119  t = kINT;
120  d.intval = (int32_t)intval;
121  } else {
122  t = kBIGINT;
123  d.bigintval = intval;
124  }
125  return makeExpr<Analyzer::Constant>(t, false, d);
126 }
SQLTypes
Definition: sqltypes.h:41
int32_t intval
Definition: sqltypes.h:128
int64_t bigintval
Definition: sqltypes.h:129
int16_t smallintval
Definition: sqltypes.h:127
Definition: sqltypes.h:48

+ Here is the caller graph for this function:

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

Definition at line 168 of file ParserNode.h.

References intval.

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

168 { return intval; }

+ Here is the caller graph for this function:

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

Implements Parser::Literal.

Definition at line 174 of file ParserNode.h.

References intval.

174  {
175  return boost::lexical_cast<std::string>(intval);
176  }

Member Data Documentation

int64_t Parser::IntLiteral::intval
private

Definition at line 179 of file ParserNode.h.

Referenced by get_intval(), and to_string().


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