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

#include <ParserNode.h>

+ Inheritance diagram for Parser::CharLengthExpr:
+ Collaboration diagram for Parser::CharLengthExpr:

Public Member Functions

 CharLengthExpr (Expr *a, bool e)
 
const Exprget_arg () const
 
bool get_calc_encoded_length () 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 ()
 

Private Attributes

std::unique_ptr< Exprarg_
 
bool calc_encoded_length_
 

Additional Inherited Members

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

Detailed Description

Definition at line 453 of file ParserNode.h.

Constructor & Destructor Documentation

Parser::CharLengthExpr::CharLengthExpr ( Expr a,
bool  e 
)
inline

Definition at line 455 of file ParserNode.h.

455 : arg_(a), calc_encoded_length_(e) {}
constexpr double a
Definition: Utm.h:32
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:465

Member Function Documentation

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

Implements Parser::Expr.

Definition at line 614 of file ParserNode.cpp.

References run_benchmark_import::result.

617  {
618  auto arg_expr = arg_->analyze(catalog, query, allow_tlist_ref);
619  if (!arg_expr->get_type_info().is_string()) {
620  throw std::runtime_error(
621  "expression in char_length clause must be of a string type.");
622  }
623  std::shared_ptr<Analyzer::Expr> result =
624  makeExpr<Analyzer::CharLengthExpr>(arg_expr->decompress(), calc_encoded_length_);
625  return result;
626 }
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:465
const Expr* Parser::CharLengthExpr::get_arg ( ) const
inline

Definition at line 456 of file ParserNode.h.

References arg_.

456 { return arg_.get(); }
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:465
bool Parser::CharLengthExpr::get_calc_encoded_length ( ) const
inline

Definition at line 457 of file ParserNode.h.

References calc_encoded_length_.

457 { return calc_encoded_length_; }
std::string Parser::CharLengthExpr::to_string ( ) const
overridevirtual

Implements Parser::Expr.

Definition at line 2229 of file ParserNode.cpp.

2229  {
2230  std::string str;
2231  if (calc_encoded_length_) {
2232  str = "CHAR_LENGTH (" + arg_->to_string() + ")";
2233  } else {
2234  str = "LENGTH (" + arg_->to_string() + ")";
2235  }
2236  return str;
2237 }
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:465

Member Data Documentation

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

Definition at line 465 of file ParserNode.h.

Referenced by get_arg().

bool Parser::CharLengthExpr::calc_encoded_length_
private

Definition at line 466 of file ParserNode.h.

Referenced by get_calc_encoded_length().


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