hqx871 commented on code in PR #11579: URL: https://github.com/apache/doris/pull/11579#discussion_r944999242
########## fe/fe-core/src/main/java/org/apache/doris/analysis/IndexDef.java: ########## @@ -142,6 +217,30 @@ public void checkColumn(Column column, KeysType keysType) throws AnalysisExcepti "BITMAP index only used in columns of DUP_KEYS/UNIQUE_KEYS table or key columns of" + " AGG_KEYS table. invalid column: " + indexColName); } + } else if (indexType == IndexType.NGRAM_BF) { + String indexColName = column.getName(); + PrimitiveType colType = column.getDataType(); + if (colType != PrimitiveType.CHAR && colType != PrimitiveType.VARCHAR) { + throw new AnalysisException(colType + " is not supported in ngram_bf index. " + + "invalid column: " + indexColName); + } else if ((keysType == KeysType.AGG_KEYS && !column.isKey())) { + throw new AnalysisException( + "ngram_bf index only used in columns of DUP_KEYS/UNIQUE_KEYS table or key columns of" + + " AGG_KEYS table. invalid column: " + indexColName); + } + if (arguments == null || arguments.size() != 2) { + throw new AnalysisException("ngram should have ngram size and bloom filter size arguments"); + } + Expr ngramSize = arguments.get(0); + if (!(ngramSize instanceof IntLiteral && ((IntLiteral) ngramSize).getLongValue() < 256 + && ((IntLiteral) ngramSize).getLongValue() >= 1)) { + throw new AnalysisException("ngram size should be integer and less than 256"); + } + Expr bfSize = arguments.get(1); + if (!(bfSize instanceof IntLiteral && ((IntLiteral) bfSize).getLongValue() < 65536 Review Comment: will fix the hard code ########## fe/fe-core/src/main/java/org/apache/doris/analysis/IndexDef.java: ########## @@ -66,6 +93,19 @@ public void analyze() throws AnalysisException { if (columns.size() != distinct.size()) { throw new AnalysisException("columns of index has duplicated."); } + if (arguments != null && !arguments.isEmpty()) { + throw new AnalysisException("bimap index do not need arguments."); + } + } else if (indexType == IndexType.NGRAM_BF) { + if (columns == null || columns.size() != 1) { Review Comment: get -- 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. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org