Skip to content

Commit

Permalink
refactor out single use variable
Browse files Browse the repository at this point in the history
  • Loading branch information
corylanou committed May 20, 2015
1 parent c291b3a commit 68f4b4c
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,6 @@ func (l *LocalMapper) Begin(c *influxql.Call, startingTime int64, chunkSize int)
l.chunkSize = chunkSize
l.tmin = startingTime

var isDistinct bool

// determine if this is a raw data query with a single field, multiple fields, or an aggregate
var fieldName string
if c == nil { // its a raw data query
Expand Down Expand Up @@ -407,14 +405,13 @@ func (l *LocalMapper) Begin(c *influxql.Call, startingTime int64, chunkSize int)
return fmt.Errorf("aggregate call didn't contain a field %s", c.String())
}

isDistinct = c.Name == "distinct"
}

// set up the field info if a specific field was set for this mapper
if fieldName != "" {
f := l.decoder.FieldByName(fieldName)
if f == nil {
if isDistinct {
if c.Name == "distinct" {
return fmt.Errorf("%s isn't a field on measurement %s; to query the unique values for a tag use SHOW TAG VALUES FROM %s WITH KEY = %q", fieldName, l.job.MeasurementName, l.job.MeasurementName, fieldName)
}
return fmt.Errorf("%s isn't a field on measurement %s", fieldName, l.job.MeasurementName)
Expand Down

0 comments on commit 68f4b4c

Please sign in to comment.