Merge branch 'column_store'

Co-authored-by: wangt1xiuyi <13547954130@163.com>
Co-authored-by: yangqise7en <877793735@qq.com>
Co-authored-by: Zach41 <zach_41@163.com>
This commit is contained in:
chaser-ch
2023-10-31 15:39:20 +00:00
committed by ob-robot
parent 4057fbc4ae
commit 566e920620
1375 changed files with 239147 additions and 56014 deletions

View File

@ -246,7 +246,8 @@ namespace sql
force_part_filter_(NULL),
pushdown_filter_table_(),
in_current_dfo_(true),
skip_subpart_(false) {}
skip_subpart_(false),
use_column_store_(false) {}
TO_STRING_KV(
K_(lexprs),
@ -264,7 +265,8 @@ namespace sql
K_(force_filter),
K_(force_part_filter),
K_(in_current_dfo),
K_(skip_subpart)
K_(skip_subpart),
K_(use_column_store)
);
common::ObSEArray<ObRawExpr*, 4, common::ModulePageAllocator, true> lexprs_;
@ -287,7 +289,7 @@ namespace sql
// Indicates that part bf is only generated for the 1-level partition in the 2-level partition
// If the table is a 1-level partition, this value is false.
bool skip_subpart_;
bool use_column_store_;
};
struct EstimateCostInfo {
@ -589,12 +591,6 @@ struct EstimateCostInfo {
is_get_(false),
order_direction_(direction),
is_hash_index_(false),
table_row_count_(0),
output_row_count_(0.0),
phy_query_range_row_count_(0),
query_range_row_count_(0),
index_back_row_count_(0),
index_back_cost_(0.0),
est_cost_info_(table_id,
ref_table_id,
index_id),
@ -602,7 +598,8 @@ struct EstimateCostInfo {
range_prefix_count_(0),
table_opt_info_(),
for_update_(false),
use_skip_scan_(OptSkipScanState::SS_UNSET)
use_skip_scan_(OptSkipScanState::SS_UNSET),
use_column_store_(false)
{
}
virtual ~AccessPath() {
@ -619,10 +616,12 @@ struct EstimateCostInfo {
}
bool is_get() const { return is_get_; }
void set_is_get(bool is_get) { is_get_ = is_get; }
void set_output_row_count(double output_row_count) { output_row_count_ = output_row_count; }
void set_table_row_count(int64_t table_row_count) { table_row_count_ = table_row_count; }
int64_t get_table_row_count() const { return table_row_count_; }
double get_output_row_count() const { return output_row_count_; }
double get_table_row_count() const
{ return est_cost_info_.table_meta_info_ == NULL ? 1.0 : est_cost_info_.table_meta_info_->table_row_count_; }
double get_output_row_count() const { return est_cost_info_.output_row_count_; }
double get_logical_query_range_row_count() const { return est_cost_info_.logical_query_range_row_count_; }
double get_phy_query_range_row_count() const { return est_cost_info_.phy_query_range_row_count_; }
double get_index_back_row_count() const { return est_cost_info_.index_back_row_count_; }
double get_cost() { return cost_; }
const ObCostTableScanInfo &get_cost_table_scan_info() const
{ return est_cost_info_; }
@ -653,10 +652,7 @@ struct EstimateCostInfo {
ObCostTableScanInfo &est_cost_info,
const SampleInfo &sample_info,
const ObOptEstCost::MODEL_TYPE model_type,
const double orign_phy_query_range_row_count,
const double orign_query_range_row_count,
double &card,
double &index_back_cost,
double &cost);
inline bool can_use_remote_estimate()
{
@ -683,18 +679,13 @@ struct EstimateCostInfo {
K_(is_get),
K_(order_direction),
K_(is_hash_index),
K_(table_row_count),
K_(output_row_count),
K_(phy_query_range_row_count),
K_(query_range_row_count),
K_(index_back_row_count),
K_(index_back_cost),
K_(est_cost_info),
K_(sample_info),
K_(range_prefix_count),
K_(for_update),
K_(use_das),
K_(use_skip_scan));
K_(use_skip_scan),
K_(use_column_store));
public:
//member variables
uint64_t table_id_;
@ -708,12 +699,6 @@ struct EstimateCostInfo {
bool is_get_;
ObOrderDirection order_direction_;//序的方向(升序or倒序)
bool is_hash_index_; // is hash index (virtual table and is index)
int64_t table_row_count_; // all table row count
double output_row_count_; // 估计出的要输出的行数
double phy_query_range_row_count_; // 估计出的要抽出的query range中所包含的行数(physical)
double query_range_row_count_; // 估计出的要抽出的query range中所包含的行数(logical)
double index_back_row_count_; // 估计出的需要回表的行数,主表扫描时,index_back_row_count和output_row_count等价
double index_back_cost_; // cost for index back
ObCostTableScanInfo est_cost_info_; // estimate cost info
common::ObSEArray<ObEstRowCountRecord, 2,
common::ModulePageAllocator, true> est_records_;
@ -722,6 +707,7 @@ struct EstimateCostInfo {
BaseTableOptInfo *table_opt_info_;
bool for_update_;
OptSkipScanState use_skip_scan_;
bool use_column_store_;
private:
DISALLOW_COPY_AND_ASSIGN(AccessPath);
};
@ -1546,8 +1532,16 @@ struct NullAwareAntiJoinInfo {
PathHelper &helper,
AccessPath *&ap,
bool use_das,
bool use_column_store,
OptSkipScanState use_skip_scan);
int init_sample_info_for_access_path(AccessPath *ap,
const uint64_t table_id);
int init_filter_selectivity(ObCostTableScanInfo &est_cost_info);
int init_column_store_est_info(const uint64_t table_id, ObCostTableScanInfo &est_cost_info);
int will_use_das(const uint64_t table_id,
const uint64_t ref_id,
const uint64_t index_id,
@ -2203,10 +2197,9 @@ struct NullAwareAntiJoinInfo {
int add_table_by_heuristics(const uint64_t table_id,
const uint64_t ref_table_id,
const ObIndexInfoCache &index_info_cache,
const ObIArray<uint64_t> &valid_index_ids,
bool &added,
PathHelper &helper,
ObIArray<AccessPath *> &access_paths);
const ObIArray<uint64_t> &candi_index_ids,
ObIArray<uint64_t> &valid_index_ids,
PathHelper &helper);
// table heuristics for a virtual table.
int virtual_table_heuristics(const uint64_t table_id,