Comments (5)
The multi-temporal post has the right content in it, but it might be hard to read it out and interpret it. If you think of the timestamps there as pairs of (system time, query time)
, then you can hold on to a capability for (now(), 0)
for your query input. As now()
advances, you tick forward to (now(), 0)
for some new value, and as you have queries at certain times you introduce (now(), query time)
into the input. Whenever now()
next ticks forward, the result for that query will be available in the output at (then, query time)
.
from differential-dataflow.
Ahah thank you for the info! I have so far always been using the same timestamp across all inputs - calling .advance_to
on all inputs.
I am re-studying timestamps in timely/differential to understand how multiple different timestamps will work. Will post on here with what I find after more reading and experimenting.
from differential-dataflow.
Good luck! It's certainly not obvious, and not easy. But (from experience) eventually the timestamps click and you realize all sorts of things you can do with them!
from differential-dataflow.
I think I figured it out!
So I created 2 unordered inputs with scope.new_unordered_input()
- one for values, one for queries, which gives a corresponding input, capability and stream for each. Values are just single u32
s, queries are a (query ID, value-to-query) pair. I combined dataflow operators to join/map/filter the value and query streams together, and inspect
the query results.
Then I call value_input.session(value_capability).give(...)
with a (u32 value, Pair time, diff) triple for each value to input at various times with the "system" and "valid" time being the same (1,1), (2,2), etc. To add a query I call:
let mut session = query_input.session(query_capability.clone());
session.give((value_query.clone(), query_time.clone(), 1));
// The intent of this is to remove the query after we have got the one-off output at `query_time`
session.give((value_query, Pair::new(query_time.first, query_time.second + 1), -1));
As suggested query_time
will be (now(), time_in_the_past_I_want_to_query_at).
If query_time
is (5,2)
, when now() advances to 6 it will output the results with positive diffs for (5,2)
and the same but negative diffs for (5,3)
. To only get the positive diffs I want at (5,2)
I also make the query aware of its own time, passing query_time
in with the query itself, so it can choose to only publish information in .inspect
if query.time == time
.
If I understand correctly, all collections need to use the same Timestamp
type i.e. Pair
to be able to combine them together, is that correct or is there some way to convert them?
from differential-dataflow.
Also, I noticed that trying to use scope.new_collection()
with the Pair
type gives me this error:
the trait
TotalOrder
is not implemented forPair<u64, u64>
If I understand correctly, this is because not all Pairs can be compared in a logical way, so that also means that if I'm using Pair
then all of my collections / inputs need to be unordered.
from differential-dataflow.
Related Issues (20)
- Strategies for maintaining persistent states (the data in Collections) HOT 2
- Consolidate Timestamps and Time Windowed Dataflows
- what different with flink Retraction
- Optional Abomonation? HOT 1
- Replicate Cross Join Situation HOT 2
- Operator to flatten `Collection<Collection<G, D, R>>` into `Collection<G, D, R>`
- Difficulty understanding how to use prefix_sum / how to implement topK HOT 6
- miri: Undefined Behavior: trying to retag from <20432167> for Unique permission in push_unchecked HOT 2
- Support `TimelyStack` as storage for `(T, R)` in arrangement leafs HOT 1
- Holding on to a trace with physical/logical compaction to the empty frontier stalls compaction
- Question: how to change data timestamp for late arriving data HOT 4
- maybe the doc should add some instructions at geting started section
- Does all data have to be in memory? HOT 3
- Revisit the stashing logic in MergeBatcherColumnation
- Arrangement batch formation costs in proportion to outstanding updates HOT 3
- Suggestion: WebAssembly support HOT 22
- Getting Started Guide for Newcomers Doesn't Work HOT 3
- Improve clarity around `Cursor` method requirements
- Implement flat container support for `PointStamp`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from differential-dataflow.