Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

frankmcsherry
Copy link
Member

Our ord_neu.rs batch/trace implementations use a manual implementation of a short trie. Rather than have the work happen in bespoke methods we need to copy/paste, extract the logic out into trie "layers" which can be composed. For example, the "singleton optimization" for updates lived in four locations, with a fifth in rhh.rs. This change moves that to be one location, in the update trie layer, used by all four.

This is the first step in trying to make these types more "trie-forward", revealing their layered structure rather than living behind abstractions that conceal the structure. The goal for the moment is to get a sense for what the code looks like when you compartmentalize and modularize the logic and data. So far, pretty good!

Historically we had something similar, though it was more complicated than it needed to be. The reason seems to be that we previously had as trie layers pairs (Vec<T>, Vec<usize>) to indicate a list of keys and their offsets in the next layer. It turns out that (Vec<usize>, Vec<T>) is a better representation, with fewer cross-layer dependencies.

@frankmcsherry frankmcsherry marked this pull request as ready for review July 11, 2025 14:24
Copy link
Member

@antiguru antiguru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great; let's go!

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the bespoke trie logic in ord_neu.rs into reusable “layer” abstractions (Vals, Upds, and the UpdsBuilder), and updates both the value‐batch and key‐batch implementations (and the columnar.rs example) to use these new layers instead of manual offset handling and singleton optimizations.

  • Introduce layers module with Vals and Upds containers and an UpdsBuilder helper
  • Replace manual offset arrays and singleton‐optimization code in OrdValStorage, OrdKeyStorage, and their builders
  • Update the columnar.rs example to use the new abstractions

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
differential-dataflow/src/trace/implementations/ord_neu.rs Extracted trie layers into layers::{Vals, Upds} and rewrote val_batch/key_batch to use them
differential-dataflow/examples/columnar.rs Updated example builders to leverage Vals, Upds, and UpdsBuilder
Comments suppressed due to low confidence (2)

differential-dataflow/src/trace/implementations/ord_neu.rs:161

  • The doc comment refers to self.vals, but this method actually uses self.offs to compute offsets into times/diffs. Update the comment to accurately describe what is being bounded (e.g., "offsets into times and diffs").
        /// Lower and upper bounds in `self.vals` of the indexed list.

differential-dataflow/src/trace/implementations/ord_neu.rs:143

  • [nitpick] The abbreviation Upds may be unclear to new readers. Consider renaming to a more descriptive name (e.g., Updates) to align with Vals and improve readability.
    pub struct Upds<O, T, D> {

@frankmcsherry frankmcsherry merged commit 5caad7b into TimelyDataflow:master Jul 11, 2025
5 checks passed
@frankmcsherry frankmcsherry deleted the re_tries branch July 11, 2025 14:43
@github-actions github-actions bot mentioned this pull request Jul 11, 2025
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.

2 participants