From a5fa942d671640f5aa5cf5b03fa6bc2408a7dcc5 Mon Sep 17 00:00:00 2001 From: Kang Date: Tue, 9 Apr 2024 18:06:24 +0800 Subject: [PATCH] add config enable_create_bitmap_index_as_inverted_index --- .../src/main/java/org/apache/doris/common/Config.java | 3 +++ fe/fe-core/src/main/cup/sql_parser.cup | 7 ++++++- .../apache/doris/nereids/parser/LogicalPlanBuilder.java | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java index bc478f43864cbf..20ac31289b51fd 100644 --- a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java +++ b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java @@ -2632,6 +2632,9 @@ public static boolean isNotCloudMode() { @ConfField(mutable = true, masterOnly = true) public static boolean enable_light_index_change = true; + @ConfField(mutable = true, masterOnly = true) + public static boolean enable_create_bitmap_index_as_inverted_index = false; + // The original meta read lock is not enough to keep a snapshot of partition versions, // so the execution of `createScanRangeLocations` are delayed to `Coordinator::exec`, // to help to acquire a snapshot of partition versions. diff --git a/fe/fe-core/src/main/cup/sql_parser.cup b/fe/fe-core/src/main/cup/sql_parser.cup index ac623e39ff4e4a..08b793c43522f2 100644 --- a/fe/fe-core/src/main/cup/sql_parser.cup +++ b/fe/fe-core/src/main/cup/sql_parser.cup @@ -48,6 +48,7 @@ import org.apache.doris.catalog.StructType; import org.apache.doris.catalog.TableIf.TableType; import org.apache.doris.catalog.View; import org.apache.doris.common.AnalysisException; +import org.apache.doris.common.Config; import org.apache.doris.common.FeConstants; import org.apache.doris.common.Version; import org.apache.doris.cloud.analysis.UseCloudClusterStmt; @@ -3881,7 +3882,11 @@ opt_index_type ::= :} | KW_USING KW_BITMAP {: - RESULT = IndexDef.IndexType.INVERTED; + if (Config.enable_create_bitmap_index_as_inverted_index) { + RESULT = IndexDef.IndexType.INVERTED; + } else { + RESULT = IndexDef.IndexType.BITMAP; + } :} | KW_USING KW_NGRAM_BF {: diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java index 874b6a0d432f35..793cc9e258fbfd 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java @@ -2625,7 +2625,8 @@ public IndexDefinition visitIndexDef(IndexDefContext ctx) { String indexType = ctx.indexType != null ? ctx.indexType.getText().toUpperCase() : null; String comment = ctx.comment != null ? ctx.comment.getText() : ""; // change BITMAP index to INVERTED index - if ("BITMAP".equalsIgnoreCase(indexType)) { + if (Config.enable_create_bitmap_index_as_inverted_index + && "BITMAP".equalsIgnoreCase(indexType)) { indexType = "INVERTED"; } return new IndexDefinition(indexName, indexCols, indexType, properties, comment);