forked from oceanbase/seekdb
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathob_help_log_plan.cpp
More file actions
56 lines (53 loc) · 2.01 KB
/
Copy pathob_help_log_plan.cpp
File metadata and controls
56 lines (53 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* Copyright (c) 2025 OceanBase.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define USING_LOG_PREFIX SQL_OPT
#include "sql/optimizer/ob_help_log_plan.h"
#include "sql/optimizer/ob_log_values.h"
using namespace oceanbase;
using namespace sql;
using namespace oceanbase::common;
using namespace oceanbase::json;
using namespace oceanbase::sql::log_op_def;
int ObHelpLogPlan::generate_normal_raw_plan()
{
int ret = OB_SUCCESS;
ObLogicalOperator *top = NULL;
ObLogValues *values = nullptr;
set_max_op_id(1);
if (OB_ISNULL(get_stmt()) || OB_UNLIKELY(!get_stmt()->is_help_stmt())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get unexpected error", K(get_stmt()), K(ret));
} else if (OB_FAIL(allocate_values_as_top(top))) {
LOG_WARN("failed to allocate expr values as top", K(ret));
} else if (OB_ISNULL(values = static_cast<ObLogValues *>(top))
|| OB_UNLIKELY(LOG_VALUES != top->get_type())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get unexpected null", K(top), K(ret));
} else if (OB_FAIL(values->set_row_store(
static_cast<const ObHelpStmt*>(get_stmt())->get_row_store()))) {
LOG_WARN("failed to set row store", K(ret));
} else {
top->mark_is_plan_root();
set_plan_root(top);
get_optimizer_context().get_all_exprs().reuse();
for (int64_t i = 0; OB_SUCC(ret) && i < values->get_col_count(); ++i) {
if (OB_FAIL(allocate_output_expr_for_values_op(*values))) {
LOG_WARN("failed to allocate output expr", K(ret));
}
}
}
return ret;
}