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] Calculations in WHERE clause produce wrong result #658

Open
Yury-Fridlyand opened this issue Jun 24, 2022 · 0 comments
Open

[BUG] Calculations in WHERE clause produce wrong result #658

Yury-Fridlyand opened this issue Jun 24, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@Yury-Fridlyand
Copy link
Collaborator

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

  1. Import test data set (run from root of SQL plugin repo)
curl -s -XPOST localhost:9200/beer.stackexchange/_bulk -H 'Content-Type: application/x-ndjson' --data-binary @integ-test/src/test/resources/beer.stackexchange.json
  1. Execute query
select Id, length(Body) as len from beer.stackexchange order by len desc LIMIT 5;

The result:

fetched rows / total rows = 5/5
+------+-------+
| Id   | len   |
|------+-------|
| 580  | 2037  |
| 105  | 1263  |
| 351  | 1241  |
| 590  | 1197  |
| 235  | 1137  |
+------+-------+
  1. Due to #292 I can’t use alias and I have to make calculations in WHERE clause too
select Id, length(Body) as len, Body from beer.stackexchange where length(Body) > 500;

What is the expected behavior?
Result set should contain lines where Body has a long enough value.

Actual result
Incorrect (empty result set) calculation results returned.

fetched rows / total rows = 0/0
+------+-------+--------+
| Id   | len   | Body   |
|------+-------+--------|
+------+-------+--------+

What is your host/environment?
Tested on 7cbb121cb3ad144a5e6d5b9acb9ae8e6da01688e (current main/HEAD).
OpenSearch 2.0

Might be related to #657.

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