mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 17:48:29 +08:00
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:
parent
ea307ea3c9
commit
4d5afec9a8
@ -324,7 +324,8 @@ func (m *CompactionTriggerManager) ManualTrigger(ctx context.Context, collection
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *CompactionTriggerManager) triggerViewForCompaction(ctx context.Context, eventType CompactionTriggerType,
|
func (m *CompactionTriggerManager) triggerViewForCompaction(ctx context.Context, eventType CompactionTriggerType,
|
||||||
view CompactionView) ([]CompactionView, string) {
|
view CompactionView,
|
||||||
|
) ([]CompactionView, string) {
|
||||||
if eventType == TriggerTypeLevelZeroViewIDLE {
|
if eventType == TriggerTypeLevelZeroViewIDLE {
|
||||||
view, reason := view.ForceTrigger()
|
view, reason := view.ForceTrigger()
|
||||||
return []CompactionView{view}, reason
|
return []CompactionView{view}, reason
|
||||||
|
|||||||
@ -256,7 +256,7 @@ func (it *insertTask) PreExecute(ctx context.Context) error {
|
|||||||
|
|
||||||
// trans timestamptz data
|
// trans timestamptz data
|
||||||
_, colTimezone := getColTimezone(colInfo)
|
_, colTimezone := getColTimezone(colInfo)
|
||||||
err = timestamptzIsoStr2Utc(it.insertMsg.GetFieldsData(), colTimezone, "")
|
err = timestamptzIsoStr2Utc(it.insertMsg.GetFieldsData(), colTimezone)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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{
|
it.upsertMsg = &msgstream.UpsertMsg{
|
||||||
InsertMsg: &msgstream.InsertMsg{
|
InsertMsg: &msgstream.InsertMsg{
|
||||||
InsertRequest: &msgpb.InsertRequest{
|
InsertRequest: &msgpb.InsertRequest{
|
||||||
|
|||||||
@ -2765,7 +2765,7 @@ func getDbTimezone(dbInfo *databaseInfo) (bool, string) {
|
|||||||
return getDefaultTimezoneVal(dbInfo.properties...)
|
return getDefaultTimezoneVal(dbInfo.properties...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func timestamptzIsoStr2Utc(columns []*schemapb.FieldData, colTimezone string, dbTimezone string) error {
|
func timestamptzIsoStr2Utc(columns []*schemapb.FieldData, colTimezone string) error {
|
||||||
naiveLayouts := []string{
|
naiveLayouts := []string{
|
||||||
"2006-01-02T15:04:05.999999999",
|
"2006-01-02T15:04:05.999999999",
|
||||||
"2006-01-02T15:04:05",
|
"2006-01-02T15:04:05",
|
||||||
@ -2799,8 +2799,6 @@ func timestamptzIsoStr2Utc(columns []*schemapb.FieldData, colTimezone string, db
|
|||||||
defaultTZ := "UTC"
|
defaultTZ := "UTC"
|
||||||
if colTimezone != "" {
|
if colTimezone != "" {
|
||||||
defaultTZ = colTimezone
|
defaultTZ = colTimezone
|
||||||
} else if dbTimezone != "" {
|
|
||||||
defaultTZ = dbTimezone
|
|
||||||
}
|
}
|
||||||
|
|
||||||
location, err := time.LoadLocation(defaultTZ)
|
location, err := time.LoadLocation(defaultTZ)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user