mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-10 04:47:53 +00:00
So in some cases, when we do a query, the results of one part of the query are innately shared-across-nodes; for instance, a hypothetical Distinct query. More generally, we allow cross-index queries; calls can have "index=foo" in them. This patch lets us handle that without duplicating that query all over. Before we actually start doing the separate calls, we run the query once from the coordinating node, then patch the results in, and send relevant subsets over to each client, etcetera. Also provides slightly friendlier (and I hope faster) support for converting bitmaps to/from sets of rows. We also add an extension interface, and some fancy stuff to let us define new calls, which use this. They're sort of tied together because the first extension I wanted to implement needed precomputed calls. The extension API lets us create extensions using `pkg/plugin` (with all its associated limitations, unfortunately), then query them at load time for functionality. This also implies some revamping of the argument validation for PQL, like verifying that functions exist and knowing things about their argument types. So basically this is an overly intrusive patch, and would be better as separate patches, but they're hard to detangle. add trivial execution-time profiling What if you could ?profile=true on a query and get some numbers back? That'd be really cool. We already have tracing/spans, but right now, those only generate any data if you have something set up for them to trace to. Add a fancy wrapper that lets us generate our own tracing data, and dump it into the request response, if ?profile=true. add a sample extension, add missing features to extension interface Implement a naive probabilistic filter extension as an example of what an extension looks like. In the process, discover multiple omissions in the bitmap API. Well, I did *say* it was experimental.
131 lines
2.2 KiB
Protocol Buffer
131 lines
2.2 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package internal;
|
|
|
|
message Row {
|
|
repeated uint64 Columns = 1;
|
|
repeated string Keys = 3;
|
|
repeated Attr Attrs = 2;
|
|
bytes Roaring = 4;
|
|
}
|
|
|
|
message SignedRow {
|
|
Row Pos = 1;
|
|
Row Neg = 2;
|
|
}
|
|
|
|
message RowIdentifiers {
|
|
repeated uint64 Rows = 1;
|
|
repeated string Keys = 2;
|
|
}
|
|
|
|
message Pair {
|
|
uint64 ID = 1;
|
|
string Key = 3;
|
|
uint64 Count = 2;
|
|
}
|
|
|
|
message FieldRow{
|
|
string Field = 1;
|
|
uint64 RowID = 2;
|
|
string RowKey = 3;
|
|
}
|
|
|
|
message GroupCount{
|
|
repeated FieldRow Group = 1;
|
|
uint64 Count = 2;
|
|
}
|
|
|
|
message ValCount {
|
|
int64 Val = 1;
|
|
int64 Count = 2;
|
|
}
|
|
|
|
message ColumnAttrSet {
|
|
uint64 ID = 1;
|
|
string Key = 3;
|
|
repeated Attr Attrs = 2;
|
|
}
|
|
|
|
message Attr {
|
|
string Key = 1;
|
|
uint64 Type = 2;
|
|
string StringValue = 3;
|
|
int64 IntValue = 4;
|
|
bool BoolValue = 5;
|
|
double FloatValue = 6;
|
|
}
|
|
|
|
message AttrMap {
|
|
repeated Attr Attrs = 1;
|
|
}
|
|
|
|
message QueryRequest {
|
|
string Query = 1;
|
|
repeated uint64 Shards = 2;
|
|
bool ColumnAttrs = 3;
|
|
bool Remote = 5;
|
|
bool ExcludeRowAttrs = 6;
|
|
bool ExcludeColumns = 7;
|
|
repeated Row EmbeddedData = 8;
|
|
}
|
|
|
|
message QueryResponse {
|
|
string Err = 1;
|
|
repeated QueryResult Results = 2;
|
|
repeated ColumnAttrSet ColumnAttrSets = 3;
|
|
}
|
|
|
|
message QueryResult {
|
|
uint32 Type = 6;
|
|
Row Row = 1;
|
|
uint64 N = 2;
|
|
repeated Pair Pairs = 3;
|
|
bool Changed = 4;
|
|
ValCount ValCount = 5;
|
|
repeated uint64 RowIDs = 7;
|
|
repeated GroupCount GroupCounts = 8;
|
|
RowIdentifiers RowIdentifiers = 9;
|
|
SignedRow SignedRow = 10;
|
|
}
|
|
|
|
message ImportRequest {
|
|
string Index = 1;
|
|
string Field = 2;
|
|
uint64 Shard = 3;
|
|
repeated uint64 RowIDs = 4;
|
|
repeated uint64 ColumnIDs = 5;
|
|
repeated string RowKeys = 7;
|
|
repeated string ColumnKeys = 8;
|
|
repeated int64 Timestamps = 6;
|
|
}
|
|
|
|
message ImportValueRequest {
|
|
string Index = 1;
|
|
string Field = 2;
|
|
uint64 Shard = 3;
|
|
repeated uint64 ColumnIDs = 5;
|
|
repeated string ColumnKeys = 7;
|
|
repeated int64 Values = 6;
|
|
repeated double FloatValues = 8;
|
|
}
|
|
|
|
message TranslateKeysRequest {
|
|
string Index = 1;
|
|
string Field = 2;
|
|
repeated string Keys = 3;
|
|
}
|
|
|
|
message TranslateKeysResponse {
|
|
repeated uint64 IDs = 3;
|
|
}
|
|
|
|
message ImportRoaringRequestView {
|
|
string Name = 1;
|
|
bytes Data = 2;
|
|
}
|
|
|
|
message ImportRoaringRequest {
|
|
bool Clear = 1;
|
|
repeated ImportRoaringRequestView views = 2;
|
|
}
|