Skip to content

Commit

Permalink
fix(mc2mc): replace partition comparison (#63)
Browse files Browse the repository at this point in the history
* fix: dates delta comparison

* fix: dates delta comparison for less than a day
  • Loading branch information
deryrahman authored Jan 8, 2025
1 parent b6fd13a commit 334f8d3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mc2mc/mc2mc.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ func mc2mc(envs []string) error {
// for non partition table, only last query will be applied
queries := strings.Split(string(raw), query.BREAK_MARKER)
dates := []string{}
for i := start; i.Before(end); i = i.AddDate(0, 0, 1) {
dates = append(dates, i.Format(time.DateTime)) // normalize date format as temporary support
}
// if window size is less than or equal to partition delta(a DAY), then uses the same date
if end.Sub(start) <= time.Hour*24 {
if end.Sub(start) <= time.Hour*24 { // if window size is less than or equal to partition delta(a DAY), then uses the same date
dates = append(dates, start.Format(time.DateTime)) // normalize date format as temporary support
} else { // otherwise, generate dates
for i := start; i.Before(end); i = i.AddDate(0, 0, 1) {
dates = append(dates, i.Format(time.DateTime)) // normalize date format as temporary support
}
}

if len(queries) != len(dates) {
Expand Down

0 comments on commit 334f8d3

Please sign in to comment.