Skip to content

ReadLast returns too many cells when used with reversed attributes #3

Open
@alexdebril

Description

@alexdebril

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions