You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/08/04 06:49:11 UTC

[GitHub] [incubator-doris] xinghuayu007 opened a new pull request #4247: Unified the grammer style of create/drop bitmap and bloomfilter index

xinghuayu007 opened a new pull request #4247:
URL: https://github.com/apache/incubator-doris/pull/4247


   ## Proposed changes
   
   This PR is to unified the grammer style of create/drop bitmap and bloomfilter index. It supports to create bloomfilter index by using  the  grammar style of **"_create index <index_name> on <table_name> using bloomfilter comment ' ' properties ('bloom_filter_fpp'='0.04')_"**. It is also compatible with the olde style of **"_alter table set ('bloom_filter_columns'='k1,k2', 'bloom_filter_fpp'='0.04')_"**.  Issue: #4193 
   
   ## Types of changes
   
   What types of changes does your code introduce to Doris?
   _Put an `x` in the boxes that apply_
   
   - [] Bugfix (non-breaking change which fixes an issue)
   - [x] New feature (non-breaking change which adds functionality)
   - [] Breaking change (fix or feature that would cause existing functionality to not work as expected)
   - [] Documentation Update (if none of the other choices apply)
   - [] Code refactor (Modify the code structure, format the code, etc...)
   
   ## Checklist
   
   _Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._
   
   - [x] I have create an issue on #ISSUE, and have described the bug/feature there in detail
   - [x] Compiling and unit tests pass locally with my changes
   - [x] I have added tests that prove my fix is effective or that my feature works
   - [x] If this change need a document change, I have updated the document
   - [x] Any dependent changes have been merged
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] xinghuayu007 closed pull request #4247: Unified the grammer style of create/drop bitmap and bloomfilter index

Posted by GitBox <gi...@apache.org>.
xinghuayu007 closed pull request #4247:
URL: https://github.com/apache/incubator-doris/pull/4247


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] HangyuanLiu commented on a change in pull request #4247: Unified the grammer style of create/drop bitmap and bloomfilter index

Posted by GitBox <gi...@apache.org>.
HangyuanLiu commented on a change in pull request #4247:
URL: https://github.com/apache/incubator-doris/pull/4247#discussion_r468294969



##########
File path: fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java
##########
@@ -1160,6 +1160,326 @@ private void createJob(long dbId, OlapTable olapTable, Map<Long, LinkedList<Colu
         LOG.info("finished to create schema change job: {}", schemaChangeJob.getJobId());
     }
 
+    private void createBfJob(long dbId, OlapTable olapTable, Map<Long, LinkedList<Column>> indexSchemaMap,

Review comment:
       Can you reuse the old logic in createJob

##########
File path: docs/zh-CN/sql-reference/sql-statements/Data Definition/CREATE INDEX.md
##########
@@ -31,14 +31,18 @@ under the License.
     该语句用于创建索引
     语法:
         CREATE INDEX index_name ON table_name (column [, ...],) [USING BITMAP] [COMMENT'balabala'];
+        CREATE INDEX index_name ON table_name (column [, ...],) [USING BLOOMFILTER] [COMMENT'balabala'] PROPERTIES ('bloom_filter_fpp'='0.05');
     注意:
-        1. 目前只支持bitmap 索引
+        1. 目前支持bitmap,bloomfilter 索引
         2. BITMAP 索引仅在单列上创建
+	3. BLOOMFILTER索引可以在多列上创建,当列为空时表示删除索引;属性bloom_filter_fpp表示期望误差率

Review comment:
       Indent to index 2. 

##########
File path: fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java
##########
@@ -1438,9 +1758,20 @@ public void process(List<AlterClause> alterClauses, String clusterName, Database
                 // modify table properties
                 // do nothing, properties are already in propertyMap
             } else if (alterClause instanceof CreateIndexClause) {
-                processAddIndex((CreateIndexClause) alterClause, olapTable, newIndexes);
+                CreateIndexClause clause = (CreateIndexClause) alterClause;
+                processAddIndex(clause, olapTable, newIndexes);
+                if (clause.getIndexDef().getIndexType() == IndexDef.IndexType.BLOOMFILTER) {
+                    createBfJob(db.getId(), olapTable, indexSchemaMap, propertyMap, newIndexes, false);
+                    return;
+                }
             } else if (alterClause instanceof DropIndexClause) {
-                processDropIndex((DropIndexClause) alterClause, olapTable, newIndexes);
+                DropIndexClause clause = (DropIndexClause) alterClause;
+                if (getIndexTypeByName(clause, olapTable) == IndexDef.IndexType.BLOOMFILTER) {
+                    createBfJob(db.getId(), olapTable, indexSchemaMap, propertyMap, newIndexes, true);

Review comment:
       I see, but createBfJob is ambiguous 

##########
File path: fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java
##########
@@ -1729,6 +2075,9 @@ private void processDropIndex(DropIndexClause alterClause, OlapTable olapTable,
                 break;
             }
         }
+        if (olapTable.getBfName() == indexName) {
+            found = new Index();

Review comment:
       Please add a comment to explain why a new Index was created here




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] imay commented on a change in pull request #4247: Unified the grammer style of create/drop bitmap and bloomfilter index

Posted by GitBox <gi...@apache.org>.
imay commented on a change in pull request #4247:
URL: https://github.com/apache/incubator-doris/pull/4247#discussion_r465052989



##########
File path: fe/fe-core/src/main/java/org/apache/doris/catalog/Type.java
##########
@@ -77,6 +77,7 @@
     public static final ScalarType HLL = ScalarType.createHllType();
     public static final ScalarType CHAR = (ScalarType) ScalarType.createCharType(-1);
     public static final ScalarType BITMAP = new ScalarType(PrimitiveType.BITMAP);
+    public static final ScalarType BLOOMFILTER = new ScalarType(PrimitiveType.BLOOMFILTER);

Review comment:
       No need to add a new type bloomfilter
   This bitmap is Type Bitmap, not index bitmap




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] HangyuanLiu commented on a change in pull request #4247: Unified the grammer style of create/drop bitmap and bloomfilter index

Posted by GitBox <gi...@apache.org>.
HangyuanLiu commented on a change in pull request #4247:
URL: https://github.com/apache/incubator-doris/pull/4247#discussion_r466338436



##########
File path: fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java
##########
@@ -1438,9 +1758,20 @@ public void process(List<AlterClause> alterClauses, String clusterName, Database
                 // modify table properties
                 // do nothing, properties are already in propertyMap
             } else if (alterClause instanceof CreateIndexClause) {
-                processAddIndex((CreateIndexClause) alterClause, olapTable, newIndexes);
+                CreateIndexClause clause = (CreateIndexClause) alterClause;
+                processAddIndex(clause, olapTable, newIndexes);
+                if (clause.getIndexDef().getIndexType() == IndexDef.IndexType.BLOOMFILTER) {
+                    createBfJob(db.getId(), olapTable, indexSchemaMap, propertyMap, newIndexes, false);
+                    return;
+                }
             } else if (alterClause instanceof DropIndexClause) {
-                processDropIndex((DropIndexClause) alterClause, olapTable, newIndexes);
+                DropIndexClause clause = (DropIndexClause) alterClause;
+                if (getIndexTypeByName(clause, olapTable) == IndexDef.IndexType.BLOOMFILTER) {
+                    createBfJob(db.getId(), olapTable, indexSchemaMap, propertyMap, newIndexes, true);

Review comment:
       createBfJob is right? 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] xinghuayu007 commented on a change in pull request #4247: Unified the grammer style of create/drop bitmap and bloomfilter index

Posted by GitBox <gi...@apache.org>.
xinghuayu007 commented on a change in pull request #4247:
URL: https://github.com/apache/incubator-doris/pull/4247#discussion_r466357890



##########
File path: fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java
##########
@@ -1438,9 +1758,20 @@ public void process(List<AlterClause> alterClauses, String clusterName, Database
                 // modify table properties
                 // do nothing, properties are already in propertyMap
             } else if (alterClause instanceof CreateIndexClause) {
-                processAddIndex((CreateIndexClause) alterClause, olapTable, newIndexes);
+                CreateIndexClause clause = (CreateIndexClause) alterClause;
+                processAddIndex(clause, olapTable, newIndexes);
+                if (clause.getIndexDef().getIndexType() == IndexDef.IndexType.BLOOMFILTER) {
+                    createBfJob(db.getId(), olapTable, indexSchemaMap, propertyMap, newIndexes, false);
+                    return;
+                }
             } else if (alterClause instanceof DropIndexClause) {
-                processDropIndex((DropIndexClause) alterClause, olapTable, newIndexes);
+                DropIndexClause clause = (DropIndexClause) alterClause;
+                if (getIndexTypeByName(clause, olapTable) == IndexDef.IndexType.BLOOMFILTER) {
+                    createBfJob(db.getId(), olapTable, indexSchemaMap, propertyMap, newIndexes, true);

Review comment:
       createBfJob is a new Function that responsible for bloomfilter index create/drop




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] xinghuayu007 closed pull request #4247: Unified the grammer style of create/drop bitmap and bloomfilter index

Posted by GitBox <gi...@apache.org>.
xinghuayu007 closed pull request #4247:
URL: https://github.com/apache/incubator-doris/pull/4247


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org