Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/reliable int mapping #30

Open
wants to merge 5 commits into
base: feature/new-ingest-process
Choose a base branch
from

Conversation

lmazz1-dbt
Copy link
Collaborator

@lmazz1-dbt lmazz1-dbt commented Dec 17, 2024

Context

We used to hash data rows, and assign to clusters of data rows an identity equal to the hash of all their children. We're now moving to a more compact representation, where data rows are given an integer key, and we want a unique way of mapping new clusters to new integer keys. This is made more tricky by the fact that we're parallelising the construction of hierarchical clusters.

Changes proposed in this pull request

  • Create IntMap data structure taking unordered sets of integers, and mapping them a to a key that 1) is a negative integer; 2) does not collide with other keys generated by other instances of this class, as long as they are initialised with a different salt.
  • A few small bug fixes

Guidance to review

The fact that keys are always negative means that it's possible to build a hierarchy where keys are themselves parts of keyed sets, and it's easy to distinguish integers mapped to raw data points (which will be non-negative), to integers that are keys to sets (which will be negative). The salt allows to work with a parallel execution model, where each worker maintains their separate key space, as long as each worker operates on disjoint subsets of positive integers. The salt and a key are combined via the Cantor pairing function.

Checklist:

  • My code follows the style guidelines of this project
  • New and existing unit tests pass locally with my changes

@lmazz1-dbt lmazz1-dbt changed the base branch from main to feature/new-ingest-process December 17, 2024 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant