OmniSciDB
a5dc49c757
|
Expression class for string functions The "arg" constructor parameter must be an expression that resolves to a string datatype (e.g. TEXT). More...
#include <Analyzer.h>
Public Types | |
enum | OperandTypeFamily { OperandTypeFamily::STRING_FAMILY, OperandTypeFamily::INT_FAMILY } |
using | LiteralArgMap = std::map< size_t, std::pair< SQLTypes, Datum >> |
Public Member Functions | |
StringOper (const SqlStringOpKind kind, const std::vector< std::shared_ptr< Analyzer::Expr >> &args) | |
StringOper (const SqlStringOpKind kind, const SQLTypeInfo &return_ti, const std::vector< std::shared_ptr< Analyzer::Expr >> &args) | |
StringOper (const SqlStringOpKind kind, const std::vector< std::shared_ptr< Analyzer::Expr >> &args, const size_t min_args, const std::vector< OperandTypeFamily > &expected_type_families, const std::vector< std::string > &arg_names) | |
StringOper (const SqlStringOpKind kind, const SQLTypeInfo &return_ti, const std::vector< std::shared_ptr< Analyzer::Expr >> &args, const size_t min_args, const std::vector< OperandTypeFamily > &expected_type_families, const std::vector< std::string > &arg_names) | |
StringOper (const SqlStringOpKind kind, const SQLTypeInfo &return_ti, const std::vector< std::shared_ptr< Analyzer::Expr >> &args, const std::vector< std::shared_ptr< Analyzer::Expr >> &chained_string_op_exprs) | |
StringOper (const StringOper &other_string_oper) | |
StringOper (const std::shared_ptr< StringOper > &other_string_oper) | |
SqlStringOpKind | get_kind () const |
size_t | getArity () const |
size_t | getLiteralsArity () const |
size_t | getNonLiteralsArity () const |
const Expr * | getArg (const size_t i) const |
std::shared_ptr< Analyzer::Expr > | getOwnArg (const size_t i) const |
std::vector< std::shared_ptr < Analyzer::Expr > > | getOwnArgs () const |
std::vector< std::shared_ptr < Analyzer::Expr > > | getChainedStringOpExprs () const |
bool | requiresPerRowTranslation () const |
void | collect_rte_idx (std::set< int > &rte_idx_set) const override |
void | collect_column_var (std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override |
bool | hasNoneEncodedTextArg () const |
bool | hasSingleDictEncodedColInput () const |
returns whether we have one and only one column involved in this StringOper and all its descendents, and that that column is a dictionary-encoded text type More... | |
std::vector< size_t > | getLiteralArgIndexes () const |
LiteralArgMap | getLiteralArgs () const |
std::shared_ptr< Analyzer::Expr > | rewrite_with_targetlist (const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override |
std::shared_ptr< Analyzer::Expr > | rewrite_with_child_targetlist (const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override |
std::shared_ptr< Analyzer::Expr > | rewrite_agg_to_var (const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override |
std::shared_ptr< Analyzer::Expr > | deep_copy () const override |
void | group_predicates (std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const override |
bool | operator== (const Expr &rhs) const override |
std::string | toString () const override |
void | find_expr (std::function< bool(const Expr *)> f, std::list< const Expr * > &expr_list) const override |
virtual size_t | getMinArgs () const |
virtual std::vector < OperandTypeFamily > | getExpectedTypeFamilies () const |
virtual std::vector< std::string > | getArgNames () const |
Public Member Functions inherited from Analyzer::Expr | |
Expr (SQLTypes t, bool notnull) | |
Expr (SQLTypes t, int d, bool notnull) | |
Expr (SQLTypes t, int d, int s, bool notnull) | |
Expr (const SQLTypeInfo &ti, bool has_agg=false) | |
virtual | ~Expr () |
std::shared_ptr< Analyzer::Expr > | get_shared_ptr () |
const SQLTypeInfo & | get_type_info () const |
void | set_type_info (const SQLTypeInfo &ti) |
bool | get_contains_agg () const |
void | set_contains_agg (bool a) |
virtual std::shared_ptr < Analyzer::Expr > | add_cast (const SQLTypeInfo &new_type_info) |
virtual void | check_group_by (const std::list< std::shared_ptr< Analyzer::Expr >> &groupby) const |
virtual std::shared_ptr < Analyzer::Expr > | normalize_simple_predicate (int &rte_idx) const |
virtual size_t | get_num_column_vars (const bool include_agg) const |
virtual void | print () const |
virtual void | add_unique (std::list< const Expr * > &expr_list) const |
std::shared_ptr< Analyzer::Expr > | decompress () |
virtual void | get_domain (DomainSet &domain_set) const |
Private Member Functions | |
void | check_operand_types (const size_t min_args, const std::vector< OperandTypeFamily > &expected_type_families, const std::vector< std::string > &arg_names, const bool dict_encoded_cols_only=false, const bool cols_first_arg_only=true) const |
Static Private Member Functions | |
static SQLTypeInfo | get_return_type (const SqlStringOpKind kind, const std::vector< std::shared_ptr< Analyzer::Expr >> &args) |
Private Attributes | |
SqlStringOpKind | kind_ |
std::vector< std::shared_ptr < Analyzer::Expr > > | args_ |
std::vector< std::shared_ptr < Analyzer::Expr > > | chained_string_op_exprs_ |
Additional Inherited Members | |
Protected Attributes inherited from Analyzer::Expr | |
SQLTypeInfo | type_info |
bool | contains_agg |
Expression class for string functions The "arg" constructor parameter must be an expression that resolves to a string datatype (e.g. TEXT).
Definition at line 1601 of file Analyzer.h.
using Analyzer::StringOper::LiteralArgMap = std::map<size_t, std::pair<SQLTypes, Datum>> |
Definition at line 1769 of file Analyzer.h.
|
strong |
Enumerator | |
---|---|
STRING_FAMILY | |
INT_FAMILY |
Definition at line 1605 of file Analyzer.h.
|
inline |
Definition at line 1607 of file Analyzer.h.
|
inline |
Definition at line 1611 of file Analyzer.h.
|
inline |
Definition at line 1616 of file Analyzer.h.
References check_operand_types(), CONCAT, JAROWINKLER_SIMILARITY, LEVENSHTEIN_DISTANCE, and RCONCAT.
|
inline |
Definition at line 1632 of file Analyzer.h.
References check_operand_types(), CONCAT, JAROWINKLER_SIMILARITY, LEVENSHTEIN_DISTANCE, and RCONCAT.
|
inline |
Definition at line 1649 of file Analyzer.h.
|
inline |
Definition at line 1658 of file Analyzer.h.
References args_, chained_string_op_exprs_, and kind_.
|
inline |
Definition at line 1665 of file Analyzer.h.
References args_, chained_string_op_exprs_, and kind_.
|
private |
Definition at line 4361 of file Analyzer.cpp.
References args_, CHECK_EQ, g_enable_string_functions, get_kind(), Analyzer::Expr::get_type_info(), INT_FAMILY, IS_INTEGER, remove_cast(), STRING_FAMILY, and toString().
Referenced by StringOper().
|
overridevirtual |
Reimplemented from Analyzer::Expr.
Definition at line 3575 of file Analyzer.cpp.
References args_.
Referenced by hasSingleDictEncodedColInput().
|
overridevirtual |
Reimplemented from Analyzer::Expr.
Definition at line 3515 of file Analyzer.cpp.
References args_.
|
overridevirtual |
Implements Analyzer::Expr.
Reimplemented in Analyzer::HashStringOper, Analyzer::LevenshteinDistanceStringOper, Analyzer::JarowinklerSimilarityStringOper, Analyzer::PositionStringOper, Analyzer::TryStringCastOper, Analyzer::UrlDecodeStringOper, Analyzer::UrlEncodeStringOper, Analyzer::Base64DecodeStringOper, Analyzer::Base64EncodeStringOper, Analyzer::JsonValueStringOper, Analyzer::RegexpCountStringOper, Analyzer::RegexpSubstrStringOper, Analyzer::RegexpReplaceStringOper, Analyzer::SplitPartStringOper, Analyzer::ReplaceStringOper, Analyzer::OverlayStringOper, Analyzer::SubstringStringOper, Analyzer::TrimStringOper, Analyzer::PadStringOper, Analyzer::ConcatStringOper, Analyzer::RepeatStringOper, Analyzer::ReverseStringOper, Analyzer::InitCapStringOper, Analyzer::UpperStringOper, and Analyzer::LowerStringOper.
Definition at line 3684 of file Analyzer.cpp.
References args_, chained_string_op_exprs_, Analyzer::Expr::get_type_info(), and kind_.
Referenced by Analyzer::LowerStringOper::deep_copy(), Analyzer::UpperStringOper::deep_copy(), Analyzer::InitCapStringOper::deep_copy(), Analyzer::ReverseStringOper::deep_copy(), Analyzer::RepeatStringOper::deep_copy(), Analyzer::ConcatStringOper::deep_copy(), Analyzer::PadStringOper::deep_copy(), Analyzer::TrimStringOper::deep_copy(), Analyzer::SubstringStringOper::deep_copy(), Analyzer::OverlayStringOper::deep_copy(), Analyzer::ReplaceStringOper::deep_copy(), Analyzer::SplitPartStringOper::deep_copy(), Analyzer::RegexpReplaceStringOper::deep_copy(), Analyzer::RegexpSubstrStringOper::deep_copy(), Analyzer::RegexpCountStringOper::deep_copy(), Analyzer::JsonValueStringOper::deep_copy(), Analyzer::Base64EncodeStringOper::deep_copy(), Analyzer::Base64DecodeStringOper::deep_copy(), Analyzer::UrlEncodeStringOper::deep_copy(), Analyzer::UrlDecodeStringOper::deep_copy(), Analyzer::TryStringCastOper::deep_copy(), Analyzer::PositionStringOper::deep_copy(), Analyzer::JarowinklerSimilarityStringOper::deep_copy(), Analyzer::LevenshteinDistanceStringOper::deep_copy(), Analyzer::HashStringOper::deep_copy(), and DeepCopyVisitor::visitStringOper().
|
overridevirtual |
Reimplemented from Analyzer::Expr.
Definition at line 3338 of file Analyzer.cpp.
References Analyzer::Expr::add_unique(), args_, and f().
|
inline |
Definition at line 1672 of file Analyzer.h.
References kind_.
Referenced by check_operand_types(), CodeGenerator::codegenPerRowStringOper(), operator==(), TransientStringLiteralsVisitor::visitStringOper(), TextEncodingCastCountVisitor::visitStringOper(), and anonymous_namespace{ExpressionRewrite.cpp}::ConstantFoldingVisitor::visitStringOper().
|
staticprivate |
Definition at line 4325 of file Analyzer.cpp.
References run_benchmark_import::args, CHECK_NE, kENCODING_DICT, kNULLT, kTEXT, remove_cast(), and TRY_STRING_CAST.
|
inline |
Definition at line 1688 of file Analyzer.h.
References args_, and CHECK_LT.
Referenced by CodeGenerator::codegen(), CodeGenerator::codegenStringFetchAndEncode(), getLiteralArgs(), operator==(), pre_translate_string_ops(), translate_dict_strings(), TransientStringLiteralsVisitor::visitStringOper(), and TextEncodingCastCountVisitor::visitStringOper().
|
inlinevirtual |
Reimplemented in Analyzer::HashStringOper, Analyzer::LevenshteinDistanceStringOper, Analyzer::JarowinklerSimilarityStringOper, Analyzer::PositionStringOper, Analyzer::TryStringCastOper, Analyzer::UrlDecodeStringOper, Analyzer::UrlEncodeStringOper, Analyzer::Base64DecodeStringOper, Analyzer::Base64EncodeStringOper, Analyzer::JsonValueStringOper, Analyzer::RegexpCountStringOper, Analyzer::RegexpSubstrStringOper, Analyzer::RegexpReplaceStringOper, Analyzer::SplitPartStringOper, Analyzer::ReplaceStringOper, Analyzer::OverlayStringOper, Analyzer::SubstringStringOper, Analyzer::TrimStringOper, Analyzer::PadStringOper, Analyzer::ConcatStringOper, Analyzer::RepeatStringOper, Analyzer::ReverseStringOper, Analyzer::InitCapStringOper, Analyzer::UpperStringOper, and Analyzer::LowerStringOper.
Definition at line 1803 of file Analyzer.h.
References CHECK.
|
inline |
Definition at line 1674 of file Analyzer.h.
References args_.
Referenced by CodeGenerator::codegen(), CodeGenerator::codegenPerRowStringOper(), CodeGenerator::codegenStringFetchAndEncode(), getLiteralArgs(), getNonLiteralsArity(), operator==(), pre_translate_string_ops(), TransientStringLiteralsVisitor::visitStringOper(), TextEncodingCastCountVisitor::visitStringOper(), and anonymous_namespace{ExpressionRewrite.cpp}::ConstantFoldingVisitor::visitStringOper().
|
inline |
Definition at line 1700 of file Analyzer.h.
References chained_string_op_exprs_.
Referenced by getExpressionRange(), getStringOpInfos(), and TransientStringLiteralsVisitor::visitStringOper().
|
inlinevirtual |
Reimplemented in Analyzer::HashStringOper, Analyzer::LevenshteinDistanceStringOper, Analyzer::JarowinklerSimilarityStringOper, Analyzer::PositionStringOper, Analyzer::TryStringCastOper, Analyzer::UrlDecodeStringOper, Analyzer::UrlEncodeStringOper, Analyzer::Base64DecodeStringOper, Analyzer::Base64EncodeStringOper, Analyzer::JsonValueStringOper, Analyzer::RegexpCountStringOper, Analyzer::RegexpSubstrStringOper, Analyzer::RegexpReplaceStringOper, Analyzer::SplitPartStringOper, Analyzer::ReplaceStringOper, Analyzer::OverlayStringOper, Analyzer::SubstringStringOper, Analyzer::TrimStringOper, Analyzer::PadStringOper, Analyzer::ConcatStringOper, Analyzer::RepeatStringOper, Analyzer::ReverseStringOper, Analyzer::InitCapStringOper, Analyzer::UpperStringOper, and Analyzer::LowerStringOper.
Definition at line 1799 of file Analyzer.h.
References CHECK.
std::vector< size_t > Analyzer::StringOper::getLiteralArgIndexes | ( | ) | const |
Definition at line 4297 of file Analyzer.cpp.
References args_.
LiteralArgMap Analyzer::StringOper::getLiteralArgs | ( | ) | const |
Definition at line 4310 of file Analyzer.cpp.
References getArg(), and getArity().
Referenced by TransientStringLiteralsVisitor::visitStringOper(), and anonymous_namespace{ExpressionRewrite.cpp}::ConstantFoldingVisitor::visitStringOper().
|
inline |
Definition at line 1676 of file Analyzer.h.
References args_.
Referenced by getNonLiteralsArity(), and TransientStringLiteralsVisitor::visitStringOper().
|
inlinevirtual |
Reimplemented in Analyzer::HashStringOper, Analyzer::LevenshteinDistanceStringOper, Analyzer::JarowinklerSimilarityStringOper, Analyzer::PositionStringOper, Analyzer::TryStringCastOper, Analyzer::UrlDecodeStringOper, Analyzer::UrlEncodeStringOper, Analyzer::Base64DecodeStringOper, Analyzer::Base64EncodeStringOper, Analyzer::JsonValueStringOper, Analyzer::RegexpCountStringOper, Analyzer::RegexpSubstrStringOper, Analyzer::RegexpReplaceStringOper, Analyzer::SplitPartStringOper, Analyzer::ReplaceStringOper, Analyzer::OverlayStringOper, Analyzer::SubstringStringOper, Analyzer::TrimStringOper, Analyzer::PadStringOper, Analyzer::ConcatStringOper, Analyzer::RepeatStringOper, Analyzer::ReverseStringOper, Analyzer::InitCapStringOper, Analyzer::UpperStringOper, and Analyzer::LowerStringOper.
Definition at line 1795 of file Analyzer.h.
References CHECK.
|
inline |
Definition at line 1686 of file Analyzer.h.
References getArity(), and getLiteralsArity().
Referenced by CodeGenerator::codegenPerRowStringOper(), TransientStringLiteralsVisitor::visitStringOper(), and anonymous_namespace{ExpressionRewrite.cpp}::ConstantFoldingVisitor::visitStringOper().
|
inline |
Definition at line 1693 of file Analyzer.h.
References args_, and CHECK_LT.
|
inline |
Definition at line 1698 of file Analyzer.h.
References args_.
Referenced by ScalarExprVisitor< std::set< shared::TableKey > >::visitStringOper(), and anonymous_namespace{ExpressionRewrite.cpp}::ConstantFoldingVisitor::visitStringOper().
|
overridevirtual |
Reimplemented from Analyzer::Expr.
Definition at line 1785 of file Analyzer.cpp.
References args_.
|
inline |
Definition at line 1743 of file Analyzer.h.
Referenced by TextEncodingCastCountVisitor::visitStringOper().
bool Analyzer::StringOper::hasSingleDictEncodedColInput | ( | ) | const |
returns whether we have one and only one column involved in this StringOper and all its descendents, and that that column is a dictionary-encoded text type
Definition at line 4283 of file Analyzer.cpp.
References CHECK, collect_column_var(), and Analyzer::ColumnVar::colvar_comp().
|
overridevirtual |
Implements Analyzer::Expr.
Definition at line 3832 of file Analyzer.cpp.
References chained_string_op_exprs_, get_kind(), getArg(), and getArity().
|
inline |
Definition at line 1704 of file Analyzer.h.
References args_, and Analyzer::Expr::get_type_info().
Referenced by CodeGenerator::codegen(), and getExpressionRange().
|
overridevirtual |
Reimplemented from Analyzer::Expr.
Definition at line 2058 of file Analyzer.cpp.
|
overridevirtual |
Reimplemented from Analyzer::Expr.
Definition at line 2049 of file Analyzer.cpp.
|
overridevirtual |
Reimplemented from Analyzer::Expr.
Definition at line 2040 of file Analyzer.cpp.
|
overridevirtual |
Implements Analyzer::Expr.
Definition at line 3886 of file Analyzer.cpp.
Referenced by check_operand_types().
|
private |
Definition at line 1820 of file Analyzer.h.
Referenced by check_operand_types(), collect_column_var(), collect_rte_idx(), deep_copy(), find_expr(), getArg(), getArity(), getLiteralArgIndexes(), getLiteralsArity(), getOwnArg(), getOwnArgs(), group_predicates(), hasNoneEncodedTextArg(), requiresPerRowTranslation(), rewrite_agg_to_var(), rewrite_with_child_targetlist(), rewrite_with_targetlist(), StringOper(), and toString().
|
private |
Definition at line 1821 of file Analyzer.h.
Referenced by deep_copy(), getChainedStringOpExprs(), operator==(), and StringOper().
|
private |
Definition at line 1819 of file Analyzer.h.
Referenced by deep_copy(), get_kind(), rewrite_agg_to_var(), rewrite_with_child_targetlist(), rewrite_with_targetlist(), StringOper(), and toString().