crate: Filtering on a column with `INDEX OFF` doesn't behave correctly
CrateDB version
5.4.0
Problem description
Filtering on a column with INDEX OFF doesn’t behave consistently.
Steps to Reproduce
cr> create table t(a int INDEX OFF);
CREATE OK, 1 row affected (0.327 sec)
cr> select * from t where a = 1;
SQLParseException[Cannot search on field [a] since it is not indexed.]
this seems fine, but:
cr> select * from t where a > 1;
+---+
| a |
+---+
+---+
SELECT 0 rows in set (0.008 sec)
and:
cr> insert into t(a) values(2), (3);
INSERT OK, 2 rows affected (0.043 sec)
cr> refresh table t;
REFRESH OK, 1 row affected (0.003 sec)
cr> select * from t where a > 1;
+---+
| a |
+---+
+---+
SELECT 0 rows in set (0.003 sec)
cr> select * from t where a + 1 > 1;
+---+
| a |
+---+
| 3 |
| 2 |
+---+
SELECT 2 rows in set (0.008 sec)
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 15 (15 by maintainers)
Because 5.3.0-5.3.2 incorrectly indexed the values despite
INDEX OFF. In 5.2.x it’s also broken.We should also look into making use of queries on doc-values if the index is not available. I suspect that would still be faster than using the generic function query.
@faymarie reported this issue with the empty result set instead of SQLParseException also affects queries with
LIKEandILIKE