This is an automated email from the ASF dual-hosted git repository.
eldenmoon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 78849f6e64 [refactor](predicate) refactor function parse_to_predicte
(#23343)
78849f6e64 is described below
commit 78849f6e645b6068c0b4f77d3f783652d695f257
Author: Chenyang Sun <[email protected]>
AuthorDate: Wed Aug 23 11:52:20 2023 +0800
[refactor](predicate) refactor function parse_to_predicte (#23343)
Refactored the interface of the parse_to_predicte function, we will be
utilizing this interface to support the decomposition of variant columns.
The "column" parameter might represent a column resulting from the
decomposition of a variant column. Instead of using a "unique_id" for
identification, we are utilizing a "path" to denote this column.
---
be/src/olap/delete_handler.cpp | 18 +++++++++++-------
be/src/olap/predicate_creator.h | 10 ++--------
be/src/olap/reader.cpp | 19 +++++++++----------
3 files changed, 22 insertions(+), 25 deletions(-)
diff --git a/be/src/olap/delete_handler.cpp b/be/src/olap/delete_handler.cpp
index e410c088ce..46bfe56cb7 100644
--- a/be/src/olap/delete_handler.cpp
+++ b/be/src/olap/delete_handler.cpp
@@ -251,7 +251,7 @@ Status DeleteHandler::init(TabletSchemaSPtr tablet_schema,
if (delete_pred->version().first > version) {
continue;
}
- // Need the tablet schema at the delete condition to parse the
accurate column unique id
+ // Need the tablet schema at the delete condition to parse the
accurate column
const auto& delete_pred_related_schema = delete_pred->tablet_schema();
auto& delete_condition = delete_pred->delete_predicate();
DeleteConditions temp;
@@ -262,10 +262,12 @@ Status DeleteHandler::init(TabletSchemaSPtr tablet_schema,
return Status::Error<DELETE_INVALID_PARAMETERS>(
"fail to parse condition. condition={}",
sub_predicate);
}
- condition.__set_column_unique_id(
-
delete_pred_related_schema->column(condition.column_name).unique_id());
+ int32_t col_unique_id =
+
delete_pred_related_schema->column(condition.column_name).unique_id();
+ const auto& column = tablet_schema->column_by_uid(col_unique_id);
+ uint32_t index = tablet_schema->field_index(col_unique_id);
auto predicate =
- parse_to_predicate(tablet_schema, condition,
_predicate_arena.get(), true);
+ parse_to_predicate(column, index, condition,
_predicate_arena.get(), true);
if (predicate != nullptr) {
temp.column_predicate_vec.push_back(predicate);
}
@@ -274,8 +276,6 @@ Status DeleteHandler::init(TabletSchemaSPtr tablet_schema,
for (const auto& in_predicate : delete_condition.in_predicates()) {
TCondition condition;
condition.__set_column_name(in_predicate.column_name());
- condition.__set_column_unique_id(
-
delete_pred_related_schema->column(condition.column_name).unique_id());
if (in_predicate.is_not_in()) {
condition.__set_condition_op("!*=");
} else {
@@ -284,8 +284,12 @@ Status DeleteHandler::init(TabletSchemaSPtr tablet_schema,
for (const auto& value : in_predicate.values()) {
condition.condition_values.push_back(value);
}
+ int32_t col_unique_id =
+
delete_pred_related_schema->column(condition.column_name).unique_id();
+ const auto& column = tablet_schema->column_by_uid(col_unique_id);
+ uint32_t index = tablet_schema->field_index(col_unique_id);
temp.column_predicate_vec.push_back(
- parse_to_predicate(tablet_schema, condition,
_predicate_arena.get(), true));
+ parse_to_predicate(column, index, condition,
_predicate_arena.get(), true));
}
_del_conds.emplace_back(std::move(temp));
diff --git a/be/src/olap/predicate_creator.h b/be/src/olap/predicate_creator.h
index 362484000e..95548c829c 100644
--- a/be/src/olap/predicate_creator.h
+++ b/be/src/olap/predicate_creator.h
@@ -265,16 +265,10 @@ ColumnPredicate* create_list_predicate(const
TabletColumn& column, int index,
}
// This method is called in reader and in deletehandler.
-// When it is called by delete handler, then it should use the delete
predicate's tablet schema
-// to parse the conditions.
-inline ColumnPredicate* parse_to_predicate(TabletSchemaSPtr tablet_schema,
+// The "column" parameter might represent a column resulting from the
decomposition of a variant column.
+inline ColumnPredicate* parse_to_predicate(const TabletColumn& column,
uint32_t index,
const TCondition& condition,
vectorized::Arena* arena,
bool opposite = false) {
- int32_t col_unique_id = condition.column_unique_id;
- // TODO: not equal and not in predicate is not pushed down
- const TabletColumn& column = tablet_schema->column_by_uid(col_unique_id);
- uint32_t index = tablet_schema->field_index(col_unique_id);
-
if (to_lower(condition.condition_op) == "is") {
return new NullPredicate(index,
to_lower(condition.condition_values[0]) == "null",
opposite);
diff --git a/be/src/olap/reader.cpp b/be/src/olap/reader.cpp
index a3a6c5de18..b86217d537 100644
--- a/be/src/olap/reader.cpp
+++ b/be/src/olap/reader.cpp
@@ -458,22 +458,21 @@ Status TabletReader::_init_orderby_keys_param(const
ReaderParams& read_params) {
Status TabletReader::_init_conditions_param(const ReaderParams& read_params) {
for (auto& condition : read_params.conditions) {
- // These conditions is passed from OlapScannode, but not set column
unique id here, so that set it here because it
- // is too complicated to modify related interface
TCondition tmp_cond = condition;
RETURN_IF_ERROR(_tablet_schema->have_column(tmp_cond.column_name));
- auto condition_col_uid =
_tablet_schema->column(tmp_cond.column_name).unique_id();
- tmp_cond.__set_column_unique_id(condition_col_uid);
+ // The "column" parameter might represent a column resulting from the
decomposition of a variant column.
+ // Instead of using a "unique_id" for identification, we are utilizing
a "path" to denote this column.
+ const auto& column = _tablet_schema->column(tmp_cond.column_name);
+ uint32_t index = _tablet_schema->field_index(tmp_cond.column_name);
ColumnPredicate* predicate =
- parse_to_predicate(_tablet_schema, tmp_cond,
_predicate_arena.get());
+ parse_to_predicate(column, index, tmp_cond,
_predicate_arena.get());
if (predicate != nullptr) {
// record condition value into predicate_params in order to
pushdown segment_iterator,
// _gen_predicate_result_sign will build predicate result unique
sign with condition value
auto predicate_params = predicate->predicate_params();
predicate_params->value = condition.condition_values[0];
predicate_params->marked_by_runtime_filter =
condition.marked_by_runtime_filter;
- if (_tablet_schema->column_by_uid(condition_col_uid).aggregation()
!=
- FieldAggregationMethod::OLAP_FIELD_AGGREGATION_NONE) {
+ if (column.aggregation() !=
FieldAggregationMethod::OLAP_FIELD_AGGREGATION_NONE) {
_value_col_predicates.push_back(predicate);
} else {
_col_predicates.push_back(predicate);
@@ -538,10 +537,10 @@ void
TabletReader::_init_conditions_param_except_leafnode_of_andnode(
const ReaderParams& read_params) {
for (const auto& condition :
read_params.conditions_except_leafnode_of_andnode) {
TCondition tmp_cond = condition;
- auto condition_col_uid =
_tablet_schema->column(tmp_cond.column_name).unique_id();
- tmp_cond.__set_column_unique_id(condition_col_uid);
+ const auto& column = _tablet_schema->column(tmp_cond.column_name);
+ uint32_t index = _tablet_schema->field_index(tmp_cond.column_name);
ColumnPredicate* predicate =
- parse_to_predicate(_tablet_schema, tmp_cond,
_predicate_arena.get());
+ parse_to_predicate(column, index, tmp_cond,
_predicate_arena.get());
if (predicate != nullptr) {
auto predicate_params = predicate->predicate_params();
predicate_params->marked_by_runtime_filter =
condition.marked_by_runtime_filter;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]