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

count(<field>) function broken for empty SELECTs #8621

Closed
mmacfadden opened this issue Oct 24, 2018 · 2 comments
Closed

count(<field>) function broken for empty SELECTs #8621

mmacfadden opened this issue Oct 24, 2018 · 2 comments
Assignees
Labels
Milestone

Comments

@mmacfadden
Copy link
Contributor

mmacfadden commented Oct 24, 2018

OrientDB Version: 3.0.9

This is similar to #8280, which seems to only partially have been solved. When using count(*) and there are no matching items a proper result set is returned with a count of 0. However if you use count(<field>) and there are no matching elements an empty result set is returned.

CREATE CLASS Person;
CREATE PROPERTY Person.name STRING;

SELECT count(*) as count from Person;
-- returns: [{@version: 0, count: 0}]

SELECT count(name) as count from Person;
-- returns: []

INSERT INTO Person SET name="bob";

SELECT count(*) as count from Person;
-- returns: [{@version: 0, count: 1}]

SELECT count(name) as count from Person;
-- returns: [{@version: 0, count: 1}]

SELECT count(*) as count from Person WHERE name = "susan";
-- returns: `[{@version: 0, count: 0}]`

SELECT count(name) as count from Person WHERE name = "susan";
-- returns: []

So it seems like count(*) works properly. count(<field>) works when results match, but not when there are not records that match the SELECT.

@luigidellaquila luigidellaquila self-assigned this Oct 26, 2018
@luigidellaquila
Copy link
Member

Hi @mmacfadden

Thank you for reporting, I'm working to a fix now

Thanks

Luigi

@luigidellaquila luigidellaquila added this to the 3.0.11 milestone Oct 26, 2018
@luigidellaquila
Copy link
Member

Hi @mmacfadden

I just pushed a fix, it will be released with v 3.0.11

Thanks

Luigi

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

No branches or pull requests

2 participants