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 in transform iterator on division #6419

Merged
merged 1 commit into from
Apr 20, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
- [#6413](https://github.com/influxdata/influxdb/pull/6413): Prevent goroutine leak from persistent http connections. Thanks @aaronknister.
- [#6414](https://github.com/influxdata/influxdb/pull/6414): Send "Connection: close" header for queries.
- [#6425](https://github.com/influxdata/influxdb/pull/6425): Close idle tcp connections in HTTP client to prevent tcp conn leak.
- [#6419](https://github.com/influxdata/influxdb/issues/6419): Fix panic in transform iterator on division. @thbourlove

## v0.12.1 [2016-04-08]

Expand Down
66 changes: 63 additions & 3 deletions influxql/select.go
Original file line number Diff line number Diff line change
Expand Up @@ -840,13 +840,33 @@ func buildTransformIterator(lhs Iterator, rhs Iterator, op Token, ic IteratorCre
left: newBufIntegerIterator(left),
right: newBufIntegerIterator(right),
fn: func(a *IntegerPoint, b *IntegerPoint) *FloatPoint {
if a == nil && b == nil {
return nil
} else if a == nil {
return &FloatPoint{
Name: b.Name,
Tags: b.Tags,
Time: b.Time,
Aux: b.Aux,
Nil: true,
}
} else if b == nil {
return &FloatPoint{
Name: a.Name,
Tags: a.Tags,
Time: a.Time,
Aux: a.Aux,
Nil: true,
}
}

p := &FloatPoint{
Name: a.Name,
Tags: a.Tags,
Time: a.Time,
Aux: a.Aux,
}
if (a != nil && b != nil) && (!a.Nil && !b.Nil) {
if !a.Nil && !b.Nil {
p.Value = fn(a.Value, b.Value)
} else {
p.Nil = true
Expand Down Expand Up @@ -911,13 +931,33 @@ func buildTransformIterator(lhs Iterator, rhs Iterator, op Token, ic IteratorCre
left: newBufFloatIterator(left),
right: newBufFloatIterator(right),
fn: func(a *FloatPoint, b *FloatPoint) *BooleanPoint {
if a == nil && b == nil {
return nil
} else if a == nil {
return &BooleanPoint{
Name: b.Name,
Tags: b.Tags,
Time: b.Time,
Aux: b.Aux,
Nil: true,
}
} else if b == nil {
return &BooleanPoint{
Name: a.Name,
Tags: a.Tags,
Time: a.Time,
Aux: a.Aux,
Nil: true,
}
}

p := &BooleanPoint{
Name: a.Name,
Tags: a.Tags,
Time: a.Time,
Aux: a.Aux,
}
if (a != nil && b != nil) && (!a.Nil && !b.Nil) {
if !a.Nil && !b.Nil {
p.Value = fn(a.Value, b.Value)
} else {
p.Nil = true
Expand All @@ -938,13 +978,33 @@ func buildTransformIterator(lhs Iterator, rhs Iterator, op Token, ic IteratorCre
left: newBufIntegerIterator(left),
right: newBufIntegerIterator(right),
fn: func(a *IntegerPoint, b *IntegerPoint) *BooleanPoint {
if a == nil && b == nil {
return nil
} else if a == nil {
return &BooleanPoint{
Name: b.Name,
Tags: b.Tags,
Time: b.Time,
Aux: b.Aux,
Nil: true,
}
} else if b == nil {
return &BooleanPoint{
Name: a.Name,
Tags: a.Tags,
Time: a.Time,
Aux: a.Aux,
Nil: true,
}
}

p := &BooleanPoint{
Name: a.Name,
Tags: a.Tags,
Time: a.Time,
Aux: a.Aux,
}
if (a != nil && b != nil) && (!a.Nil && !b.Nil) {
if !a.Nil && !b.Nil {
p.Value = fn(a.Value, b.Value)
} else {
p.Nil = true
Expand Down