fix: clustering compact not support null (#36152)

#36055

Signed-off-by: lixinguo <xinguo.li@zilliz.com>
Co-authored-by: lixinguo <xinguo.li@zilliz.com>
pull/36177/head
smellthemoon 2024-09-11 14:49:06 +08:00 committed by GitHub
parent f31264c02c
commit 3f75bf1f20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 0 deletions

View File

@ -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
}

View File

@ -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() {