Files
oceanbase/src/sql/engine/basic/ob_function_table_op.h
wangzelin.wzl 93a1074b0c patch 4.0
2022-10-24 17:57:12 +08:00

70 lines
2.1 KiB
C++

/**
* 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_BASIC_OB_FUNCTION_TABLE_OP_H_
#define OCEANBASE_BASIC_OB_FUNCTION_TABLE_OP_H_
#include "sql/engine/ob_operator.h"
#include "sql/engine/basic/ob_chunk_datum_store.h"
#include "lib/charset/ob_charset.h"
namespace oceanbase
{
namespace sql
{
class ObExpr;
class ObFunctionTableSpec : public ObOpSpec
{
OB_UNIS_VERSION_V(1);
public:
ObFunctionTableSpec(common::ObIAllocator &alloc, const ObPhyOperatorType type)
: ObOpSpec(alloc, type), value_expr_(nullptr), column_exprs_(alloc), has_correlated_expr_(false)
{}
ObExpr *value_expr_;
common::ObFixedArray<ObExpr*, common::ObIAllocator> column_exprs_;
bool has_correlated_expr_;
};
class ObFunctionTableOp : public ObOperator
{
public:
ObFunctionTableOp(ObExecContext &exec_ctx, const ObOpSpec &spec, ObOpInput *input)
: ObOperator(exec_ctx, spec, input),
node_idx_(0),
already_calc_(false),
row_count_(0),
col_count_(0),
value_table_(NULL)
{}
virtual int inner_open() override;
virtual int inner_rescan() override;
virtual int switch_iterator() 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;
private:
int get_current_result(common::ObObj &result);
int64_t node_idx_;
bool already_calc_;
int64_t row_count_;
int64_t col_count_;
common::ObObj value_;
pl::ObPLCollection *value_table_;
};
} // end namespace sql
} // end namespace oceanbase
#endif /* OCEANBASE_BASIC_OB_FUNCTION_TABLE_OP_H_ */