diff --git a/utils/local-engine/Parser/SerializedPlanParser.cpp b/utils/local-engine/Parser/SerializedPlanParser.cpp index 9447102f35e0..558bcc55fb2f 100644 --- a/utils/local-engine/Parser/SerializedPlanParser.cpp +++ b/utils/local-engine/Parser/SerializedPlanParser.cpp @@ -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"; @@ -407,6 +407,8 @@ DataTypePtr SerializedPlanParser::parseType(const substrait::Type & type) } QueryPlanPtr SerializedPlanParser::parse(std::unique_ptr plan) { + auto * logger = &Poco::Logger::get("SerializedPlanParser"); + if (logger->debug()) { namespace pb_util = google::protobuf::util; pb_util::JsonOptions options; @@ -414,7 +416,6 @@ QueryPlanPtr SerializedPlanParser::parse(std::unique_ptr plan) 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()) @@ -447,8 +448,7 @@ QueryPlanPtr SerializedPlanParser::parse(std::unique_ptr 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; diff --git a/utils/local-engine/jni/jni_error.cpp b/utils/local-engine/jni/jni_error.cpp index 8fc0b5163704..ecfe9e80d39a 100644 --- a/utils/local-engine/jni/jni_error.cpp +++ b/utils/local-engine/jni/jni_error.cpp @@ -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"); diff --git a/utils/local-engine/jni/jni_error.h b/utils/local-engine/jni/jni_error.h index 184664828206..670df1d46bab 100644 --- a/utils/local-engine/jni/jni_error.h +++ b/utils/local-engine/jni/jni_error.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -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;\ } diff --git a/utils/local-engine/local_engine_jni.cpp b/utils/local-engine/local_engine_jni.cpp index 285a8c3ec43a..cc1c2d36619e 100644 --- a/utils/local-engine/local_engine_jni.cpp +++ b/utils/local-engine/local_engine_jni.cpp @@ -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++) diff --git a/utils/local-engine/tests/benchmark_parquet_read.cpp b/utils/local-engine/tests/benchmark_parquet_read.cpp index 1f0a6f695269..47636166bb65 100644 --- a/utils/local-engine/tests/benchmark_parquet_read.cpp +++ b/utils/local-engine/tests/benchmark_parquet_read.cpp @@ -19,7 +19,6 @@ #include #include - static void BM_ParquetReadString(benchmark::State& state) { using namespace DB; @@ -44,7 +43,6 @@ static void BM_ParquetReadString(benchmark::State& state) } } - static void BM_ParquetReadDate32(benchmark::State& state) { using namespace DB; @@ -70,7 +68,6 @@ static void BM_ParquetReadDate32(benchmark::State& state) } } - static void BM_OptimizedParquetReadString(benchmark::State& state) { using namespace DB; @@ -100,8 +97,6 @@ static void BM_OptimizedParquetReadString(benchmark::State& state) } } - - static void BM_OptimizedParquetReadDate32(benchmark::State& state) { using namespace DB; @@ -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); diff --git a/utils/local-engine/tool/check-style b/utils/local-engine/tool/check-style index 845f48698d2b..d5cd2e67eb45 100755 --- a/utils/local-engine/tool/check-style +++ b/utils/local-engine/tool/check-style @@ -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