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

Distinct/Count (aggregate ?) don't take limit into account #362

Closed
FGRibreau opened this issue Mar 25, 2014 · 3 comments
Closed

Distinct/Count (aggregate ?) don't take limit into account #362

FGRibreau opened this issue Mar 25, 2014 · 3 comments
Milestone

Comments

@FGRibreau
Copy link

select distinct(key) from monitoring limit 3;

Should returns 1 to 3 lines but instead returns every distinct key from the monitoring collection, it should not.

Same with count:

select count(key) from monitoring
┌───────────────┬───────┐
│ time          │ count │
├───────────────┼───────┤
│ 1395780644966 │ 3652  │
└───────────────┴───────┘
select count(key) from monitoring limit 40
┌───────────────┬───────┐
│ time          │ count │
├───────────────┼───────┤
│ 1395780644966 │ 3652  │
└───────────────┴───────┘

Tested on InfluxDB 0.5.0

@jvshahid jvshahid added this to the 0.5.2 milestone Mar 25, 2014
@FGRibreau FGRibreau changed the title Distinct does not take limit into account Distinct/Count (aggregate ?) don't take limit into account Mar 25, 2014
@jvshahid jvshahid modified the milestones: 0.5.3, 0.5.2, 0.5.4 Mar 28, 2014
@pauldix
Copy link
Member

pauldix commented Mar 31, 2014

Note to @jvshahid: We should be processing the limit both at the shard level and at the coordinator level.

@jvshahid
Copy link
Contributor

jvshahid commented Apr 1, 2014

@FGRibreau your first example is considered a bug. When it comes to the second example, I think count() should return the number of all points and not just 40. This story will fix the behavior of limit to be applied after the aggregation is done, that means, limit will limit the number of points returned to the client and not the number of points that are input to the aggregator

@FGRibreau
Copy link
Author

When it comes to the second example, I think count() should return the number of all points and not just 40

Indeed, the bug is only true for distinct. For reference in (my)SQL:

SELECT COUNT (id) FROM account LIMIT 40
// is indeed the same as `SELECT COUNT (id) FROM account`

// however
SELECT DISTINCT (id) FROM account LIMIT 40
// returns 40 lines. (all id from account are different)

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

No branches or pull requests

3 participants