Repository navigation
Run store.yaml's indexKeys drift guard on each SQL store - #600
Merged
Merged
Conversation
Draft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #511
#511's binding part, the compiler's
_cyk_index-key bind on Oracle, was already in. What was left was item 2: store.yaml'sindexKeysdrift guard (liberation-data/drivine-cypher-spec#286). The guard catches a module that works out a different key for a value than the store's index holds. A lookup by such a value would find nothing where the node is there.drivine4j's
IndexKeysCrossEngineTestchecks it by calling the module'sIndexKey.columnandIndexKey.ofdirectly. The module's JSON entry gives a library neither, sotests/integration/sql/test_index_keys.py(and its generated sync copy) checks what Python can reach, on Postgres, Oracle and SQLite.Setup: a range index over each key of a probe label (
id, and$id, stored as$$id), made through the schema API and dropped after. Each value the store pins is stored at rest under each key. Postgres uses Oracle's pins, as drivine4j does. A temporal tag carries its sort keys, which the module'stemporalKeyworks out. A duration has none.Checked on every store:
sfrom the module: a drift there would otherwise hide behind a lookup that still matches.Store by store:
sqlite_master, evaluates them over the node, and compares them with the pins, as drivine4j does withIndexKey.column. AnEXPLAIN QUERY PLANshows the lookup searches that index._cyk_v). Where it binds one, the test checks it equals the pin. A temporal, and an integer past 2^53, bind none: they are compared by the SQL over the value.Control test: a value the node doesn't hold isn't found: another text, a number, another date, and a date's digits as a text.
Mutation check: storing temporals without their sort key made every temporal row fail, under both keys. Giving SQLite Oracle's pins made the index readback report the difference.
Not checked here, so the guard is weaker than drivine4j's on two stores:
user_ind_expressions.IndexKey.ofandIndexKey.columnin its JSON entry: Expose IndexKey.of and IndexKey.column in the module's JSON entry, so a library's indexKeys guard can be exact drivine-cypher-spec#439.Tests:
ORACLE_TESTS=true) on the final commit:tests/integration: 4720 passed, 291 skipped, 7 xfailed, 1 xpassed, 0 failedtests/sync_integration: 4650 passed, 290 skipped, 7 xfailed, 1 xpassed, 0 failedReview: 3 passes, last CLEAN (the last fixed a comment only).
_cyk_on Oracle either.