[tx] Expand TypedValue to include non-namespaced keywords #123

Open
opened 2020-08-06 16:55:17 +00:00 by gburd · 0 comments
gburd commented 2020-08-06 16:55:17 +00:00 (Migrated from github.com)

For simplicity, in #214 I only handled namespaced keywords, like :namespaced/keyword. However, the transactor and query engine can and should handle non-namespaced keywords, like :keyword. This ticket tracks adding support for such keywords.

This ticket is similar to #201, but a little simpler and potentially a little longer, since there are no new :db.type/* definitions and no new ValueType. You'll need to:

  1. Add a new TypedValue case, preferably by encapsulating the two types of keywords into one enum Keyword { NamespacedKeyword(...), Keyword(...) };
  2. Implement the conversions to and from SQL, using the facts that:
  • the SQL TEXT representation of ":namespaced/keyword" and ":keyword" doesn't overlap;
  • the value type tag of namespaced and non-namespaced keywords is the same (tag 13)
  1. Add tests for conversion around 1deed24f42/db/tests/value_tests.rs (L25).
  2. Update the transactor to handle the two types of keywords as required -- start by generalizingto_namespaced_keyword to handle both types of keyword (around 1deed24f42/db/src/lib.rs (L42))
  3. Add tests of the new types in the transactor and potentially in the query engine as well.
For simplicity, in #214 I only handled namespaced keywords, like `:namespaced/keyword`. However, the transactor and query engine can and should handle non-namespaced keywords, like `:keyword`. This ticket tracks adding support for such keywords. This ticket is similar to #201, but a little simpler and potentially a little longer, since there are no new `:db.type/*` definitions and no new `ValueType`. You'll need to: 1. Add a new `TypedValue` case, preferably by encapsulating the two types of keywords into one `enum Keyword { NamespacedKeyword(...), Keyword(...) }`; 1. Implement the conversions to and from SQL, using the facts that: - the SQL `TEXT` representation of ":namespaced/keyword" and ":keyword" doesn't overlap; - the value type tag of namespaced and non-namespaced keywords is the same (tag 13) 1. Add tests for conversion around https://github.com/mozilla/mentat/blob/1deed24f42847bc1eb0cfc26bada840643eaec33/db/tests/value_tests.rs#L25. 1. Update the transactor to handle the two types of keywords as required -- start by generalizing`to_namespaced_keyword` to handle both types of keyword (around https://github.com/mozilla/mentat/blob/1deed24f42847bc1eb0cfc26bada840643eaec33/db/src/lib.rs#L42) 1. Add tests of the new types in the transactor and potentially in the query engine as well.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: greg/mentat#123
No description provided.