skytable/skytable

Feature: Range queries

stevefan1999-personal opened this issue · 1 comments

Description

Support range queries like TiKV: https://tikv.org/docs/dev/develop/rawkv/scan/

client.put(ByteString.copyFromUtf8("k1"), ByteString.copyFromUtf8("v1"));
client.put(ByteString.copyFromUtf8("k2"), ByteString.copyFromUtf8("v2"));
client.put(ByteString.copyFromUtf8("k3"), ByteString.copyFromUtf8("v3"));
client.put(ByteString.copyFromUtf8("k4"), ByteString.copyFromUtf8("v4"));

// scan with limit
int limit = 1000;
List<Kvrpcpb.KvPair> list = client.scan(ByteString.copyFromUtf8("k1"), ByteString.copyFromUtf8("k5"), limit);
for(Kvrpcpb.KvPair pair : list) {
    System.out.println(pair);
}

Range queries will require a huge change in the fundamental data structures that we use. The one you see in the tree has already been replaced but even the new one that I've written (in the octave branch which isn't public yet) doesn't support ordered access.

I'm currently working on stabilizing the engine's implementation for octave. I think once we have a stable API is when we should revisit this. The issue is with efficient indexes for ordered accesses which matches the design goals of Skytable.

One more thing to note: it is actually fundamental that we support range queries since it is far too useful to ignore. Hence, we'll need to come back to this soon.