featurebase/internal/public.proto
Matt Jaffee 5dcabfcc7f
support for decimal fields
This commit adds a Decimal field type which is implemented mostly with
the Int field. It adds an optional "Scale" value to the Int field
which means that the values stored in that field are actually meant to
be divided by 10^Scale before being interpreted.

In order to make use of this functionality, we extend the importValue
request to allow a slice of floats rather than just int64. If the
slice of floats is present, each float in the slice is multiplied by
10^Scale and converted to an int64 before being imported. If a slice
of int64 is imported to a Decimal field, it is treated normally, and
scale is ignored. This allows the conversion to be handled at the
client side if desired.

Currently there are Field level methods for querying Float values out
of a decimal field, but no support in PQL or the executor for getting
float values. Going to wait until I can use the generic result type
before doing that, so for now, any values queried will be the scaled
integer values.

needed to add client support for importing float values, and did this
by adding a more general and simplified client method for value
imports.

rewrote api.ImportValue to use the new method which should be more
performant and efficient.

allow floats to be "pilosa import"ed into decimal fields
2019-10-29 16:36:14 -05:00

123 lines
No EOL
2 KiB
Protocol Buffer

syntax = "proto3";
package internal;
message Row {
repeated uint64 Columns = 1;
repeated string Keys = 3;
repeated Attr Attrs = 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;
}
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;
}
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;
}