Details
-
Bug
-
Status: Closed (View Workflow)
-
P2
-
Resolution: Done
-
29.1.1
-
-
CP: sprint 78
-
3
-
Core: Platform
Description
unit tests fail due to to lack of detection for indexes. The cql2pgjson queryByLike only checks ginIndex but it should check btree as well. It falls back to use sql = wrapInLowerUnaccent(indexText, schemaIndex); when it cannot find ginIndex (schemaIndex is null).
The following unit tests fail
@Test public void multiFieldNamesNonUniqueIndex() throws Exception { CQL2PgJSON cql2pgJson = new CQL2PgJSON("tablea"); cql2pgJson.setDbSchemaPath("templates/db_scripts/compoundIndex.json"); String sql = cql2pgJson.toSql("keys == x").toString(); String expected = "WHERE CASE WHEN length('x') <= 600 " + "THEN left(lower(f_unaccent(concat_space_sql(tablea.jsonb->>'key1' , tablea.jsonb->>'key2'))),600) LIKE lower(f_unaccent('x')) " + "ELSE left(lower(f_unaccent(concat_space_sql(tablea.jsonb->>'key1' , tablea.jsonb->>'key2'))),600) LIKE left(lower(f_unaccent('x')),600) " + "AND lower(f_unaccent(concat_space_sql(tablea.jsonb->>'key1' , tablea.jsonb->>'key2'))) LIKE lower(f_unaccent('x')) END"; assertEquals(expected, sql); } @Test public void multiFieldNamesUniqueIndex() throws Exception { CQL2PgJSON cql2pgJson = new CQL2PgJSON("tablea"); cql2pgJson.setDbSchemaPath("templates/db_scripts/compoundIndex.json"); String sql = cql2pgJson.toSql("barcode == y").toString(); String expected = "WHERE CASE WHEN length('y') <= 600 " + "THEN left(lower(f_unaccent(concat_space_sql(tablea.jsonb->>'department' , tablea.jsonb->>'staffnumber'))),600) LIKE lower(f_unaccent('y')) " + "ELSE left(lower(f_unaccent(concat_space_sql(tablea.jsonb->>'department' , tablea.jsonb->>'staffnumber'))),600) LIKE left(lower(f_unaccent('y')),600) " + "AND lower(f_unaccent(concat_space_sql(tablea.jsonb->>'department' , tablea.jsonb->>'staffnumber'))) LIKE lower(f_unaccent('y')) END"; assertEquals(expected, sql); }
TestRail: Results
Attachments
Issue Links
- blocks
-
RMB-498 Truncate b-tree string for 2712 index row size
-
- Closed
-
-
RMB-499 Add "normalizeDigits" function
-
- Closed
-
- relates to
-
RMB-534 Reject CQL queries that match no index in schema.json
-
- Open
-
-
RMB-549 Mismatch lower() for compound index
-
- Closed
-
-
MODINVSTOR-407 GET instance-storage_instances?query=(item.effectiveLocationId==${effectiveLocationVal}) is slow
-
- Closed
-