OmniSciDB  467d548b97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 447 of file ParserNode.h.

Constructor & Destructor Documentation

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

Definition at line 449 of file ParserNode.h.

449 : arg(a), calc_encoded_length(e) {}
std::unique_ptr< Expr > arg
Definition: ParserNode.h:459

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

References run_benchmark_import::result.

462  {
463  auto arg_expr = arg->analyze(catalog, query, allow_tlist_ref);
464  if (!arg_expr->get_type_info().is_string()) {
465  throw std::runtime_error(
466  "expression in char_length clause must be of a string type.");
467  }
468  std::shared_ptr<Analyzer::Expr> result =
469  makeExpr<Analyzer::CharLengthExpr>(arg_expr->decompress(), calc_encoded_length);
470  return result;
471 }
std::unique_ptr< Expr > arg
Definition: ParserNode.h:459
const Expr* Parser::CharLengthExpr::get_arg ( ) const
inline

Definition at line 450 of file ParserNode.h.

References arg.

450 { return arg.get(); }
std::unique_ptr< Expr > arg
Definition: ParserNode.h:459
bool Parser::CharLengthExpr::get_calc_encoded_length ( ) const
inline

Definition at line 451 of file ParserNode.h.

References calc_encoded_length.

451 { return calc_encoded_length; }
std::string Parser::CharLengthExpr::to_string ( ) const
overridevirtual

Implements Parser::Expr.

Definition at line 1369 of file ParserNode.cpp.

1369  {
1370  std::string str;
1371  if (calc_encoded_length) {
1372  str = "CHAR_LENGTH (" + arg->to_string() + ")";
1373  } else {
1374  str = "LENGTH (" + arg->to_string() + ")";
1375  }
1376  return str;
1377 }
std::unique_ptr< Expr > arg
Definition: ParserNode.h:459

Member Data Documentation

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

Definition at line 459 of file ParserNode.h.

Referenced by get_arg().

bool Parser::CharLengthExpr::calc_encoded_length
private

Definition at line 460 of file ParserNode.h.

Referenced by get_calc_encoded_length().


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