forked from oceanbase/oceanbase
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathob_material_op.h
More file actions
90 lines (79 loc) · 2.75 KB
/
Copy pathob_material_op.h
File metadata and controls
90 lines (79 loc) · 2.75 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/**
* Copyright (c) 2021 OceanBase
* OceanBase CE is licensed under Mulan PubL v2.
* You can use this software according to the terms and conditions of the Mulan PubL v2.
* You may obtain a copy of Mulan PubL v2 at:
* http://license.coscl.org.cn/MulanPubL-2.0
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PubL v2 for more details.
*/
#ifndef OCEANBASE_SRC_SQL_ENGINE_BASIC_OB_MATERIAL_OP_H_
#define OCEANBASE_SRC_SQL_ENGINE_BASIC_OB_MATERIAL_OP_H_
#include "sql/engine/ob_operator.h"
#include "sql/engine/basic/ob_chunk_datum_store.h"
#include "sql/engine/ob_sql_mem_mgr_processor.h"
#include "sql/engine/basic/ob_material_op_impl.h"
namespace oceanbase
{
namespace sql
{
class ObMaterialSpec : public ObOpSpec
{
OB_UNIS_VERSION_V(1);
public:
ObMaterialSpec(common::ObIAllocator &alloc, const ObPhyOperatorType type)
: ObOpSpec(alloc, type)
{}
};
class ObMaterialOpInput : public ObOpInput
{
OB_UNIS_VERSION_V(1);
friend ObMaterialOp;
public:
ObMaterialOpInput(ObExecContext &ctx, const ObOpSpec &spec)
: ObOpInput(ctx, spec), bypass_(false) {};
virtual ~ObMaterialOpInput() = default;
virtual int init(ObTaskInfo &task_info) override { UNUSED(task_info); return common::OB_SUCCESS; }
virtual void reset() override { bypass_ = false; }
void set_bypass(bool bypass) { bypass_ = bypass; }
int64_t is_bypass() const { return bypass_; }
protected:
bool bypass_; // if true, do bypass
};
class ObMaterialOp : public ObOperator
{
public:
ObMaterialOp(ObExecContext &exec_ctx, const ObOpSpec &spec, ObOpInput *input)
: ObOperator(exec_ctx, spec, input),
profile_(ObSqlWorkAreaType::HASH_WORK_AREA),
is_first_(false),
material_impl_(op_monitor_info_, profile_)
{}
virtual int inner_open() override;
virtual int inner_rescan() override;
virtual int inner_get_next_row() override;
virtual int inner_get_next_batch(int64_t max_row_cnt) override;
virtual int inner_close() override;
virtual void destroy() override;
int init_material_impl(int64_t tenant_id, int64_t row_count);
int get_material_row_count(int64_t &count) const
{
count = material_impl_.get_material_row_count();
return common::OB_SUCCESS;
}
// reset material iterator, used for NLJ/NL connectby
int rewind();
private:
int get_all_row_from_child(ObSQLSessionInfo &session);
int get_all_batch_from_child(ObSQLSessionInfo &session);
private:
friend class ObValues;
ObSqlWorkAreaProfile profile_;
bool is_first_;
ObMaterialOpImpl material_impl_;
};
} // end namespace sql
} // end namespace oceanbase
#endif /* OCEANBASE_SRC_SQL_ENGINE_BASIC_OB_MATERIAL_OP_H_ */