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

[0.9.3] DB should not crash when using invalid expression "GROUP BY time" #3902

Closed
jeremyVignelles opened this issue Aug 31, 2015 · 8 comments

Comments

@jeremyVignelles
Copy link

Hi,

From a fresh database, i created a point with the admin by writing:

test value=0

Then, issuing the query

SELECT value FROM test GROUP BY time

crashes the database.
Here is the log : http://pastebin.com/g6DqnF43

By the way, is there any way I can select all the timestamps for a measurement (optionally filtered by a where clause) ?

Thanks for your work

@desa
Copy link
Contributor

desa commented Aug 31, 2015

@jeremyVignelles thank you for reporting this. I'm getting the same error.

panic: interface conversion: interface is float64, not map[string]interface {}

goroutine 128 [running]:
github.com/influxdb/influxdb/tsdb.(*limitedRowWriter).processValues(0xc2080f0600, 0xc208a04000, 0x2, 0x2710, 0x0)
    /Users/michaeldesa/go/src/github.com/influxdb/influxdb/tsdb/executor.go:741 +0x1083
github.com/influxdb/influxdb/tsdb.(*limitedRowWriter).Flush(0xc2080f0600)
    /Users/michaeldesa/go/src/github.com/influxdb/influxdb/tsdb/executor.go:667 +0xd6
github.com/influxdb/influxdb/tsdb.(*SelectExecutor).executeRaw(0xc2088cd1a0, 0xc20898f0e0)
    /Users/michaeldesa/go/src/github.com/influxdb/influxdb/tsdb/executor.go:234 +0x4e2
created by github.com/influxdb/influxdb/tsdb.(*SelectExecutor).Execute
    /Users/michaeldesa/go/src/github.com/influxdb/influxdb/tsdb/executor.go:94 +0x9a

@desa
Copy link
Contributor

desa commented Aug 31, 2015

@jeremyVignelles in regards to By the way, is there any way I can select all the timestamps for a measurement (optionally filtered by a where clause) ? can you be a little more specific? An example of the functionality you're looking for would be good.

@jeremyVignelles
Copy link
Author

@mjdesa : I meant something like this:

SELECT time FROM measurement WHERE time > now() - 3d GROUP BY time

The idea behind this is to provide a timeline for events that happens unfrequently (once a day for example), where the user can click to view the data (128 fields * 768 rows with the same timestamp).
Is there a way to achieve this?

@beckettsean
Copy link
Contributor

@jeremyVignelles I don't understand what would be different about the output from

SELECT time FROM measurement WHERE time > now() - 3d GROUP BY time
vs
SELECT * FROM measurement WHERE time > now() - 3d

Can you maybe give some example output showing what you are describing?

@beckettsean beckettsean changed the title crash when using GROUP BY time [0.9.3] DB should not crash when using invalid expression "GROUP BY time" Aug 31, 2015
@jeremyVignelles
Copy link
Author

In the first case, you would get only the distinct timestamps, whereas the second would send all the data with the request.
The user would click on a time point afterwards, and a query like "SELECT * FROM test WHERE time = timestamp" would retrieve the actual data.
I mentioned 3days in my example query, but the timeline I would like to implement should be able to show the time points for the last month.
The timeline itself would be displayed in a browser with some js, and I don't want the user's memory to be overloaded with useless data.

@zimbatm
Copy link

zimbatm commented Sep 1, 2015

@jeremyVignelles if your data is sparse it's probably better to return all the data points instead of having most timestamps filled with null. GROUP BY time(1s) is probably good enough otherwise.

@jeremyVignelles
Copy link
Author

@zimbatm This is what I want, select all the timestamp for all the datapoints, but I would like to remove timestamp duplicates for that, and I would expect the expression GROUP BY time to act this way:

  • Take all the data points
  • Create groups of data points which have the exact same timestamp
  • Return one row per group, with the given timestamp (very quickly, of course 😉 )

Indeed, I do not want extra null values which will be polluting the data when using GROUP BY time(1s). Most of the time, I will have one timestamp per day, but when doing manual tests, there could be 2 or 3 timestamps in 15 minutes...

@beckettsean beckettsean added this to the 0.9.4 milestone Sep 1, 2015
@beckettsean
Copy link
Contributor

@jeremyVignelles It sounds like you want something more or less like SELECT DISTINCT(time) FROM ... to get a list of all the times at which one ore more points exist.

Please open a feature request in a new issue for that, as this one is now about preventing the panic from the incorrect query.

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

No branches or pull requests

5 participants