diff --git a/internal/streaming/clickhouse_connector/query.go b/internal/streaming/clickhouse_connector/query.go index c70b7ef96..429adfc4b 100644 --- a/internal/streaming/clickhouse_connector/query.go +++ b/internal/streaming/clickhouse_connector/query.go @@ -195,10 +195,10 @@ func (d queryMeterView) toSQL() (string, []interface{}, error) { where = append(where, queryView.Equal("subject", *d.Subject)) } if d.From != nil { - where = append(where, queryView.GreaterEqualThan("windowstart", d.From.UnixMilli())) + where = append(where, queryView.GreaterEqualThan("windowstart", d.From.Unix())) } if d.To != nil { - where = append(where, queryView.LessEqualThan("windowend", d.To.UnixMilli())) + where = append(where, queryView.LessEqualThan("windowend", d.To.Unix())) } if len(where) > 0 { queryView.Where(where...) diff --git a/internal/streaming/clickhouse_connector/query_test.go b/internal/streaming/clickhouse_connector/query_test.go index 3a372f180..6d4aebf5a 100644 --- a/internal/streaming/clickhouse_connector/query_test.go +++ b/internal/streaming/clickhouse_connector/query_test.go @@ -158,7 +158,7 @@ func TestQueryMeterView(t *testing.T) { WindowSize: &windowSize, }, wantSQL: "SELECT windowstart, windowend, subject, sumMerge(value) AS value, group1, group2 FROM openmeter.meter_meter1 WHERE subject = ? AND windowstart >= ? AND windowend <= ? GROUP BY windowstart, windowend, subject, group1, group2 ORDER BY windowstart", - wantArgs: []interface{}{"subject1", int64(1672531200001), int64(1672617600000)}, + wantArgs: []interface{}{"subject1", int64(1672531200), int64(1672617600)}, }, }