[feature](vectorized) support lateral view (#8448)

This commit is contained in:
Pxl
2022-03-17 10:04:24 +08:00
committed by GitHub
parent aadfbcb9c8
commit a824c3e489
18 changed files with 602 additions and 93 deletions

View File

@ -17,14 +17,18 @@
#pragma once
#include <fmt/core.h>
#include <stddef.h>
#include "common/status.h"
#include "vec/core/block.h"
#include "vec/exprs/vexpr_context.h"
namespace doris {
// TODO: think about how to manager memeory consumption of table functions.
// Currently, the memory allocated from table function is from malloc directly.
class TableFunctionState {
};
class TableFunctionState {};
class ExprContext;
class TupleRow;
@ -34,24 +38,54 @@ public:
virtual Status prepare() = 0;
virtual Status open() = 0;
virtual Status process(TupleRow* tuple_row) = 0;
// only used for vectorized.
virtual Status process_init(vectorized::Block* block) {
return Status::NotSupported(
fmt::format("vectorized table function {} not supported now.", _fn_name));
}
// only used for vectorized.
virtual Status process_row(size_t row_idx) {
return Status::NotSupported(
fmt::format("vectorized table function {} not supported now.", _fn_name));
}
// only used for vectorized.
virtual Status process_close() {
return Status::NotSupported(
fmt::format("vectorized table function {} not supported now.", _fn_name));
}
virtual Status reset() = 0;
virtual Status get_value(void** output) = 0;
// only used for vectorized.
virtual Status get_value_length(int64_t* length) {
*length = -1;
return Status::OK();
}
virtual Status close() = 0;
virtual Status forward(bool *eos) = 0;
virtual Status forward(bool* eos) = 0;
public:
std::string name() const { return _fn_name; }
bool eos() const { return _eos; }
void set_expr_context(ExprContext* expr_context) {
_expr_context = expr_context;
void set_expr_context(ExprContext* expr_context) { _expr_context = expr_context; }
void set_vexpr_context(vectorized::VExprContext* vexpr_context) {
_vexpr_context = vexpr_context;
}
protected:
std::string _fn_name;
ExprContext* _expr_context;
ExprContext* _expr_context = nullptr;
vectorized::VExprContext* _vexpr_context = nullptr;
// true if there is no more data can be read from this function.
bool _eos = false;
// true means the function result set from current row is empty(eg, source value is null or empty).