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

InfluxQL default type should be settable by user #1271

Closed
sputnik13 opened this issue Mar 23, 2017 · 2 comments
Closed

InfluxQL default type should be settable by user #1271

sputnik13 opened this issue Mar 23, 2017 · 2 comments
Assignees
Labels

Comments

@sputnik13
Copy link
Contributor

sputnik13 commented Mar 23, 2017

The particular problem I'm having is that when count() is chained after where(), which is filtering a window()...

stream
| window().every(1s).period(60s)
| where(...)
| count('timestamp')

If the stream starts with data that does not fit the where criteria, count seems to initialize to an InfluxQL node for type float64. If the stream starts with data that does fit the where criteria, counts seems to initialize to an InfluxQL node for type int64.

The problem is if the count node starts as a float64 type, then when data meeting the where criteria start arriving, the timestamp type is int64, therefore kapacitor throws the following error

2017/03/23 17:14:13 E! failed to aggregate batch: field timestamp has wrong type: got int64 exp float64

I believe there is no way to coerce the data type for an InfluxQL node, and coercing timestamp to float64 would be the wrong thing to do.

This seems to be corroborated by https://github.com/influxdata/kapacitor/blob/master/influxql.go#L180 which seems to be setting the type of reducer used by batch InfluxQL nodes to float64 by default when there are no points in the batch. Changing this line to int64(0) allows the above scenario to work without issue.

It seems like there should be a user settable property that specifies the default type rather than having a hard coded float64 default.

@nathanielc
Copy link
Contributor

@sputnik13 Thanks for the detailed report. That should not be happening, the type should be able to switch dynamically and so the default type choice of float should not matter. Clearly there is a bug, thanks again.

@nathanielc nathanielc added the bug label Mar 23, 2017
@m4ce
Copy link
Contributor

m4ce commented Apr 11, 2017

I'm also experiencing something similar here

E! failed to aggregate batch: field duplex has wrong type: got int64 exp float64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants