From dcf3a66d50b3031adbe26f1b0390bb99ac15d73a Mon Sep 17 00:00:00 2001 From: airborne12 Date: Wed, 4 Dec 2024 12:03:26 +0800 Subject: [PATCH] [feat](test) add fe ut for bf index create table --- .../org/apache/doris/analysis/IndexDef.java | 7 +++---- .../CreateTableWithBloomFilterIndexTest.java | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/IndexDef.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/IndexDef.java index 76d241a3b3629b..f51e63e4fbec0f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/IndexDef.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/IndexDef.java @@ -262,15 +262,15 @@ public void checkColumn(Column column, KeysType keysType, boolean enableUniqueKe throw new AnalysisException("ngram_bf index should have gram_size and bf_size properties"); } - int ngramSize = parseAndValidateProperty(properties, NGRAM_SIZE_KEY, MIN_NGRAM_SIZE, MAX_NGRAM_SIZE); - int bfSize = parseAndValidateProperty(properties, NGRAM_BF_SIZE_KEY, MIN_BF_SIZE, MAX_BF_SIZE); + parseAndValidateProperty(properties, NGRAM_SIZE_KEY, MIN_NGRAM_SIZE, MAX_NGRAM_SIZE); + parseAndValidateProperty(properties, NGRAM_BF_SIZE_KEY, MIN_BF_SIZE, MAX_BF_SIZE); } } else { throw new AnalysisException("Unsupported index type: " + indexType); } } - private int parseAndValidateProperty(Map properties, String key, int minValue, int maxValue) + private void parseAndValidateProperty(Map properties, String key, int minValue, int maxValue) throws AnalysisException { String valueStr = properties.get(key); if (valueStr == null) { @@ -282,7 +282,6 @@ private int parseAndValidateProperty(Map properties, String key, throw new AnalysisException("'" + key + "' should be an integer between " + minValue + " and " + maxValue + "."); } - return value; } catch (NumberFormatException e) { throw new AnalysisException("Invalid value for '" + key + "': " + valueStr, e); } diff --git a/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateTableWithBloomFilterIndexTest.java b/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateTableWithBloomFilterIndexTest.java index bfc0a1b201a693..736e65a0011211 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateTableWithBloomFilterIndexTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateTableWithBloomFilterIndexTest.java @@ -1,3 +1,20 @@ +// 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.catalog; import org.apache.doris.common.AnalysisException; @@ -5,7 +22,6 @@ import org.apache.doris.common.ExceptionChecker; import org.apache.doris.utframe.TestWithFeService; -import org.junit.Assert; import org.junit.jupiter.api.Test; import java.util.UUID;