0

I'm looking for the best way of reading all the rows with a given prefix. I see that there is a withKeyRange method in BigTableIO.Read but it requires you to specify a start-key and and an end-key. Is there a way to specify reading from a prefix?

Narek
  • 548
  • 6
  • 26

1 Answers1

1

Since keys are lexicographically ordered, a given prefix can be converted to a start-key and an end-key. For example, words starting with "apple" can be found using "apple" as the start-key and "applf" as the end-key.

See this issue for some more details on computing the end-key.

This seems like it could be a reasonably useful contribution to Beam. Please consider filing a Jira issue suggesting it and possibly even contributing it!

Ben Chambers
  • 6,070
  • 11
  • 16