diff --git a/internal/core/src/exec/expression/UnaryExpr.cpp b/internal/core/src/exec/expression/UnaryExpr.cpp index 4be2dd34c2..068d9b812d 100644 --- a/internal/core/src/exec/expression/UnaryExpr.cpp +++ b/internal/core/src/exec/expression/UnaryExpr.cpp @@ -32,7 +32,8 @@ PhyUnaryRangeFilterExpr::CanUseIndexForArray() { const Index& index = segment_->chunk_scalar_index(field_id_, i); - if (index.GetIndexType() == milvus::index::ScalarIndexType::HYBRID) { + if (index.GetIndexType() == milvus::index::ScalarIndexType::HYBRID || + index.GetIndexType() == milvus::index::ScalarIndexType::BITMAP) { return false; } } diff --git a/internal/core/src/index/BitmapIndex.h b/internal/core/src/index/BitmapIndex.h index 2866cc4c8f..227e6d1d43 100644 --- a/internal/core/src/index/BitmapIndex.h +++ b/internal/core/src/index/BitmapIndex.h @@ -117,6 +117,9 @@ class BitmapIndex : public ScalarIndex { const bool HasRawData() const override { + if (schema_.data_type() == proto::schema::DataType::Array) { + return false; + } return true; } diff --git a/pkg/util/indexparamcheck/constraints.go b/pkg/util/indexparamcheck/constraints.go index 55ea516666..8be175fe22 100644 --- a/pkg/util/indexparamcheck/constraints.go +++ b/pkg/util/indexparamcheck/constraints.go @@ -44,6 +44,8 @@ const ( // Sparse Index Param SparseDropRatioBuild = "drop_ratio_build" + + MaxBitmapCardinalityLimit = 1000 ) var ( diff --git a/pkg/util/indexparamcheck/hybrid_checker_test.go b/pkg/util/indexparamcheck/hybrid_checker_test.go index e418f12c5e..733adc2922 100644 --- a/pkg/util/indexparamcheck/hybrid_checker_test.go +++ b/pkg/util/indexparamcheck/hybrid_checker_test.go @@ -33,4 +33,5 @@ func Test_HybridIndexChecker(t *testing.T) { assert.Error(t, c.CheckValidDataType(&schemapb.FieldSchema{DataType: schemapb.DataType_Array, ElementType: schemapb.DataType_Double})) assert.Error(t, c.CheckTrain(map[string]string{})) assert.Error(t, c.CheckTrain(map[string]string{"bitmap_cardinality_limit": "0"})) + assert.Error(t, c.CheckTrain(map[string]string{"bitmap_cardinality_limit": "2000"})) } diff --git a/pkg/util/indexparamcheck/hybrid_index_checker.go b/pkg/util/indexparamcheck/hybrid_index_checker.go index 84e2366d14..9493bccd91 100644 --- a/pkg/util/indexparamcheck/hybrid_index_checker.go +++ b/pkg/util/indexparamcheck/hybrid_index_checker.go @@ -2,7 +2,6 @@ package indexparamcheck import ( "fmt" - "math" "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" "github.com/milvus-io/milvus/pkg/common" @@ -14,8 +13,9 @@ type HYBRIDChecker struct { } func (c *HYBRIDChecker) CheckTrain(params map[string]string) error { - if !CheckIntByRange(params, common.BitmapCardinalityLimitKey, 1, math.MaxInt) { - return fmt.Errorf("failed to check bitmap cardinality limit, should be larger than 0 and smaller than math.MaxInt") + if !CheckIntByRange(params, common.BitmapCardinalityLimitKey, 1, MaxBitmapCardinalityLimit) { + return fmt.Errorf("failed to check bitmap cardinality limit, should be larger than 0 and smaller than %d", + MaxBitmapCardinalityLimit) } return c.scalarIndexChecker.CheckTrain(params) }