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

Fix panic when parsing ms durations #7316

Merged
merged 1 commit into from
Sep 16, 2016
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion influxql/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -2686,7 +2686,7 @@ func ParseDuration(s string) (time.Duration, error) {
d += time.Duration(n) * time.Microsecond
case 'm':
if i+1 < len(a) && a[i+1] == 's' {
unit = string(a[i:2])
unit = string(a[i : i+2])
d += time.Duration(n) * time.Millisecond
i += 2
continue
Expand Down
1 change: 1 addition & 0 deletions influxql/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2125,6 +2125,7 @@ func TestParser_ParseStatement(t *testing.T) {
{s: `SELECT count(value), value FROM foo`, err: `mixing aggregate and non-aggregate queries is not supported`},
{s: `SELECT count(value)/10, value FROM foo`, err: `mixing aggregate and non-aggregate queries is not supported`},
{s: `SELECT count(value) FROM foo group by time(1s)`, err: `aggregate functions with GROUP BY time require a WHERE time clause`},
{s: `SELECT count(value) FROM foo group by time(500ms)`, err: `aggregate functions with GROUP BY time require a WHERE time clause`},
{s: `SELECT count(value) FROM foo group by time(1s) where host = 'hosta.influxdb.org'`, err: `aggregate functions with GROUP BY time require a WHERE time clause`},
{s: `SELECT count(value) FROM foo group by time`, err: `time() is a function and expects at least one argument`},
{s: `SELECT count(value) FROM foo group by 'time'`, err: `only time and tag dimensions allowed`},
Expand Down