ArrayIdentifierExpression and JsonArrayIdentifierExpression to pass type info to flat collections #249
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
There are certain cases in which we want to differentiate primitive from array fields in flat collections. For example, if we want to add a filter to an array column that
cardinality(col) > 0. This information can also be used to apply array/primitive level optimisations while generating the PG queries.For example, consider this query:
SELECT "id" AS "API.id", "attributes.name" AS "API.name" FROM "entities_api" WHERE (ARRAY["id"]::text[] && ARRAY['0437f39b-19c7-3cdc-a91b-2304b15e85d7', '05162aaf-a0b6-3e76-a8a2-f82fda639d4d', '05e318bc-eda0-395a-8dc5-a9a642858911']::text[]) AND ("tenantId" = 'df6f1cc2-9f7f-4633-bf0c-ddb1c510dcde') OFFSET 0 LIMIT 10Here,
idis a primitive but even then we're casting it as an array and using the overlap operator to check if it's contained in the RHS array. This is very inefficient. With this type info, we'd be able to use primitive operators for such cases.Testing
Currently, these classes are not used anywhere. Tests would be added as-and-when they start getting used.
Checklist: