19 #include <boost/algorithm/string/predicate.hpp>
28 const auto idx = str.find(
"__");
29 if (idx == std::string::npos) {
32 CHECK_GT(idx, std::string::size_type(0));
33 return str.substr(0, idx);
38 const std::string& func_name_wo_suffix) {
39 auto is_func_oper = [&func_name_wo_suffix](
const Analyzer::Expr* e) ->
bool {
45 if (func_name_wo_suffix == func_oper_name) {
51 std::list<const Analyzer::Expr*> funcoper_list;
52 expr->
find_expr(is_func_oper, funcoper_list);
62 inline std::string
getString(int32_t db_id, int32_t dict_id, int32_t string_id) {
63 const auto proxy =
executor_->getStringDictionaryProxy(
64 {db_id, dict_id},
executor_->getRowSetMemoryOwner(),
true);
65 return proxy->getString(string_id);
68 inline int32_t
getDictDbId(
const std::string& func_name,
size_t arg_idx) {
69 std::string func_name_wo_suffix =
78 CHECK(typ.is_text_encoding_dict() || typ.is_text_encoding_dict_array());
79 return typ.getStringDictKey().db_id;
86 inline int32_t
getDictId(
const std::string& func_name,
size_t arg_idx) {
87 std::string func_name_wo_suffix =
96 CHECK(typ.is_text_encoding_dict() || typ.is_text_encoding_dict_array());
97 return typ.getStringDictKey().dict_id;
105 const auto proxy =
executor_->getStringDictionaryProxy(
106 {db_id, dict_id},
executor_->getRowSetMemoryOwner(),
true);
107 return proxy->getOrAddTransient(str);
111 auto* proxy =
executor_->getStringDictionaryProxy(
112 {db_id, dict_id},
executor_->getRowSetMemoryOwner(),
true);
113 return reinterpret_cast<int8_t*
>(proxy);
116 inline int8_t*
makeBuffer(int64_t element_count, int64_t element_size) {
118 reinterpret_cast<int8_t*
>(
checked_malloc((element_count + 1) * element_size));
119 executor_->getRowSetMemoryOwner()->addVarlenBuffer(buffer);
std::vector< Analyzer::Expr * > target_exprs
int32_t getDictDbId(const std::string &func_name, size_t arg_idx)
const Executor * executor_
int8_t * getStringDictionaryProxy(int32_t db_id, int32_t dict_id)
int32_t getDictId(const std::string &func_name, size_t arg_idx)
std::string drop_suffix_impl(const std::string &str)
void * checked_malloc(const size_t size)
std::list< const Analyzer::Expr * > find_function_oper(const Analyzer::Expr *expr, const std::string &func_name_wo_suffix)
const SQLTypeInfo & get_type_info() const
int8_t * makeBuffer(int64_t element_count, int64_t element_size)
int32_t getOrAddTransient(int32_t db_id, int32_t dict_id, std::string str)
const Analyzer::Expr * getArg(const size_t i) const
const RelAlgExecutionUnit & ra_exe_unit_
std::string getString(int32_t db_id, int32_t dict_id, int32_t string_id)
RowFunctionManager(const Executor *executor, const RelAlgExecutionUnit &ra_exe_unit)
virtual void find_expr(std::function< bool(const Expr *)> f, std::list< const Expr * > &expr_list) const