Skip to content

Commit

Permalink
[Feature](inverted index) add no need read data optimize config apach…
Browse files Browse the repository at this point in the history
  • Loading branch information
airborne12 authored and Baymine committed Aug 2, 2024
1 parent 96af687 commit 0298f09
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions be/src/olap/rowset/segment_v2/segment_iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,9 @@ Status SegmentIterator::_apply_inverted_index_on_block_column_predicate(
}

bool SegmentIterator::_need_read_data(ColumnId cid) {
if (_opts.runtime_state && !_opts.runtime_state->query_options().enable_no_need_read_data_opt) {
return true;
}
// only support DUP_KEYS and UNIQUE_KEYS with MOW
if (!((_opts.tablet_schema->keys_type() == KeysType::DUP_KEYS ||
(_opts.tablet_schema->keys_type() == KeysType::UNIQUE_KEYS &&
Expand Down Expand Up @@ -2527,6 +2530,9 @@ void SegmentIterator::_calculate_pred_in_remaining_conjunct_root(

bool SegmentIterator::_no_need_read_key_data(ColumnId cid, vectorized::MutableColumnPtr& column,
size_t nrows_read) {
if (_opts.runtime_state && !_opts.runtime_state->query_options().enable_no_need_read_data_opt) {
return false;
}
if (_opts.tablet_schema->keys_type() != KeysType::DUP_KEYS) {
return false;
}
Expand Down
15 changes: 15 additions & 0 deletions fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ public class SessionVariable implements Serializable, Writable {
public static final String ENABLE_INVERTED_INDEX_QUERY = "enable_inverted_index_query";

public static final String ENABLE_PUSHDOWN_COUNT_ON_INDEX = "enable_count_on_index_pushdown";
public static final String ENABLE_NO_NEED_READ_DATA_OPT = "enable_no_need_read_data_opt";

public static final String GROUP_BY_AND_HAVING_USE_ALIAS_FIRST = "group_by_and_having_use_alias_first";
public static final String DROP_TABLE_IF_CTAS_FAILED = "drop_table_if_ctas_failed";
Expand Down Expand Up @@ -1141,6 +1142,11 @@ public void setEnableLeftZigZag(boolean enableLeftZigZag) {
"是否启用count_on_index pushdown。", "Set whether to pushdown count_on_index."})
public boolean enablePushDownCountOnIndex = true;

// Whether enable no need read data opt in segment_iterator.
@VariableMgr.VarAttr(name = ENABLE_NO_NEED_READ_DATA_OPT, needForward = true, description = {
"是否启用no_need_read_data opt。", "Set whether to enable no_need_read_data opt."})
public boolean enableNoNeedReadDataOpt = true;

// Whether enable pushdown minmax to scan node of unique table.
@VariableMgr.VarAttr(name = ENABLE_PUSHDOWN_MINMAX_ON_UNIQUE, needForward = true, description = {
"是否启用pushdown minmax on unique table。", "Set whether to pushdown minmax on unique table."})
Expand Down Expand Up @@ -2525,6 +2531,14 @@ public void setEnablePushDownCountOnIndex(boolean enablePushDownCountOnIndex) {
this.enablePushDownCountOnIndex = enablePushDownCountOnIndex;
}

public boolean isEnableNoNeedReadDataOpt() {
return enableNoNeedReadDataOpt;
}

public void setEnableNoNeedReadDataOpt(boolean enableNoNeedReadDataOpt) {
this.enableNoNeedReadDataOpt = enableNoNeedReadDataOpt;
}

public int getMaxTableCountUseCascadesJoinReorder() {
return this.maxTableCountUseCascadesJoinReorder;
}
Expand Down Expand Up @@ -2644,6 +2658,7 @@ public TQueryOptions toThrift() {
tResult.setFileCacheBasePath(fileCacheBasePath);

tResult.setEnableInvertedIndexQuery(enableInvertedIndexQuery);
tResult.setEnableNoNeedReadDataOpt(enableNoNeedReadDataOpt);

if (dryRunQuery) {
tResult.setDryRunQuery(true);
Expand Down
1 change: 1 addition & 0 deletions gensrc/thrift/PaloInternalService.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ struct TQueryOptions {

92: optional bool enable_parquet_filter_by_min_max = true
93: optional bool enable_orc_filter_by_min_max = true
116: optional bool enable_no_need_read_data_opt = true;
}


Expand Down

0 comments on commit 0298f09

Please sign in to comment.