OmniSciDB  c07336695a
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 452 of file ParserNode.h.

Constructor & Destructor Documentation

◆ CharLengthExpr()

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

Definition at line 454 of file ParserNode.h.

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

Member Function Documentation

◆ analyze()

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

References run-benchmark-import::result.

443  {
444  auto arg_expr = arg->analyze(catalog, query, allow_tlist_ref);
445  if (!arg_expr->get_type_info().is_string()) {
446  throw std::runtime_error(
447  "expression in char_length clause must be of a string type.");
448  }
449  std::shared_ptr<Analyzer::Expr> result =
450  makeExpr<Analyzer::CharLengthExpr>(arg_expr->decompress(), calc_encoded_length);
451  return result;
452 }
std::unique_ptr< Expr > arg
Definition: ParserNode.h:464

◆ get_arg()

const Expr* Parser::CharLengthExpr::get_arg ( ) const
inline

Definition at line 455 of file ParserNode.h.

455 { return arg.get(); }
std::unique_ptr< Expr > arg
Definition: ParserNode.h:464

◆ get_calc_encoded_length()

bool Parser::CharLengthExpr::get_calc_encoded_length ( ) const
inline

Definition at line 456 of file ParserNode.h.

References anonymous_namespace{UpdateMetadataTest.cpp}::query, and to_string().

456 { return calc_encoded_length; }
+ Here is the call graph for this function:

◆ to_string()

std::string Parser::CharLengthExpr::to_string ( ) const
overridevirtual

Implements Parser::Expr.

Definition at line 1412 of file ParserNode.cpp.

1412  {
1413  std::string str;
1414  if (calc_encoded_length) {
1415  str = "CHAR_LENGTH (" + arg->to_string() + ")";
1416  } else {
1417  str = "LENGTH (" + arg->to_string() + ")";
1418  }
1419  return str;
1420 }
std::unique_ptr< Expr > arg
Definition: ParserNode.h:464

Member Data Documentation

◆ arg

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

Definition at line 464 of file ParserNode.h.

◆ calc_encoded_length

bool Parser::CharLengthExpr::calc_encoded_length
private

Definition at line 465 of file ParserNode.h.


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