Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add one more condition for data querying to limit the end of date field #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type p2cReader struct {
func (r *p2cReader) getTimePeriod(query *remote.Query) (string, string, error) {

var tselSQL = "SELECT COUNT() AS CNT, (intDiv(toUInt32(ts), %d) * %d) * 1000 as t"
var twhereSQL = "WHERE date >= toDate(%d) AND ts >= toDateTime(%d) AND ts <= toDateTime(%d)"
var twhereSQL = "WHERE date >= toDate(%d) AND ts >= toDateTime(%d) AND ts <= toDateTime(%d) AND date <= toDate(%d)"
var err error
tstart := query.StartTimestampMs / 1000
tend := query.EndTimestampMs / 1000
Expand All @@ -45,7 +45,7 @@ func (r *p2cReader) getTimePeriod(query *remote.Query) (string, string, error) {
}

selectSQL := fmt.Sprintf(tselSQL, taggr, taggr)
whereSQL := fmt.Sprintf(twhereSQL, tstart, tstart, tend)
whereSQL := fmt.Sprintf(twhereSQL, tstart, tstart, tend, tend)

return selectSQL, whereSQL, nil
}
Expand Down