imay commented on a change in pull request #2573: implements create drop show 
index syntax for bitmap index [#2487]
URL: https://github.com/apache/incubator-doris/pull/2573#discussion_r361560723
 
 

 ##########
 File path: fe/src/main/java/org/apache/doris/analysis/IndexDef.java
 ##########
 @@ -0,0 +1,165 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.analysis;
+
+import org.apache.doris.catalog.AggregateType;
+import org.apache.doris.catalog.Column;
+import org.apache.doris.catalog.PrimitiveType;
+import org.apache.doris.common.AnalysisException;
+
+import org.apache.commons.lang.StringUtils;
+
+import java.util.List;
+import java.util.TreeSet;
+
+public class IndexDef {
+    private String indexName;
+    private List<String> columns;
+    private IndexType indexType;
+    private String comment;
+
+    public IndexDef(String indexName, List<String> columns, IndexType 
indexType, String comment) {
+        this.indexName = indexName;
+        this.columns = columns;
+        if (indexType == null) {
+            this.indexType = IndexType.BITMAP;
+        } else {
+            this.indexType = indexType;
+        }
+        if (columns == null) {
+            this.comment = "";
+        } else {
+            this.comment = comment;
+        }
+    }
+
+    public void analyze(boolean isOlap, List<Column> tableColumns) throws 
AnalysisException {
+        if (indexType == IndexDef.IndexType.BITMAP) {
+            if (!isOlap) {
+                throw new AnalysisException("bitmap index can only be used 
with olap engine");
+            }
+            if (columns == null || columns.size() != 1) {
+                throw new AnalysisException("bitmap index definition expect at 
least one column.");
+            }
+            if (StringUtils.isBlank(indexName)) {
+                throw new AnalysisException("index name cannot be blank.");
+            }
+            if (indexName.length() > 64) {
+                throw new AnalysisException("index name too long, the index 
name length at most is 64.");
+            }
+            TreeSet<String> distinct = new 
TreeSet<>(String.CASE_INSENSITIVE_ORDER);
 
 Review comment:
   columns size must be 1, so it seems unnecessary.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to