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

Make Visible History explicit about the choice between "latest at" and "range" queries #4244

Closed
3 tasks
Tracked by #4107
abey79 opened this issue Nov 16, 2023 · 4 comments
Closed
3 tasks
Tracked by #4107
Labels
🟦 blueprint The data that defines our UI ui concerns graphical user interface

Comments

@abey79
Copy link
Member

abey79 commented Nov 16, 2023

Given time bounds A and B, our current querying model consist of "everything logged between A and B, if empty then whatever logged just before A", aka "latest at" and "range" semantics are fused. A "latest at" query are currently used when "A = B" instead of "range" query (actually only if "A = B = current time" IIRC), but that can be seen as an optimisation, as a "range" query with the same bounds would lead to the same result.

We must clarify the querying model and separate these semantics from each other. The query should either be "latest at A" or "range between A and B", the latter without leaking latest at semantics.

This involves changes in multiple areas:

This change can be seen as a starting point towards an even richer query ecosystem, e.g.:

@abey79 abey79 added ui concerns graphical user interface 🟦 blueprint The data that defines our UI labels Nov 16, 2023
@teh-cmc
Copy link
Member

teh-cmc commented Nov 16, 2023

Given time bounds A and B, our current querying model consist of "everything logged between A and B, if empty then whatever logged just before A"

Either I'm misreading this or that's incorrect: range queries over a range A->B always return a snapshot of the compacted state at A-minus-1 and then iterate between A and B, irrelevant of how much data there is between A and B.

A "latest at" query are currently used when "A = B" instead of "range" query (actually only if "A = B = current time" IIRC), but that can be seen as an optimisation, as a "range" query with the same bounds would lead to the same result.

LatestAt(frame=42) and RangeAt(frames=42..=42) are not equivalent: range queries expose sub-timestamp events and walk forwards in time while latest-at queries work at a timestamp level and do so by walking backwards.

E.g.

rr.set_time_sequence("frame", 42)
rr.log("mylogs", rr.Text("hello"))
rr.log("mylogs", rr.Text("world"))
LatestAt(frame=42): [
  `mylogs` @ frame=#42: [Text("world")]
]
RangeAt(frames=42..=42): [
  `mylogs` @ frame=#42: [Text("hello")]
  `mylogs` @ frame=#42: [Text("world")]
]

We must clarify the querying model and separate these semantics from each other. The query should either be "latest at A" or "range between A and B", the latter without leaking latest at semantics.

I very much want to clarify all of this and actually meant to open an issue about this, but not by separating them... on the contrary, by merging all query kinds into just one single configurable query type. 😅

@abey79
Copy link
Member Author

abey79 commented Nov 16, 2023

Thanks for the clarifications, it would actually be shocking if I had the details right :)

on the contrary, by merging all query kinds into just one single configurable query type.

This is fine. What's important is that:

  1. the blueprint property data structure models the various kinds of queries (or, in your parlance, the various kinds of query configurations) that we want to offer to the user, and
  2. the UI "just" reflects the content/organisation of that structure

No constraints on the query-ies API, so long as it works to implement the behaviour modelled by (1).

Worth remembering that our language around queries (latest at vs. range vs. strides, etc.) might/should be slightly different in a user-facing context (i.e. blueprint props data structure and UI, where we might have various "types of queries") vs. in a data-store context (single "configurable" query into the store).

@abey79
Copy link
Member Author

abey79 commented Nov 16, 2023

Example of phenomenon inherent to our current query model:

range_vs_latest_at_queries.mp4

@teh-cmc
Copy link
Member

teh-cmc commented Mar 15, 2024

Range queries don't have this weird behavior anymore (they are now multi-tenant proof).

@teh-cmc teh-cmc closed this as completed Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🟦 blueprint The data that defines our UI ui concerns graphical user interface
Projects
None yet
Development

No branches or pull requests

2 participants