Skip to content

Commit

Permalink
1. fix decode literal expr error, 2. add all scalar function sig in s…
Browse files Browse the repository at this point in the history
…calar_func_map (#177)

* add all scalar function sig in scalarFunMap

* fix literal expr decode

* enable ltrim && rtrim

* code refine

* use throw instead of rethrow in DAGDriver.cpp
  • Loading branch information
windtalker authored and zanmato1984 committed Aug 14, 2019
1 parent 4a6bad8 commit 8713ff2
Show file tree
Hide file tree
Showing 6 changed files with 288 additions and 114 deletions.
4 changes: 2 additions & 2 deletions dbms/src/Flash/Coprocessor/DAGDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ try
}
catch (const RegionException & e)
{
e.rethrow();
throw;
}
catch (const LockException & e)
{
e.rethrow();
throw;
}
catch (const Exception & e)
{
Expand Down
11 changes: 5 additions & 6 deletions dbms/src/Flash/Coprocessor/DAGExpressionAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,7 @@ String DAGExpressionAnalyzer::appendCastIfNeeded(const tipb::Expr & expr, Expres
tipb::Expr type_expr;
type_expr.set_tp(tipb::ExprType::String);
std::stringstream ss;
EncodeCompactBytes(expected_type->getName(), ss);
type_expr.set_val(ss.str());
type_expr.set_val(expected_type->getName());
auto type_field_type = type_expr.field_type();
type_field_type.set_tp(0xfe);
type_field_type.set_flag(1);
Expand Down Expand Up @@ -302,8 +301,8 @@ String DAGExpressionAnalyzer::getActions(const tipb::Expr & expr, ExpressionActi
}
else if (isColumnExpr(expr))
{
ColumnID columnId = getColumnID(expr);
if (columnId < 0 || columnId >= (ColumnID)getCurrentInputColumns().size())
ColumnID column_id = getColumnID(expr);
if (column_id < 0 || column_id >= (ColumnID)getCurrentInputColumns().size())
{
throw Exception("column id out of bound", ErrorCodes::COP_BAD_DAG_REQUEST);
}
Expand Down Expand Up @@ -356,8 +355,8 @@ String DAGExpressionAnalyzer::getActions(const tipb::Expr & expr, ExpressionActi
// should be updated to and(casted_arg1_name, arg2_name)
expr_name = genFuncString(func_name, argument_names);

const ExpressionAction & applyFunction = ExpressionAction::applyFunction(function_builder, argument_names, expr_name);
actions->add(applyFunction);
const ExpressionAction & apply_function = ExpressionAction::applyFunction(function_builder, argument_names, expr_name);
actions->add(apply_function);
// add cast if needed
expr_name = appendCastIfNeeded(expr, actions, expr_name);
return expr_name;
Expand Down
Loading

0 comments on commit 8713ff2

Please sign in to comment.