OmniSciDB  04ee39c94c
anonymous_namespace{ExpressionRewrite.cpp}::ArrayElementStringLiteralEncodingVisitor Class Reference
+ Inheritance diagram for anonymous_namespace{ExpressionRewrite.cpp}::ArrayElementStringLiteralEncodingVisitor:
+ Collaboration diagram for anonymous_namespace{ExpressionRewrite.cpp}::ArrayElementStringLiteralEncodingVisitor:

Protected Types

using RetType = DeepCopyVisitor::RetType
 
- Protected Types inherited from DeepCopyVisitor
using RetType = std::shared_ptr< Analyzer::Expr >
 

Protected Member Functions

RetType visitArrayOper (const Analyzer::ArrayExpr *array_expr) const override
 
- Protected Member Functions inherited from DeepCopyVisitor
RetType visitColumnVar (const Analyzer::ColumnVar *col_var) const override
 
RetType visitColumnVarTuple (const Analyzer::ExpressionTuple *col_var_tuple) const override
 
RetType visitVar (const Analyzer::Var *var) const override
 
RetType visitConstant (const Analyzer::Constant *constant) const override
 
RetType visitUOper (const Analyzer::UOper *uoper) const override
 
RetType visitBinOper (const Analyzer::BinOper *bin_oper) const override
 
RetType visitInValues (const Analyzer::InValues *in_values) const override
 
RetType visitInIntegerSet (const Analyzer::InIntegerSet *in_integer_set) const override
 
RetType visitCharLength (const Analyzer::CharLengthExpr *char_length) const override
 
RetType visitKeyForString (const Analyzer::KeyForStringExpr *expr) const override
 
RetType visitCardinality (const Analyzer::CardinalityExpr *cardinality) const override
 
RetType visitLikeExpr (const Analyzer::LikeExpr *like) const override
 
RetType visitRegexpExpr (const Analyzer::RegexpExpr *regexp) const override
 
RetType visitCaseExpr (const Analyzer::CaseExpr *case_expr) const override
 
RetType visitDatetruncExpr (const Analyzer::DatetruncExpr *datetrunc) const override
 
RetType visitExtractExpr (const Analyzer::ExtractExpr *extract) const override
 
RetType visitWindowFunction (const Analyzer::WindowFunction *window_func) const override
 
RetType visitFunctionOper (const Analyzer::FunctionOper *func_oper) const override
 
RetType visitDatediffExpr (const Analyzer::DatediffExpr *datediff) const override
 
RetType visitDateaddExpr (const Analyzer::DateaddExpr *dateadd) const override
 
RetType visitFunctionOperWithCustomTypeHandling (const Analyzer::FunctionOperWithCustomTypeHandling *func_oper) const override
 
RetType visitLikelihood (const Analyzer::LikelihoodExpr *likelihood) const override
 
RetType visitAggExpr (const Analyzer::AggExpr *agg) const override
 
RetType visitOffsetInFragment (const Analyzer::OffsetInFragment *) const override
 
- Protected Member Functions inherited from ScalarExprVisitor< std::shared_ptr< Analyzer::Expr > >
virtual std::shared_ptr< Analyzer::ExpraggregateResult (const std::shared_ptr< Analyzer::Expr > &aggregate, const std::shared_ptr< Analyzer::Expr > &next_result) const
 
virtual std::shared_ptr< Analyzer::ExprdefaultResult () const
 

Additional Inherited Members

- Public Member Functions inherited from ScalarExprVisitor< std::shared_ptr< Analyzer::Expr > >
std::shared_ptr< Analyzer::Exprvisit (const Analyzer::Expr *expr) const
 

Detailed Description

Definition at line 173 of file ExpressionRewrite.cpp.

Member Typedef Documentation

◆ RetType

using anonymous_namespace{ExpressionRewrite.cpp}::ArrayElementStringLiteralEncodingVisitor::RetType = DeepCopyVisitor::RetType
protected

Definition at line 175 of file ExpressionRewrite.cpp.

Member Function Documentation

◆ visitArrayOper()

RetType anonymous_namespace{ExpressionRewrite.cpp}::ArrayElementStringLiteralEncodingVisitor::visitArrayOper ( const Analyzer::ArrayExpr array_expr) const
inlineoverrideprotectedvirtual

Reimplemented from DeepCopyVisitor.

Definition at line 177 of file ExpressionRewrite.cpp.

References Analyzer::Expr::get_type_info(), Analyzer::ArrayExpr::getElement(), Analyzer::ArrayExpr::getElementCount(), Analyzer::ArrayExpr::getExprIndex(), Analyzer::ArrayExpr::isLocalAlloc(), kENCODING_DICT, kENCODING_NONE, and TRANSIENT_DICT_ID.

177  {
178  std::vector<std::shared_ptr<Analyzer::Expr>> args_copy;
179  for (size_t i = 0; i < array_expr->getElementCount(); ++i) {
180  auto const element_expr_ptr = visit(array_expr->getElement(i));
181  auto const& element_expr_type_info = element_expr_ptr->get_type_info();
182 
183  if (!element_expr_type_info.is_string() ||
184  element_expr_type_info.get_compression() != kENCODING_NONE) {
185  args_copy.push_back(element_expr_ptr);
186  } else {
187  auto transient_dict_type_info = element_expr_type_info;
188 
189  transient_dict_type_info.set_compression(kENCODING_DICT);
190  transient_dict_type_info.set_comp_param(TRANSIENT_DICT_ID);
191  transient_dict_type_info.set_fixed_size();
192  args_copy.push_back(element_expr_ptr->add_cast(transient_dict_type_info));
193  }
194  }
195 
196  const auto& type_info = array_expr->get_type_info();
197  return makeExpr<Analyzer::ArrayExpr>(
198  type_info, args_copy, array_expr->getExprIndex(), array_expr->isLocalAlloc());
199  }
size_t getElementCount() const
Definition: Analyzer.h:1380
bool isLocalAlloc() const
Definition: Analyzer.h:1382
int32_t getExprIndex() const
Definition: Analyzer.h:1381
const Analyzer::Expr * getElement(const size_t i) const
Definition: Analyzer.h:1384
#define TRANSIENT_DICT_ID
Definition: sqltypes.h:186
std::shared_ptr< Analyzer::Expr > visit(const Analyzer::Expr *expr) const
const SQLTypeInfo & get_type_info() const
Definition: Analyzer.h:77
+ Here is the call graph for this function:

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