如何关闭优化器?

Viewed 52

版本2.1.3/2.1.5,执行以下sql报错[HY000][1105] errCode = 2, detailMessage = (10.8.12.73)[CANCELLED]UdfRuntimeException: UDF failed to evaluate CAUSED BY: NullPointerException: null 通过explain得知doris优化器自动合并子句的筛选条件,但是我需要基于子查询的结果进行处理。
官方文档提供的关闭优化器方法并不生效,请问我应该如何做?

select
      split_by_string(reason, '\n') as reasons, db_name, tb_name
from (
       select HTTP_GET(json_unquote(json_extract(stdout, '$.ErrorURL')), '{"body": {}}') as reason,
              json_unquote(json_extract(stdout, '$.db'))    as db_name,
              json_unquote(json_extract(stdout, '$.table')) as tb_name
       from (
                select split_by_string(stdout, '@@:::::::@@')[1] as stdout
                from (
                         select appId, HTTP_GET(concat('http://dw1:8088/proxy/', appId, '/taskmanagers/', containerId, '/stdout'), '{"body": {}}') as stdout
                         from (
                                  select appId, min(json_unquote(json_extract(json_arr_get(TaskManagersMemInfo, t), '$.id'))) as containerId
                                  from doris_audit_db__.flink_metrics partition (p20240903)
                                           lateral view EXPLODE_NUMBERS(json_arr_size(TaskManagersMemInfo)) tmp as t
                                  where TaskManagersMemInfo is not null
                                    and TaskManagersMemInfo != '[]'
                                    and exceptions != '[]'
                                    and metricTime between '2024-09-03 11:08:00' and '2024-09-03 11:09:00'
                                  group by appId
                              ) t
                     ) t1
                where locate('@@:::::::@@', stdout) > 0
            ) t2
   ) t3
where locate('Reason', reason) > 0
2 Answers

执行这个语句试试

SET global enable_nereids_planner=true;

W20241127 14:14:03.551322 99410 status.h:413] meet error status: [INTERNAL_ERROR]UdfRuntimeException: UDF failed to evaluate
CAUSED BY: NullPointerException: null
0#  doris::JniUtil::GetJniExceptionMsg(JNIEnv_*, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) at /home/zcp/repo_center/doris_enterprise/doris/be/src/util/jni-util.h:117
1#  doris::vectorized::JavaFunctionCall::execute_impl(doris::FunctionContext*, doris::vectorized::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long, unsigned long) const at /var/local/ldb-toolchain/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/basic_string.h:187
2#  std::_Function_handler<doris::Status (doris::FunctionContext*, doris::vectorized::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long, unsigned long), doris::vectorized::JavaFunctionCall::prepare(doris::FunctionContext*, doris::vectorized::Block const&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long) const::{lambda(auto:1&&, auto:2&&, auto:3&&, auto:4&&, auto:5&&)#1}>::_M_invoke(std::_Any_data const&, doris::FunctionContext*&&, doris::vectorized::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long&&, unsigned long&&) at /var/local/ldb-toolchain/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_function.h:291
3#  doris::vectorized::JavaUdfPreparedFunction::execute_impl(doris::FunctionContext*, doris::vectorized::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long, unsigned long) const at /home/zcp/repo_center/doris_enterprise/doris/be/src/vec/functions/function_java_udf.h:58
4#  doris::vectorized::PreparedFunctionImpl::execute_without_low_cardinality_columns(doris::FunctionContext*, doris::vectorized::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long, unsigned long, bool) const at /home/zcp/repo_center/doris_enterprise/doris/be/src/vec/functions/function.cpp:0
5#  doris::vectorized::PreparedFunctionImpl::execute(doris::FunctionContext*, doris::vectorized::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long, unsigned long, bool) const at /home/zcp/repo_center/doris_enterprise/doris/be/src/vec/functions/function.cpp:250
6#  doris::vectorized::IFunctionBase::execute(doris::FunctionContext*, doris::vectorized::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long, unsigned long, bool) const at /home/zcp/repo_center/doris_enterprise/doris/be/src/vec/functions/function.h:185
7#  doris::vectorized::VectorizedFnCall::_do_execute(doris::vectorized::VExprContext*, doris::vectorized::Block*, int*, std::vector<unsigned long, std::allocator<unsigned long> >&) at /home/zcp/repo_center/doris_enterprise/doris/be/src/vec/exprs/vectorized_fn_call.cpp:168
8#  doris::vectorized::VectorizedFnCall::execute(doris::vectorized::VExprContext*, doris::vectorized::Block*, int*) at /var/local/ldb-toolchain/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_vector.h:335
9#  doris::vectorized::VectorizedFnCall::_do_execute(doris::vectorized::VExprContext*, doris::vectorized::Block*, int*, std::vector<unsigned long, std::allocator<unsigned long> >&) at /home/zcp/repo_center/doris_enterprise/doris/be/src/common/status.h:491
10# doris::vectorized::VectorizedFnCall::execute(doris::vectorized::VExprContext*, doris::vectorized::Block*, int*) at /var/local/ldb-toolchain/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_vector.h:335
11# doris::vectorized::VectorizedFnCall::_do_execute(doris::vectorized::VExprContext*, doris::vectorized::Block*, int*, std::vector<unsigned long, std::allocator<unsigned long> >&) at /home/zcp/repo_center/doris_enterprise/doris/be/src/common/status.h:491
12# doris::vectorized::VectorizedFnCall::execute(doris::vectorized::VExprContext*, doris::vectorized::Block*, int*) at /var/local/ldb-toolchain/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_vector.h:335
13# doris::vectorized::VExprContext::execute(doris::vectorized::Block*, int*) at /home/zcp/repo_center/doris_enterprise/doris/be/src/common/status.h:378
14# doris::vectorized::VExprContext::execute_conjuncts(std::vector<std::shared_ptr<doris::vectorized::VExprContext>, std::allocator<std::shared_ptr<doris::vectorized::VExprContext> > > const&, std::vector<doris::vectorized::PODArray<unsigned char, 4096ul, Allocator<false, false, false, DefaultMemoryAllocator>, 15ul, 16ul>*, std::allocator<doris::vectorized::PODArray<unsigned char, 4096ul, Allocator<false, false, false, DefaultMemoryAllocator>, 15ul, 16ul>*> > const*, bool, doris::vectorized::Block*, doris::vectorized::PODArray<unsigned char, 4096ul, Allocator<false, false, false, DefaultMemoryAllocator>, 15ul, 16ul>*, bool*) at /home/zcp/repo_center/doris_enterprise/doris/be/src/common/status.h:491
15# doris::vectorized::VExprContext::execute_conjuncts_and_filter_block(std::vector<std::shared_ptr<doris::vectorized::VExprContext>, std::allocator<std::shared_ptr<doris::vectorized::VExprContext> > > const&, std::vector<doris::vectorized::PODArray<unsigned char, 4096ul, Allocator<false, false, false, DefaultMemoryAllocator>, 15ul, 16ul>*, std::allocator<doris::vectorized::PODArray<unsigned char, 4096ul, Allocator<false, false, false, DefaultMemoryAllocator>, 15ul, 16ul>*> > const*, doris::vectorized::Block*, std::vector<unsigned int, std::allocator<unsigned int> >&, int) at /home/zcp/repo_center/doris_enterprise/doris/be/src/common/status.h:491
16# doris::vectorized::VExprContext::filter_block(std::vector<std::shared_ptr<doris::vectorized::VExprContext>, std::allocator<std::shared_ptr<doris::vectorized::VExprContext> > > const&, doris::vectorized::Block*, int) at /var/local/ldb-toolchain/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_vector.h:335
17# doris::pipeline::AggSourceOperatorX::get_block(doris::RuntimeState*, doris::vectorized::Block*, bool*) at /home/zcp/repo_center/doris_enterprise/doris/be/src/common/status.h:491
18# doris::pipeline::OperatorXBase::get_block_after_projects(doris::RuntimeState*, doris::vectorized::Block*, bool*) at /home/zcp/repo_center/doris_enterprise/doris/be/src/common/status.h:491
19# doris::pipeline::PipelineXTask::execute(bool*) at /home/zcp/repo_center/doris_enterprise/doris/be/src/common/status.h:491
20# doris::pipeline::TaskScheduler::_do_work(unsigned long) at /home/zcp/repo_center/doris_enterprise/doris/be/src/common/status.h:378
21# doris::ThreadPool::dispatch_thread() at /home/zcp/repo_center/doris_enterprise/doris/be/src/util/threadpool.cpp:0
22# doris::Thread::supervise_thread(void*) at /var/local/ldb-toolchain/bin/../usr/include/pthread.h:562
23# start_thread
24# clone