Skip to content

Commit

Permalink
Fix EvalType when a parenthesis expression is used
Browse files Browse the repository at this point in the history
It did not descend into the expression within the parenthesis correctly
and would just recurse infinitely on itself instead.
  • Loading branch information
jsternberg committed Jan 31, 2017
1 parent a801c9d commit e8719c9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- [#7877](https://github.com/influxdata/influxdb/issues/7877): Fix mapping of types when the measurement uses a regex
- [#7888](https://github.com/influxdata/influxdb/pull/7888): Expand query dimensions from the subquery.
- [#7910](https://github.com/influxdata/influxdb/issues/7910): Fix EvalType when a parenthesis expression is used.

## v1.2.0 [2017-01-24]

Expand Down
2 changes: 1 addition & 1 deletion influxql/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -4451,7 +4451,7 @@ func EvalType(expr Expr, sources Sources, typmap TypeMapper) DataType {
return EvalType(expr.Args[0], sources, typmap)
}
case *ParenExpr:
return EvalType(expr, sources, typmap)
return EvalType(expr.Expr, sources, typmap)
case *NumberLiteral:
return Float
case *IntegerLiteral:
Expand Down
10 changes: 10 additions & 0 deletions influxql/ast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1136,6 +1136,16 @@ func TestEvalType(t *testing.T) {
},
},
},
{
name: `value inside a parenthesis`,
in: `(value)`,
typ: influxql.Float,
data: EvalFixture{
"cpu": map[string]influxql.DataType{
"value": influxql.Float,
},
},
},
} {
sources := make([]influxql.Source, 0, len(tt.data))
for src := range tt.data {
Expand Down

0 comments on commit e8719c9

Please sign in to comment.