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

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

Open
alexdebril opened this issue Aug 25, 2022 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@alexdebril
Copy link
Contributor

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.

@alexdebril alexdebril added the bug Something isn't working label Aug 25, 2022
@alexdebril alexdebril self-assigned this Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant