OmniSciDB  cde582ebc3
 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 668 of file ParserNode.h.

Constructor & Destructor Documentation

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

Definition at line 670 of file ParserNode.h.

670 : arg_(a), target_type_(t) {}
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:680
std::unique_ptr< SQLType > target_type_
Definition: ParserNode.h:681
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 1028 of file ParserNode.cpp.

References kENCODING_NONE.

1031  {
1032  target_type_->check_type();
1033  auto arg_expr = arg_->analyze(catalog, query, allow_tlist_ref);
1034  SQLTypeInfo ti(target_type_->get_type(),
1035  target_type_->get_param1(),
1036  target_type_->get_param2(),
1037  arg_expr->get_type_info().get_notnull());
1038  if (arg_expr->get_type_info().get_type() != target_type_->get_type() &&
1039  arg_expr->get_type_info().get_compression() != kENCODING_NONE) {
1040  arg_expr->decompress();
1041  }
1042  return arg_expr->add_cast(ti);
1043 }
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:680
std::unique_ptr< SQLType > target_type_
Definition: ParserNode.h:681
std::string Parser::CastExpr::to_string ( ) const
inlineoverridevirtual

Implements Parser::Expr.

Definition at line 675 of file ParserNode.h.

References arg_, and target_type_.

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

Member Data Documentation

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

Definition at line 680 of file ParserNode.h.

Referenced by to_string().

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

Definition at line 681 of file ParserNode.h.

Referenced by to_string().


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