Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contrib/tipb
23 changes: 22 additions & 1 deletion dbms/src/Flash/Coprocessor/DAGExpressionAnalyzerHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,26 @@ String DAGExpressionAnalyzerHelper::buildGroupingFunction(
return result_name;
}

String DAGExpressionAnalyzerHelper::buildLocalMatchAgainstBoolean(
DAGExpressionAnalyzer * analyzer,
const tipb::Expr & expr,
const ExpressionActionsPtr & actions)
{
const String & func_name = getFunctionName(expr);
Names argument_names;
for (const auto & child : expr.children())
{
String name = analyzer->getActions(child, actions);
argument_names.push_back(name);
}
// Expr.val carries Local MATCH metadata, not an SQL argument. Adapt it
// to the runtime function's required final constant argument. Keeping it
// in argument_names also distinguishes actions with different metadata.
const auto metadata_expr = constructStringLiteralTiExpr(expr.val());
argument_names.push_back(analyzer->getActions(metadata_expr, actions));
return analyzer->applyFunction(func_name, argument_names, actions, getCollatorFromExpr(expr));
}

String DAGExpressionAnalyzerHelper::buildDefaultFunction(
DAGExpressionAnalyzer * analyzer,
const tipb::Expr & expr,
Expand Down Expand Up @@ -589,6 +609,7 @@ DAGExpressionAnalyzerHelper::FunctionBuilderMap DAGExpressionAnalyzerHelper::fun
{"regexp", DAGExpressionAnalyzerHelper::buildRegexpFunction},
{"replaceRegexpAll", DAGExpressionAnalyzerHelper::buildRegexpFunction},
{"tidbRound", DAGExpressionAnalyzerHelper::buildRoundFunction},
{"grouping", DAGExpressionAnalyzerHelper::buildGroupingFunction}});
{"grouping", DAGExpressionAnalyzerHelper::buildGroupingFunction},
{"local_match_against_boolean", DAGExpressionAnalyzerHelper::buildLocalMatchAgainstBoolean}});

} // namespace DB
5 changes: 5 additions & 0 deletions dbms/src/Flash/Coprocessor/DAGExpressionAnalyzerHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ class DAGExpressionAnalyzerHelper
const tipb::Expr & expr,
const ExpressionActionsPtr & actions);

static String buildLocalMatchAgainstBoolean(
DAGExpressionAnalyzer * analyzer,
const tipb::Expr & expr,
const ExpressionActionsPtr & actions);

static String buildDefaultFunction(
DAGExpressionAnalyzer * analyzer,
const tipb::Expr & expr,
Expand Down
1 change: 1 addition & 0 deletions dbms/src/Flash/Coprocessor/DAGUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ const std::unordered_map<tipb::ScalarFuncSig, String> scalar_func_map({
{tipb::ScalarFuncSig::RegexpInStrSig, "regexp_instr"},
{tipb::ScalarFuncSig::RegexpReplaceSig, "regexp_replace"},
{tipb::ScalarFuncSig::RegexpSubstrSig, "regexp_substr"},
{tipb::ScalarFuncSig::LocalMatchAgainstBoolean, "local_match_against_boolean"},

{tipb::ScalarFuncSig::JsonExtractSig, "json_extract"},
{tipb::ScalarFuncSig::JsonUnquoteSig, "json_unquote"},
Expand Down
Loading