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:
@ -63,6 +63,14 @@ const char *ObLogTableScan::get_name() const
|
||||
} else {
|
||||
name = "DISTRIBUTED TABLE FULL SCAN";
|
||||
}
|
||||
} else if (use_column_store()) {
|
||||
if (is_get) {
|
||||
name = "COLUMN TABLE GET";
|
||||
} else if (is_range) {
|
||||
name = "COLUMN TABLE RANGE SCAN";
|
||||
} else {
|
||||
name = "COLUMN TABLE FULL SCAN";
|
||||
}
|
||||
} else {
|
||||
if (is_get) {
|
||||
name = "TABLE GET";
|
||||
@ -109,7 +117,6 @@ int ObLogTableScan::do_re_est_cost(EstimateCostInfo ¶m, double &card, double
|
||||
double limit_percent = -1.0;
|
||||
int64_t limit_count = -1;
|
||||
int64_t offset_count = 0;
|
||||
double index_back_cost = 0.0;
|
||||
ObOptimizerContext *opt_ctx = NULL;
|
||||
if (OB_ISNULL(access_path_)) { // table scan create from CteTablePath
|
||||
card = get_card();
|
||||
@ -134,8 +141,7 @@ int ObLogTableScan::do_re_est_cost(EstimateCostInfo ¶m, double &card, double
|
||||
param.need_row_count_ += offset_count_double;
|
||||
if (OB_FAIL(AccessPath::re_estimate_cost(param, *est_cost_info_, sample_info_,
|
||||
opt_ctx->get_cost_model_type(),
|
||||
phy_query_range_row_count_, query_range_row_count_,
|
||||
card, index_back_cost, op_cost))) {
|
||||
card, op_cost))) {
|
||||
LOG_WARN("failed to re estimate cost", K(ret));
|
||||
} else {
|
||||
cost = op_cost;
|
||||
@ -1282,6 +1288,26 @@ int ObLogTableScan::get_plan_item_info(PlanText &plan_text,
|
||||
} else if (OB_FAIL(print_range_annotation(buf, buf_len, pos, type))) {
|
||||
LOG_WARN("BUF_PRINTF fails", K(ret));
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret) && (!pushdown_groupby_columns_.empty() ||
|
||||
!pushdown_aggr_exprs_.empty())) {
|
||||
ObIArray<ObAggFunRawExpr*> &pushdown_aggregation = pushdown_aggr_exprs_;
|
||||
ObIArray<ObRawExpr*> &pushdown_groupby = pushdown_groupby_columns_;
|
||||
if (OB_FAIL(BUF_PRINTF(", "))) {
|
||||
LOG_WARN("BUF_PRINTF fails", K(ret));
|
||||
} else if (OB_FAIL(BUF_PRINTF("\n "))) {
|
||||
LOG_WARN("BUF_PRINTF fails", K(ret));
|
||||
} else if (!pushdown_groupby.empty() &&
|
||||
OB_FALSE_IT(EXPLAIN_PRINT_EXPRS(pushdown_groupby, type))) {
|
||||
} else if (!pushdown_groupby.empty() &&
|
||||
!pushdown_aggregation.empty() &&
|
||||
OB_FAIL(BUF_PRINTF(", "))) {
|
||||
LOG_WARN("BUF_PRINTF fails", K(ret));
|
||||
} else if (!pushdown_aggregation.empty()) {
|
||||
EXPLAIN_PRINT_EXPRS(pushdown_aggregation, type);
|
||||
}
|
||||
}
|
||||
|
||||
END_BUF_PRINT(plan_item.special_predicates_,
|
||||
plan_item.special_predicates_len_);
|
||||
}
|
||||
@ -1426,35 +1452,35 @@ int ObLogTableScan::explain_index_selection_info(char *buf,
|
||||
} else if (OB_FAIL(BUF_PRINTF(OUTPUT_PREFIX))) {
|
||||
LOG_WARN("BUF_PRINTF fails", K(ret));
|
||||
} else if (OB_FAIL(BUF_PRINTF("table_rows:%ld",
|
||||
static_cast<int64_t>(table_row_count_)))) {
|
||||
static_cast<int64_t>(get_table_row_count())))) {
|
||||
LOG_WARN("BUF_PRINTF fails", K(ret));
|
||||
} else if (OB_FAIL(BUF_PRINTF(NEW_LINE))) {
|
||||
LOG_WARN("BUF_PRINTF fails", K(ret));
|
||||
} else if (OB_FAIL(BUF_PRINTF(OUTPUT_PREFIX))) {
|
||||
LOG_WARN("BUF_PRINTF fails", K(ret));
|
||||
} else if (OB_FAIL(BUF_PRINTF("physical_range_rows:%ld",
|
||||
static_cast<int64_t>(phy_query_range_row_count_)))) {
|
||||
static_cast<int64_t>(get_phy_query_range_row_count())))) {
|
||||
LOG_WARN("BUF_PRINTF fails", K(ret));
|
||||
} else if (OB_FAIL(BUF_PRINTF(NEW_LINE))) {
|
||||
LOG_WARN("BUF_PRINTF fails", K(ret));
|
||||
} else if (OB_FAIL(BUF_PRINTF(OUTPUT_PREFIX))) {
|
||||
LOG_WARN("BUF_PRINTF fails", K(ret));
|
||||
} else if (OB_FAIL(BUF_PRINTF("logical_range_rows:%ld",
|
||||
static_cast<int64_t>(query_range_row_count_)))) {
|
||||
static_cast<int64_t>(get_logical_query_range_row_count())))) {
|
||||
LOG_WARN("BUF_PRINTF fails", K(ret));
|
||||
} else if (OB_FAIL(BUF_PRINTF(NEW_LINE))) {
|
||||
LOG_WARN("BUF_PRINTF fails", K(ret));
|
||||
} else if (OB_FAIL(BUF_PRINTF(OUTPUT_PREFIX))) {
|
||||
LOG_WARN("BUF_PRINTF fails", K(ret));
|
||||
} else if (OB_FAIL(BUF_PRINTF("index_back_rows:%ld",
|
||||
static_cast<int64_t>(index_back_row_count_)))) {
|
||||
static_cast<int64_t>(get_index_back_row_count())))) {
|
||||
LOG_WARN("BUF_PRINTF fails", K(ret));
|
||||
} else if (OB_FAIL(BUF_PRINTF(NEW_LINE))) {
|
||||
LOG_WARN("BUF_PRINTF fails", K(ret));
|
||||
} else if (OB_FAIL(BUF_PRINTF(OUTPUT_PREFIX))) {
|
||||
LOG_WARN("BUF_PRINTF fails", K(ret));
|
||||
} else if (OB_FAIL(BUF_PRINTF("output_rows:%ld",
|
||||
static_cast<int64_t>(output_row_count_)))) {
|
||||
static_cast<int64_t>(get_output_row_count())))) {
|
||||
LOG_WARN("BUF_PRINTF fails", K(ret));
|
||||
} else if (OB_FAIL(BUF_PRINTF(NEW_LINE))) {
|
||||
LOG_WARN("BUF_PRINTF fails", K(ret));
|
||||
@ -1791,6 +1817,14 @@ int ObLogTableScan::print_outline_data(PlanText &plan_text)
|
||||
LOG_WARN("failed to print use das hint", K(ret));
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret) && use_column_store()) {
|
||||
ObIndexHint use_column_store_hint(T_USE_COLUMN_STORE_HINT);
|
||||
use_column_store_hint.set_qb_name(qb_name);
|
||||
use_column_store_hint.get_table().set_table(*table_item);
|
||||
if (OB_FAIL(use_column_store_hint.print_hint(plan_text))) {
|
||||
LOG_WARN("failed to print use column store hint", K(ret));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -1826,6 +1860,10 @@ int ObLogTableScan::print_used_hint(PlanText &plan_text)
|
||||
&& use_das() == table_hint->use_das_hint_->is_enable_hint()
|
||||
&& OB_FAIL(table_hint->use_das_hint_->print_hint(plan_text))) {
|
||||
LOG_WARN("failed to print use das hint", K(ret));
|
||||
} else if (NULL != table_hint->use_column_store_hint_
|
||||
&& use_column_store() == table_hint->use_column_store_hint_->is_enable_hint()
|
||||
&& OB_FAIL(table_hint->use_column_store_hint_->print_hint(plan_text))) {
|
||||
LOG_WARN("failed to print use column_store hint", K(ret));
|
||||
} else if (table_hint->index_list_.empty()) {
|
||||
/*do nothing*/
|
||||
} else if (OB_UNLIKELY(table_hint->index_list_.count() != table_hint->index_hints_.count())) {
|
||||
@ -1974,13 +2012,15 @@ bool ObLogTableScan::is_need_feedback() const
|
||||
{
|
||||
bool ret = false;
|
||||
const int64_t SELECTION_THRESHOLD = 80;
|
||||
int64_t sel = (is_whole_range_scan() || table_row_count_ == 0) ?
|
||||
100 : static_cast<int64_t>(query_range_row_count_) * 100 / table_row_count_;
|
||||
double table_row_count = get_table_row_count();
|
||||
double logical_query_range_row_count = get_logical_query_range_row_count();
|
||||
int64_t sel = (is_whole_range_scan() || table_row_count == 0) ?
|
||||
100 : static_cast<int64_t>(logical_query_range_row_count) * 100 / table_row_count;
|
||||
|
||||
ret = sel >= SELECTION_THRESHOLD && !is_multi_part_table_scan_;
|
||||
|
||||
LOG_TRACE("is_need_feedback", K(estimate_method_), K(table_row_count_),
|
||||
K(query_range_row_count_), K(table_row_count_), K(sel), K(ret));
|
||||
LOG_TRACE("is_need_feedback", K(estimate_method_), K(table_row_count),
|
||||
K(logical_query_range_row_count), K(sel), K(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user