The way the reversed attributes are mapped in Big Table makes irrelevant the value returned by ReadLast.
Why
ReadLast uses bigtable.LatestNFilter(1) to build the filtering query. Let's say you've stored an "event_type" using the reversed system with this kind of definition:
"reversed": [
{
"name": "event_type",
"values": {
"11": "page_view",
"12": "add_to_cart",
"13": "purchase"
}
}
]
At the first call, "event_type" can be "page_view" and on second call it will be "purchase". Meaning Big Table will store two sets of cells for each event:
- timestamp 1 - 11: 1
- timestamp 2 - 13: 1
But as bigtable.LatestNFilter(1) returns the last version of all column qualifiers in the row, then both events will be provided whereas we want only the last one (being "purchase").
Solution
ReadLast should filter cells to keep only the newest event and discard old attributes that are related to reversed mapping.
The way the reversed attributes are mapped in Big Table makes irrelevant the value returned by
ReadLast.Why
ReadLastusesbigtable.LatestNFilter(1)to build the filtering query. Let's say you've stored an "event_type" using the reversed system with this kind of definition:At the first call, "event_type" can be "page_view" and on second call it will be "purchase". Meaning
Big Tablewill store two sets of cells for each event:But as
bigtable.LatestNFilter(1)returns the last version of all column qualifiers in the row, then both events will be provided whereas we want only the last one (being "purchase").Solution
ReadLastshould filter cells to keep only the newest event and discard old attributes that are related to reversed mapping.