Skip to content

Commit

Permalink
Merge branch 'main' into bigquery/schema-change-float-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
heavycrystal authored Mar 18, 2024
2 parents 6c584ab + 23539f5 commit 3bece1f
Show file tree
Hide file tree
Showing 4 changed files with 2,639 additions and 2,071 deletions.
2 changes: 1 addition & 1 deletion flow/connectors/bigquery/bigquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ func (c *BigQueryConnector) NormalizeRecords(ctx context.Context, req *model.Nor
SoftDelete: req.SoftDelete,
})
if mergeErr != nil {
return nil, err
return nil, mergeErr
}

err = c.pgMetadata.UpdateNormalizeBatchID(ctx, req.FlowJobName, batchId)
Expand Down
15 changes: 2 additions & 13 deletions flow/connectors/postgres/qvalue_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,19 +231,8 @@ func parseFieldFromQValueKind(qvalueKind qvalue.QValueKind, value interface{}) (
case qvalue.QValueKindTime:
timeVal := value.(pgtype.Time)
if timeVal.Valid {
var timeValStr any
timeValStr, err := timeVal.Value()
if err != nil {
return qvalue.QValue{}, fmt.Errorf("failed to parse time: %w", err)
}
// edge case, only Postgres supports this extreme value for time
timeValStr = strings.Replace(timeValStr.(string), "24:00:00.000000", "23:59:59.999999", 1)
t, err := time.Parse("15:04:05.999999", timeValStr.(string))
t = t.AddDate(1970, 0, 0)
if err != nil {
return qvalue.QValue{}, fmt.Errorf("failed to parse time: %w", err)
}
val = qvalue.QValue{Kind: qvalue.QValueKindTime, Value: t}
// 86399999999 to prevent 24:00:00
val = qvalue.QValue{Kind: qvalue.QValueKindTime, Value: time.UnixMicro(min(timeVal.Microseconds, 86399999999))}
}
case qvalue.QValueKindTimeTZ:
timeVal := value.(string)
Expand Down
Loading

0 comments on commit 3bece1f

Please sign in to comment.