fix: upsert error for timestamptz (#44548)

issue: https://github.com/milvus-io/milvus/issues/44527

Signed-off-by: xtx <xtianx@smail.nju.edu.cn>
This commit is contained in:
Tianx 2025-09-24 10:28:04 +08:00 committed by GitHub
parent ea307ea3c9
commit 4d5afec9a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 5 deletions

View File

@ -324,7 +324,8 @@ func (m *CompactionTriggerManager) ManualTrigger(ctx context.Context, collection
}
func (m *CompactionTriggerManager) triggerViewForCompaction(ctx context.Context, eventType CompactionTriggerType,
view CompactionView) ([]CompactionView, string) {
view CompactionView,
) ([]CompactionView, string) {
if eventType == TriggerTypeLevelZeroViewIDLE {
view, reason := view.ForceTrigger()
return []CompactionView{view}, reason

View File

@ -256,7 +256,7 @@ func (it *insertTask) PreExecute(ctx context.Context) error {
// trans timestamptz data
_, colTimezone := getColTimezone(colInfo)
err = timestamptzIsoStr2Utc(it.insertMsg.GetFieldsData(), colTimezone, "")
err = timestamptzIsoStr2Utc(it.insertMsg.GetFieldsData(), colTimezone)
if err != nil {
return err
}

View File

@ -996,6 +996,17 @@ func (it *upsertTask) PreExecute(ctx context.Context) error {
}
}
// trans timestamptz data
_, colTimezone := getColTimezone(colInfo)
err = timestamptzIsoStr2Utc(it.insertFieldData, colTimezone)
if err != nil {
return err
}
err = timestamptzIsoStr2Utc(it.req.GetFieldsData(), colTimezone)
if err != nil {
return err
}
it.upsertMsg = &msgstream.UpsertMsg{
InsertMsg: &msgstream.InsertMsg{
InsertRequest: &msgpb.InsertRequest{

View File

@ -2765,7 +2765,7 @@ func getDbTimezone(dbInfo *databaseInfo) (bool, string) {
return getDefaultTimezoneVal(dbInfo.properties...)
}
func timestamptzIsoStr2Utc(columns []*schemapb.FieldData, colTimezone string, dbTimezone string) error {
func timestamptzIsoStr2Utc(columns []*schemapb.FieldData, colTimezone string) error {
naiveLayouts := []string{
"2006-01-02T15:04:05.999999999",
"2006-01-02T15:04:05",
@ -2799,8 +2799,6 @@ func timestamptzIsoStr2Utc(columns []*schemapb.FieldData, colTimezone string, db
defaultTZ := "UTC"
if colTimezone != "" {
defaultTZ = colTimezone
} else if dbTimezone != "" {
defaultTZ = dbTimezone
}
location, err := time.LoadLocation(defaultTZ)