Skip to content

Commit

Permalink
Reduce log output (#134)
Browse files Browse the repository at this point in the history
* better log

* fix check style

* fix check style
  • Loading branch information
liuneng1994 authored Sep 27, 2022
1 parent f5909f2 commit 3d1db97
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 17 deletions.
8 changes: 4 additions & 4 deletions utils/local-engine/Parser/SerializedPlanParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ std::string getCastFunction(const substrait::Type & type)
{
ch_function_name = "toDate32";
}
// TODO need complete param: scale
// TODO need complete param: scale
else if (type.has_timestamp())
{
ch_function_name = "toDateTime64";
Expand Down Expand Up @@ -407,14 +407,15 @@ DataTypePtr SerializedPlanParser::parseType(const substrait::Type & type)
}
QueryPlanPtr SerializedPlanParser::parse(std::unique_ptr<substrait::Plan> plan)
{
auto * logger = &Poco::Logger::get("SerializedPlanParser");
if (logger->debug())
{
namespace pb_util = google::protobuf::util;
pb_util::JsonOptions options;
std::string json;
pb_util::MessageToJsonString(*plan, &json, options);
LOG_DEBUG(&Poco::Logger::get("SerializedPlanParser"), "substrait plan:{}", json);
}

if (plan->extensions_size() > 0)
{
for (const auto & extension : plan->extensions())
Expand Down Expand Up @@ -447,8 +448,7 @@ QueryPlanPtr SerializedPlanParser::parse(std::unique_ptr<substrait::Plan> plan)
expression_step->setStepDescription("Rename Output");
query_plan->addStep(std::move(expression_step));

auto * logger = &Poco::Logger::get("SerializedPlanParser");
if (logger->is(Poco::Message::Priority::PRIO_TRACE))
if (logger->trace())
{
WriteBufferFromOwnString plan_string;
QueryPlan::ExplainPlanOptions options;
Expand Down
2 changes: 1 addition & 1 deletion utils/local-engine/jni/jni_error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void JniErrorsGlobalState::throwException(JNIEnv * env,jclass exception_class, c
std::string error_msg = message + "\n" + stack_trace;
env->ThrowNew(exception_class, error_msg.c_str());
}
else
else
{
// This will cause a coredump
throw std::runtime_error("Not found java runtime exception class");
Expand Down
6 changes: 4 additions & 2 deletions utils/local-engine/jni/jni_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <jni.h>
#include <exception>
#include <Common/Exception.h>
#include <IO/WriteBufferFromString.h>
#include <jni/jni_common.h>
#include <boost/stacktrace.hpp>
#include <sstream>
Expand Down Expand Up @@ -60,8 +61,9 @@ class JniErrorsGlobalState : boost::noncopyable
}\
catch (...)\
{\
std::ostringstream ostr;\
ostr << boost::stacktrace::stacktrace();\
DB::WriteBufferFromOwnString ostr;\
auto trace = boost::stacktrace::stacktrace();\
boost::stacktrace::detail::to_string(&trace.as_vector()[0], trace.size());\
local_engine::JniErrorsGlobalState::instance().throwRuntimeException(env, "Unknow Exception", ostr.str().c_str());\
return ret;\
}
Expand Down
2 changes: 1 addition & 1 deletion utils/local-engine/local_engine_jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ jlong Java_io_glutenproject_vectorized_ExpressionEvaluatorJniWrapper_nativeCreat
{
LOCAL_ENGINE_JNI_METHOD_START
auto context = Coordination::Context::createCopy(local_engine::SerializedPlanParser::global_context);

local_engine::SerializedPlanParser parser(context);
jsize iter_num = env->GetArrayLength(iter_arr);
for (jsize i = 0; i < iter_num; i++)
Expand Down
6 changes: 0 additions & 6 deletions utils/local-engine/tests/benchmark_parquet_read.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <Storages/BatchParquetFileSource.h>
#include <Parser/SerializedPlanParser.h>


static void BM_ParquetReadString(benchmark::State& state)
{
using namespace DB;
Expand All @@ -44,7 +43,6 @@ static void BM_ParquetReadString(benchmark::State& state)
}
}


static void BM_ParquetReadDate32(benchmark::State& state)
{
using namespace DB;
Expand All @@ -70,7 +68,6 @@ static void BM_ParquetReadDate32(benchmark::State& state)
}
}


static void BM_OptimizedParquetReadString(benchmark::State& state)
{
using namespace DB;
Expand Down Expand Up @@ -100,8 +97,6 @@ static void BM_OptimizedParquetReadString(benchmark::State& state)
}
}



static void BM_OptimizedParquetReadDate32(benchmark::State& state)
{
using namespace DB;
Expand Down Expand Up @@ -132,7 +127,6 @@ static void BM_OptimizedParquetReadDate32(benchmark::State& state)
}
}


BENCHMARK(BM_ParquetReadString)->Unit(benchmark::kMillisecond)->Iterations(10);
BENCHMARK(BM_ParquetReadDate32)->Unit(benchmark::kMillisecond)->Iterations(10);
BENCHMARK(BM_OptimizedParquetReadString)->Unit(benchmark::kMillisecond)->Iterations(10);
Expand Down
6 changes: 3 additions & 3 deletions utils/local-engine/tool/check-style
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ find $ROOT_PATH/{src,base,programs,utils} -name '*.h' -or -name '*.cpp' |
while read file; do awk '/^$/ { ++i; if (i > 2) { print "More than two consecutive empty lines in file '$file'" } } /./ { i = 0 }' $file; done

# Broken XML files (requires libxml2-utils)
find $ROOT_PATH/{src,base,programs,utils} -name '*.xml' |
grep -vP $EXCLUDE_DIRS |
xargs xmllint --noout --nonet
#find $ROOT_PATH/{src,base,programs,utils} -name '*.xml' |
# grep -vP $EXCLUDE_DIRS |
# xargs xmllint --noout --nonet

# FIXME: for now only clickhouse-test
#pylint --rcfile=$ROOT_PATH/.pylintrc --persistent=no --score=n $ROOT_PATH/tests/clickhouse-test $ROOT_PATH/tests/ci/*.py
Expand Down

0 comments on commit 3d1db97

Please sign in to comment.