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

Parse Series IDs are 32-bit unsigned integers #1720

Merged
merged 1 commit into from
Feb 24, 2015
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## v0.9.0-rc5 [unreleased]

### Bugfixes

- [#1720](https://github.com/influxdb/influxdb/pull/1720): Parse Series IDs as unsigned 32-bits.

### Features

## v0.9.0-rc4 [2015-02-24]

### Bugfixes
Expand Down
21 changes: 18 additions & 3 deletions influxql/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,22 @@ func (p *Parser) parseInt(min, max int) (int, error) {
return n, nil
}

// parseUInt32 parses a string and returns a 32-bit unsigned integer literal.
func (p *Parser) parseUInt32() (uint32, error) {
tok, pos, lit := p.scanIgnoreWhitespace()
if tok != NUMBER {
return 0, newParseError(tokstr(tok, lit), []string{"number"}, pos)
}

// Convert string to unsigned 32-bit integer
n, err := strconv.ParseUint(lit, 10, 32)
if err != nil {
return 0, &ParseError{Message: err.Error(), Pos: pos}
}

return uint32(n), nil
}

// parseDuration parses a string and returns a duration literal.
// This function assumes the DURATION token has already been consumed.
func (p *Parser) parseDuration() (time.Duration, error) {
Expand Down Expand Up @@ -877,12 +893,11 @@ func (p *Parser) parseDropSeriesStatement() (*DropSeriesStatement, error) {

// If they didn't provide a FROM or a WHERE, they need to provide the SeriesID
if stmt.Condition == nil && stmt.Source == nil {
var id int
id, err = p.parseInt(0, math.MaxUint32)
id, err := p.parseUInt32()
if err != nil {
return nil, err
}
stmt.SeriesID = uint32(id)
stmt.SeriesID = id
}
return stmt, nil
}
Expand Down