Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add some log about implicit cast #188

Merged
merged 12 commits into from
Aug 21, 2019
6 changes: 5 additions & 1 deletion dbms/src/Flash/Coprocessor/DAGExpressionAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ static String genFuncString(const String & func_name, const Names & argument_nam
}

DAGExpressionAnalyzer::DAGExpressionAnalyzer(const NamesAndTypesList & source_columns_, const Context & context_)
: source_columns(source_columns_), context(context_)
: source_columns(source_columns_), context(context_), log(&Logger::get("DAGExpressionAnalyzer"))
{
settings = context.getSettings();
after_agg = false;
implicit_cast_count = 0;
}

void DAGExpressionAnalyzer::appendAggregation(
Expand Down Expand Up @@ -253,6 +254,9 @@ String DAGExpressionAnalyzer::appendCastIfNeeded(const tipb::Expr & expr, Expres
// todo ignore nullable info??
if (expected_type->getName() != actual_type->getName())
{
LOG_DEBUG(
log, __PRETTY_FUNCTION__ << " Add implicit cast: from " << actual_type->getName() << " to " << expected_type->getName());
implicit_cast_count++;
// need to add cast function
// first construct the second argument
tipb::Expr type_expr;
Expand Down
3 changes: 3 additions & 0 deletions dbms/src/Flash/Coprocessor/DAGExpressionAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class DAGExpressionAnalyzer : private boost::noncopyable
Settings settings;
const Context & context;
bool after_agg;
Int32 implicit_cast_count;
zanmato1984 marked this conversation as resolved.
Show resolved Hide resolved
Poco::Logger * log;

public:
DAGExpressionAnalyzer(const NamesAndTypesList & source_columns_, const Context & context_);
Expand All @@ -54,6 +56,7 @@ class DAGExpressionAnalyzer : private boost::noncopyable
const NamesAndTypesList & getCurrentInputColumns();
void makeExplicitSet(const tipb::Expr & expr, const Block & sample_block, bool create_ordered_set, const String & left_arg_name);
String applyFunction(const String & func_name, Names & arg_names, ExpressionActionsPtr & actions);
Int32 getImplicitCastCount() { return implicit_cast_count; };
};

} // namespace DB
3 changes: 3 additions & 0 deletions dbms/src/Flash/Coprocessor/InterpreterDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,9 @@ BlockIO InterpreterDAG::execute()

BlockIO res;
res.in = pipeline.firstStream();

LOG_DEBUG(
log, __PRETTY_FUNCTION__ << " Convert DAG request to BlockIO, adding " << analyzer->getImplicitCastCount() << " implicit cast");
return res;
}
} // namespace DB