This is an automated email from the ASF dual-hosted git repository.
kxiao pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new bc6b316e877 [chore](index) add config
enable_create_bitmap_index_as_inverted_index default true #33434 (#35521)
bc6b316e877 is described below
commit bc6b316e877806a09b4c4dcc589d199149c660e3
Author: Kang <[email protected]>
AuthorDate: Tue Jun 4 12:07:03 2024 +0800
[chore](index) add config enable_create_bitmap_index_as_inverted_index
default true #33434 (#35521)
---
fe/fe-common/src/main/java/org/apache/doris/common/Config.java | 3 +++
fe/fe-core/src/main/cup/sql_parser.cup | 7 ++++++-
.../java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java | 3 ++-
.../fault_injection_p0/test_index_ddl_fault_injection.groovy | 4 ++++
4 files changed, 15 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 9a4e0ececcc..f307ea0336c 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
@@ -2655,6 +2655,9 @@ public class Config extends ConfigBase {
@ConfField(mutable = true)
public static int cloud_cold_read_percent = 10; // 10%
+ @ConfField(mutable = true, masterOnly = true)
+ public static boolean enable_create_bitmap_index_as_inverted_index = true;
+
// 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 34ad7834212..856a8cb3fb8 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.mysql.MysqlPassword;
@@ -3844,7 +3845,11 @@ opt_index_type ::=
:}
| KW_USING KW_BITMAP
{:
- RESULT = IndexDef.IndexType.BITMAP;
+ 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 3c5d79820c7..ea62df6dc18 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
@@ -2707,7 +2707,8 @@ public class LogicalPlanBuilder extends
DorisParserBaseVisitor<Object> {
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);
diff --git
a/regression-test/suites/fault_injection_p0/test_index_ddl_fault_injection.groovy
b/regression-test/suites/fault_injection_p0/test_index_ddl_fault_injection.groovy
index 0beef4e80a6..16c485fc5d8 100644
---
a/regression-test/suites/fault_injection_p0/test_index_ddl_fault_injection.groovy
+++
b/regression-test/suites/fault_injection_p0/test_index_ddl_fault_injection.groovy
@@ -19,6 +19,8 @@ import org.codehaus.groovy.runtime.IOGroovyMethods
suite("test_index_ddl_fault_injection", "nonConcurrent") {
try {
+ // temporaryly disable enable_create_bitmap_index_as_inverted_index
+ sql "ADMIN SET FRONTEND CONFIG
('enable_create_bitmap_index_as_inverted_index' = 'false')"
sql "DROP TABLE IF EXISTS `test_index_ddl_fault_injection_tbl`"
sql """
CREATE TABLE test_index_ddl_fault_injection_tbl (
@@ -93,5 +95,7 @@ suite("test_index_ddl_fault_injection", "nonConcurrent") {
GetDebugPoint().disableDebugPointForAllBEs("BitmapIndexReader::new_iterator.fail");
}
} finally {
+ // restore enable_create_bitmap_index_as_inverted_index
+ sql "ADMIN SET FRONTEND CONFIG
('enable_create_bitmap_index_as_inverted_index' = 'true')"
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]