You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Comparison operators only compare the first element for arrays against a scalar value #3136
What is the bug?
The comparison operators (=, !=, >, >=, <, <=) do not properly compare arrays. The comparison is performed on each element against a scalar value. If any element passes the comparison, then the whole array is considered to pass the comparison.
SELECT x, y FROM test3 WHERE y > 3;
{"x": 2, "y": [3, 4]}
{"x": 3, "y": [1, 5]}
Expected result:
Throw an exception since the types for the comparison are different. If both sides are arrays, then perform the comparison element by element until there is a difference.
How can one reproduce the bug?
Steps to reproduce the behavior:
Create a new index and load the data above
Run the query above
What is the expected behavior?
Throw an exception if the comparison is between an array and a scalar value. If the comparison is between two arrays, perform the comparison element by element.
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.
changed the title [-][BUG] Comparison operators only compare all element for arrays against a scalar value[/-][+][BUG] Comparison operators only compare the first element for arrays against a scalar value[/+]on Oct 30, 2024
Activity
[-][BUG] Comparison operators only compare all element for arrays against a scalar value[/-][+][BUG] Comparison operators only compare the first element for arrays against a scalar value[/+]normanj-bitquill commentedon Oct 30, 2024
Related to this, there should be a way of providing an array literal for comparisons in the OpenSearch engine.
andrross commentedon Nov 18, 2024
[Catch All Triage - 1, 2, 3, 4, 5]
Fix array comparison to use lexicographic ordering instead of size-only
qianheng-aws commentedon Apr 10, 2026
Closing as duplicate of #5333 — consolidated umbrella issue for array values not treated as atomic values.