Hi folks, what happens if one identical row exists...
# general
z
Hi folks, what happens if one identical row exists in two different segments?(one is generated from realtime to offline flow while the other is from backfill)
I mean when query, which one would win?
r
If the records exists in multiple segments of an offline table, then you could get duplicated query results.
If you're looking for deduplication behavior, I would recommend using a realtime table with Upsert enabled.
z
HYBRID table - If you already have a hybrid table this feature again may not be relevant to you. But you could explore using this to replace your offline push jobs, and simply keep them for backfills.
thanks. I came across this line - but it seems that we need to carefully coordinate these two jobs(RT2OFF and backfill) so as to not introduce duplications(e.g., when two time widows overlap)
I would recommend using a realtime table with Upsert enabled.
we also need star-tree index so Upsert is not compatible from my understanding?
r
That's correct.
To avoid any potential duplication between R2O and backfill, you may want to consider using the MergeRollupTask https://docs.pinot.apache.org/operators/operating-pinot/minion-merge-rollup-task
z
๐Ÿค” how does it solve the duplication problem?
r
IIRC, the MergeRollupTask should replace segments in the realtime portion of your hybrid table instead of copying them to the offline portion where they may collide with your backfill process
e
In the case of hybrid tables, there is also a notion of
timeBoundary
that can prevent duplication strictly in cases where the same row exists in both REALTIME and OFFLINE counterpart tables, with the same value in the
timeColumn
column. A helpful example from StarTree docs[1]:
For example, if we executed the following query:
```SELECT count(*)
FROM events```
The broker would send the following query to the offline table:
```SELECT count(*)
FROM events_OFFLINE
WHERE timeColumn <= $timeBoundary```
And the following query to the real-time table:
```SELECT count(*)
FROM events_REALTIME
WHERE timeColumn > $timeBoundary```
The results of the two queries are merged by the broker before being returned to the client.
[1] https://dev.startree.ai/docs/pinot/concepts/time-boundary#querying
๐Ÿ‘ 1
z
yeah in this case, the duplications happen to reside in offline table so the
timeBoundary
canโ€™t really help here
๐Ÿ˜ž 1