fix: skip dim check for non-vector fields in PreCheck (#41287) (#41289)

## What this PR does

This PR fixes an issue where the `PreCheck` function in DataCoord logs
unnecessary warnings
when attempting to retrieve 'dim' from non-vector fields.

The change adds a check to only call `GetDimFromParams` when the field
type is a vector type.

## Related issue

Fixes #41287

---------

Signed-off-by: 박상호 <sangho@rapportlabs.kr>
Signed-off-by: Sangho Park <hoyaspark@gmail.com>
pull/40323/head^2
박상호 2025-04-16 18:52:32 +09:00 committed by GitHub
parent a6606ce9c6
commit 4be6d0e967
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 5 deletions

View File

@ -207,11 +207,15 @@ func (it *indexBuildTask) PreCheck(ctx context.Context, dependency *taskSchedule
}
}
dim, err := storage.GetDimFromParams(field.GetTypeParams())
if err != nil {
log.Ctx(ctx).Warn("failed to get dim from field type params",
zap.String("field type", field.GetDataType().String()), zap.Error(err))
// don't return, maybe field is scalar field or sparseFloatVector
// Extract dim only for vector types to avoid unnecessary warnings
dim := -1
if typeutil.IsFixDimVectorType(field.GetDataType()) {
if dimVal, err := storage.GetDimFromParams(field.GetTypeParams()); err != nil {
log.Ctx(ctx).Warn("failed to get dim from field type params",
zap.String("field type", field.GetDataType().String()), zap.Error(err))
} else {
dim = dimVal
}
}
// vector index build needs information of optional scalar fields data