OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Parser::CastExpr Class Reference

#include <ParserNode.h>

+ Inheritance diagram for Parser::CastExpr:
+ Collaboration diagram for Parser::CastExpr:

Public Member Functions

 CastExpr (Expr *a, SQLType *t)
 
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 ()
 

Private Attributes

std::unique_ptr< Exprarg_
 
std::unique_ptr< SQLTypetarget_type_
 

Additional Inherited Members

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

Detailed Description

Definition at line 669 of file ParserNode.h.

Constructor & Destructor Documentation

Parser::CastExpr::CastExpr ( Expr a,
SQLType t 
)
inline

Definition at line 671 of file ParserNode.h.

671 : arg_(a), target_type_(t) {}
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:681
std::unique_ptr< SQLType > target_type_
Definition: ParserNode.h:682
constexpr double a
Definition: Utm.h:32

Member Function Documentation

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

Implements Parser::Expr.

Definition at line 1040 of file ParserNode.cpp.

References kENCODING_NONE.

1043  {
1044  target_type_->check_type();
1045  auto arg_expr = arg_->analyze(catalog, query, allow_tlist_ref);
1046  SQLTypeInfo ti(target_type_->get_type(),
1047  target_type_->get_param1(),
1048  target_type_->get_param2(),
1049  arg_expr->get_type_info().get_notnull());
1050  if (arg_expr->get_type_info().get_type() != target_type_->get_type() &&
1051  arg_expr->get_type_info().get_compression() != kENCODING_NONE) {
1052  arg_expr->decompress();
1053  }
1054  return arg_expr->add_cast(ti);
1055 }
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:681
std::unique_ptr< SQLType > target_type_
Definition: ParserNode.h:682
std::string Parser::CastExpr::to_string ( ) const
inlineoverridevirtual

Implements Parser::Expr.

Definition at line 676 of file ParserNode.h.

References arg_, and target_type_.

676  {
677  return "CAST(" + arg_->to_string() + " AS " + target_type_->to_string() + ")";
678  }
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:681
std::unique_ptr< SQLType > target_type_
Definition: ParserNode.h:682

Member Data Documentation

std::unique_ptr<Expr> Parser::CastExpr::arg_
private

Definition at line 681 of file ParserNode.h.

Referenced by to_string().

std::unique_ptr<SQLType> Parser::CastExpr::target_type_
private

Definition at line 682 of file ParserNode.h.

Referenced by to_string().


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