Skip to content

Commit

Permalink
fix: clustering compact not support null (milvus-io#36152)
Browse files Browse the repository at this point in the history
milvus-io#36055

Signed-off-by: lixinguo <[email protected]>
Co-authored-by: lixinguo <[email protected]>
  • Loading branch information
smellthemoon and lixinguo authored Sep 11, 2024
1 parent f31264c commit 3f75bf1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/datanode/compaction/clustering_compactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ func (t *clusteringCompactionTask) init() error {
return merr.WrapErrIllegalCompactionPlan("empty schema in compactionPlan")
}
for _, field := range t.plan.Schema.Fields {
// todo(wayblink): supprot null in clustring compact
if field.GetNullable() {
return merr.WrapErrParameterInvalidMsg(fmt.Sprintf("clustering compaction can't be trigger in field(%s) which set nullable == true", field.GetName()))
}

if field.GetIsPrimaryKey() && field.GetFieldID() >= 100 && typeutil.IsPrimaryFieldType(field.GetDataType()) {
pkField = field
}
Expand Down
16 changes: 16 additions & 0 deletions internal/datanode/compaction/clustering_compactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,22 @@ func (s *ClusteringCompactionTaskSuite) TestCompactionInit() {
s.Equal(8, s.task.getWorkerPoolSize())
s.Equal(8, s.task.mappingPool.Cap())
s.Equal(8, s.task.flushPool.Cap())

s.task.plan.Schema = genCollectionSchema()
s.task.plan.Schema.Fields = append(s.task.plan.Schema.Fields, &schemapb.FieldSchema{
FieldID: 104,
Name: "nullableFid",
DataType: schemapb.DataType_Int64,
Nullable: true,
})
s.task.plan.ClusteringKeyField = 100
s.task.plan.SegmentBinlogs = []*datapb.CompactionSegmentBinlogs{
{
SegmentID: 100,
},
}
err = s.task.init()
s.Require().Error(err)
}

func (s *ClusteringCompactionTaskSuite) TestScalarCompactionNormal() {
Expand Down

0 comments on commit 3f75bf1

Please sign in to comment.