OmniSciDB  d2f719934e
 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 667 of file ParserNode.h.

Constructor & Destructor Documentation

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

Definition at line 669 of file ParserNode.h.

669 : arg_(a), target_type_(t) {}
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:679
std::unique_ptr< SQLType > target_type_
Definition: ParserNode.h:680
constexpr double a
Definition: Utm.h:33
char * t

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

References kENCODING_NONE.

906  {
907  target_type_->check_type();
908  auto arg_expr = arg_->analyze(catalog, query, allow_tlist_ref);
909  SQLTypeInfo ti(target_type_->get_type(),
910  target_type_->get_param1(),
911  target_type_->get_param2(),
912  arg_expr->get_type_info().get_notnull());
913  if (arg_expr->get_type_info().get_type() != target_type_->get_type() &&
914  arg_expr->get_type_info().get_compression() != kENCODING_NONE) {
915  arg_expr->decompress();
916  }
917  return arg_expr->add_cast(ti);
918 }
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:679
std::unique_ptr< SQLType > target_type_
Definition: ParserNode.h:680
std::string Parser::CastExpr::to_string ( ) const
inlineoverridevirtual

Implements Parser::Expr.

Definition at line 674 of file ParserNode.h.

References arg_, and target_type_.

674  {
675  return "CAST(" + arg_->to_string() + " AS " + target_type_->to_string() + ")";
676  }
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:679
std::unique_ptr< SQLType > target_type_
Definition: ParserNode.h:680

Member Data Documentation

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

Definition at line 679 of file ParserNode.h.

Referenced by to_string().

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

Definition at line 680 of file ParserNode.h.

Referenced by to_string().


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