Skip to content
This repository was archived by the owner on Jan 26, 2026. It is now read-only.
This repository was archived by the owner on Jan 26, 2026. It is now read-only.

Consider removing schema hash from the header #20

@agavra

Description

@agavra

Currently the Imprint data format has a "schema" field which is 8 bytes: 4 bytes for the fieldspace and 4 for the schema hash. The idea behind this was that the schema hash would allow for more efficient validation of operations.

For example, consider three records with the following schema:

  1. Fields 1,2,5,6
  2. Fields 1,2,8,9
  3. Fields 2,4,7

A function that requires Fields 1,2 would accept records 1 and 2 but not 3. Maintaining hashes let us build up a prefix-trie of schema hashes (the leaf nodes are hashes, the internal nodes are field ids) that can efficiently determine superset/subset/disjoint conditions when comparing two schemas without scanning the entire field directory for each.

It also allows checking whether two records are of the same schema in O(1).

The prefix-trie lookup is ~O(log N) where N is the total number of fields while a direct field dict comparison is O(M+L) where M is the number of fields in the first record and L is the number of fields in the second.

All things being equal, it seems like maintaining a schema hash is not so useful for common operations and just adds unnecessary complexity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions