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

[BUG] COUNT function counts number of elements in array values #3137

Open
normanj-bitquill opened this issue Oct 29, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@normanj-bitquill
Copy link
Contributor

What is the bug?
The COUNT function counts the number of elements in all array values rather than counting the number of array values.

Consider an index with the following data:

{"x": 1, "y": [1, 2]}
{"x": 2, "y": [3, 4]}
{"x": 3, "y": [1, 5]}
{"x": 4, "y": [1, 2]}
{"x": 5, "y": [2, 3]}

and this query:

SELECT COUNT(y) FROM test3;
10

Expected Result:

5

How can one reproduce the bug?
Steps to reproduce the behavior:

  1. Create a new index and load the data above
  2. Run the query above

What is the expected behavior?
The COUNT function only counts the number of array values.

What is your host/environment?

  • OS: Mac OS X (shouldn't matter)
  • Version: 3.0 code base
  • Plugins: SQL plugin

Do you have any screenshots?
N/A

Do you have any additional context?
Issue #1300 had a change recently merged in that allows array values to be used in query evaluation and in the result set.

@andrross
Copy link
Member

[Catch All Triage - 1, 2, 3, 4, 5]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants