Add scan option in das scan op

This commit is contained in:
DengzhiLiu
2024-05-25 05:16:07 +00:00
committed by ob-robot
parent c04f0c15de
commit 3b615e859d
4 changed files with 51 additions and 3 deletions

View File

@ -25,6 +25,7 @@ namespace common
OB_SERIALIZE_MEMBER(ObLimitParam, offset_, limit_);
OB_SERIALIZE_MEMBER(SampleInfo, table_id_, method_, scope_, percent_, seed_, force_block_);
OB_SERIALIZE_MEMBER(ObEstRowCountRecord, table_id_, table_type_, version_range_, logical_row_count_, physical_row_count_);
OB_SERIALIZE_MEMBER(ObTableScanOption, io_read_batch_size_, io_read_gap_size_, storage_rowsets_size_);
uint64_t SampleInfo::hash(uint64_t seed) const
{

View File

@ -96,6 +96,49 @@ struct SampleInfo
OB_UNIS_VERSION(1);
};
struct ObTableScanOption
{
OB_UNIS_VERSION(1);
public:
static const int64_t MAX_IO_READ_BATCH_SIZE = 16_MB;
static const int64_t MAX_STORAGE_ROWSETS_SIZE = (1 << 20);
ObTableScanOption() :
io_read_batch_size_(0),
io_read_gap_size_(0),
storage_rowsets_size_(1)
{}
bool is_io_valid() const
{
return (io_read_batch_size_ >= 0 && io_read_batch_size_ <= MAX_IO_READ_BATCH_SIZE &&
io_read_gap_size_ >= 0 && io_read_gap_size_ < io_read_batch_size_);
}
bool is_rowsets_valid() const
{
return storage_rowsets_size_ > 0 && storage_rowsets_size_ <= MAX_STORAGE_ROWSETS_SIZE;
}
void reset()
{
io_read_batch_size_ = 0;
io_read_gap_size_ = 0;
storage_rowsets_size_ = 1;
}
ObTableScanOption &operator=(const ObTableScanOption &opt)
{
if (this == &opt) {
} else {
io_read_batch_size_ = opt.io_read_batch_size_;
io_read_gap_size_ = opt.io_read_gap_size_;
storage_rowsets_size_ = opt.storage_rowsets_size_;
}
return *this;
}
TO_STRING_KV(K_(io_read_batch_size), K_(io_read_gap_size), K_(storage_rowsets_size));
int64_t io_read_batch_size_;
int64_t io_read_gap_size_;
int64_t storage_rowsets_size_;
};
struct ObLimitParam
{
int64_t offset_;

View File

@ -62,7 +62,8 @@ OB_SERIALIZE_MEMBER(ObDASScanCtDef,
trans_info_expr_,
group_by_column_ids_,
ir_scan_type_,
rowkey_exprs_);
rowkey_exprs_,
table_scan_opt_);
OB_DEF_SERIALIZE(ObDASScanRtDef)
{

View File

@ -48,7 +48,8 @@ public:
external_file_format_str_(alloc),
trans_info_expr_(nullptr),
ir_scan_type_(ObTSCIRScanType::OB_NOT_A_SPEC_SCAN),
rowkey_exprs_(alloc)
rowkey_exprs_(alloc),
table_scan_opt_()
{ }
//in das scan op, column described with column expr
virtual bool has_expr() const override { return true; }
@ -83,7 +84,8 @@ public:
K_(external_file_location),
KPC_(trans_info_expr),
K_(ir_scan_type),
K_(rowkey_exprs));
K_(rowkey_exprs),
K_(table_scan_opt));
common::ObTableID ref_table_id_;
UIntFixedArray access_column_ids_;
int64_t schema_version_;
@ -105,6 +107,7 @@ public:
ObExpr *trans_info_expr_; // transaction information pseudo-column
ObTSCIRScanType ir_scan_type_; // specify retrieval scan type
sql::ExprFixedArray rowkey_exprs_; // store rowkey exprs for index lookup
ObTableScanOption table_scan_opt_;
};
struct ObDASScanRtDef : ObDASBaseRtDef