Skip to content

Commit

Permalink
Merge pull request influxdata#7916 from influxdata/js-7910-eval-type-…
Browse files Browse the repository at this point in the history
…with-paren

Fix EvalType when a parenthesis expression is used
  • Loading branch information
jsternberg authored Jan 31, 2017
2 parents 929b89b + e8719c9 commit 2fe8ed3
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 @@ -11,6 +11,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 2fe8ed3

Please sign in to comment.