From 90a0e907326b89baa01f234b3278dbe74ec4a764 Mon Sep 17 00:00:00 2001 From: Patrick Weizhi Xu Date: Wed, 9 Oct 2024 10:27:20 +0800 Subject: [PATCH] enhance: remove warnings when there is no partition key set (#36674) issue: #36673 Signed-off-by: Patrick Weizhi Xu --- internal/datacoord/task_index.go | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/internal/datacoord/task_index.go b/internal/datacoord/task_index.go index e5f80e187ff59..b63a031a4efd5 100644 --- a/internal/datacoord/task_index.go +++ b/internal/datacoord/task_index.go @@ -202,24 +202,20 @@ func (it *indexBuildTask) PreCheck(ctx context.Context, dependency *taskSchedule it.SetState(indexpb.JobState_JobStateInit, err.Error()) return true } - partitionKeyField, err := typeutil.GetPartitionKeyFieldSchema(schema) - if partitionKeyField == nil || err != nil { - log.Ctx(ctx).Warn("index builder get partition key field failed", zap.Int64("taskID", it.taskID), zap.Error(err)) - } else { - if typeutil.IsFieldDataTypeSupportMaterializedView(partitionKeyField) { - optionalFields = append(optionalFields, &indexpb.OptionalFieldInfo{ - FieldID: partitionKeyField.FieldID, - FieldName: partitionKeyField.Name, - FieldType: int32(partitionKeyField.DataType), - DataIds: getBinLogIDs(segment, partitionKeyField.FieldID), - }) - iso, isoErr := common.IsPartitionKeyIsolationPropEnabled(collectionInfo.Properties) - if isoErr != nil { - log.Ctx(ctx).Warn("failed to parse partition key isolation", zap.Error(isoErr)) - } - if iso { - partitionKeyIsolation = true - } + partitionKeyField, _ := typeutil.GetPartitionKeyFieldSchema(schema) + if partitionKeyField != nil && typeutil.IsFieldDataTypeSupportMaterializedView(partitionKeyField) { + optionalFields = append(optionalFields, &indexpb.OptionalFieldInfo{ + FieldID: partitionKeyField.FieldID, + FieldName: partitionKeyField.Name, + FieldType: int32(partitionKeyField.DataType), + DataIds: getBinLogIDs(segment, partitionKeyField.FieldID), + }) + iso, isoErr := common.IsPartitionKeyIsolationPropEnabled(collectionInfo.Properties) + if isoErr != nil { + log.Ctx(ctx).Warn("failed to parse partition key isolation", zap.Error(isoErr)) + } + if iso { + partitionKeyIsolation = true } } }