提交 d4de8d0c 编写于 作者: G Gao Hongtao

Update some fields

Signed-off-by: NGao Hongtao <hanahmily@gmail.com>
上级 207a5dfa
......@@ -34,32 +34,32 @@ public interface FieldAndValue extends Field {
static FieldAndValue build(Banyandb.TypedPair typedPair) {
if (typedPair.hasIntPair()) {
final Banyandb.IntPair intPair = typedPair.getIntPair();
if (intPair.getIsNull()) {
return new LongFieldPair(intPair.getKey(), null);
final Banyandb.Int intPair = typedPair.getIntPair();
if (typedPair.getIsNull()) {
return new LongFieldPair(typedPair.getKey(), null);
} else {
return new LongFieldPair(intPair.getKey(), intPair.getValue());
return new LongFieldPair(typedPair.getKey(), intPair.getValue());
}
} else if (typedPair.hasStrPair()) {
final Banyandb.StrPair strPair = typedPair.getStrPair();
if (strPair.getIsNull()) {
return new StringFieldPair(strPair.getKey(), null);
final Banyandb.Str strPair = typedPair.getStrPair();
if (typedPair.getIsNull()) {
return new StringFieldPair(typedPair.getKey(), null);
} else {
return new StringFieldPair(strPair.getKey(), strPair.getValue());
return new StringFieldPair(typedPair.getKey(), strPair.getValue());
}
} else if (typedPair.hasIntArrayPair()) {
final Banyandb.IntArrayPair intArrayPair = typedPair.getIntArrayPair();
if (intArrayPair.getIsNull()) {
return new LongArrayFieldPair(intArrayPair.getKey(), null);
final Banyandb.IntArray intArrayPair = typedPair.getIntArrayPair();
if (typedPair.getIsNull()) {
return new LongArrayFieldPair(typedPair.getKey(), null);
} else {
return new LongArrayFieldPair(intArrayPair.getKey(), intArrayPair.getValueList());
return new LongArrayFieldPair(typedPair.getKey(), intArrayPair.getValueList());
}
} else if (typedPair.hasStrArrayPair()) {
final Banyandb.StrArrayPair strArrayPair = typedPair.getStrArrayPair();
if (strArrayPair.getIsNull()) {
return new StringArrayFieldPair(strArrayPair.getKey(), null);
final Banyandb.StrArray strArrayPair = typedPair.getStrArrayPair();
if (typedPair.getIsNull()) {
return new StringArrayFieldPair(typedPair.getKey(), null);
} else {
return new StringArrayFieldPair(strArrayPair.getKey(), strArrayPair.getValueList());
return new StringArrayFieldPair(typedPair.getKey(), strArrayPair.getValueList());
}
}
throw new IllegalArgumentException("Unrecognized TypedPair, " + typedPair);
......
......@@ -47,9 +47,8 @@ public abstract class PairQueryCondition {
.setOp(BINARY_OP_EQ)
.setCondition(
Banyandb.TypedPair.newBuilder()
.setIntPair(
Banyandb.IntPair.newBuilder()
.setKey(fieldName)
.setKey(fieldName).setIntPair(
Banyandb.Int.newBuilder()
.setValue(value)))
.build();
}
......
......@@ -19,38 +19,38 @@ syntax = "proto3";
option java_package = "org.apache.skywalking.banyandb.v1.trace";
package banyandb.v1.trace;
package banyandb.trace.v1;
import "google/protobuf/timestamp.proto";
import "google/protobuf/struct.proto";
import "banyandb/v1/banyandb.proto";
service TraceService {
rpc Query(banyandb.v1.trace.QueryRequest) returns (banyandb.v1.trace.QueryResponse);
rpc Write(stream banyandb.v1.trace.WriteRequest) returns (stream banyandb.v1.trace.WriteResponse);
rpc Query(banyandb.trace.v1.QueryRequest) returns (banyandb.trace.v1.QueryResponse);
rpc Write(stream banyandb.trace.v1.WriteRequest) returns (stream banyandb.trace.v1.WriteResponse);
}
// QueryRequest is the request contract for query.
message QueryRequest {
// metadata is required
Metadata metadata = 1;
banyandb.v1.Metadata metadata = 1;
// time_range is a range query with begin/end time of entities in the timeunit of nanoseconds.
// In the context of Trace, it represents the range of the `startTime` for spans/segments,
// while in the context of Log, it means the range of the timestamp(s) for logs.
// it is always recommended to specify time range for performance reason
TimeRange time_range = 2;
banyandb.v1.TimeRange time_range = 2;
// offset is used to support pagination, together with the following limit
uint32 offset = 3;
// limit is used to impose a boundary on the number of records being returned
uint32 limit = 4;
// order_by is given to specify the sort for a field. So far, only fields in the type of Integer are supported
QueryOrder order_by = 5;
banyandb.v1.QueryOrder order_by = 5;
// fields are indexed. Some typical fields are listed below,
// - trace_id: if given, it takes precedence over other fields and will be used to retrieve entities before other conditions are imposed
// - duration: typical for trace context
repeated PairQuery fields = 6;
repeated banyandb.v1.PairQuery fields = 6;
// projection can be used to select the key names of the entities in the response
Projection projection = 7;
banyandb.v1.Projection projection = 7;
}
// QueryResponse is the response for a query to the Query module.
......@@ -77,13 +77,13 @@ message Entity {
// - service_name
// - service_instance_id
// - end_time_nanoseconds
repeated TypedPair fields = 4;
repeated banyandb.v1.TypedPair fields = 4;
}
message WriteRequest {
// the metadata is only required in the first write.
Metadata metadata = 1;
banyandb.v1.Metadata metadata = 1;
// the entity is required.
EntityValue entity = 2;
}
......@@ -103,5 +103,5 @@ message EntityValue {
// Pair only has value, as the value of PairValue match with the key
// by the index rules and index rule bindings of Metadata group.
// indexed fields of multiple entities are compression in the fields.
repeated Field fields = 4;
repeated banyandb.v1.Field fields = 4;
}
\ No newline at end of file
......@@ -32,44 +32,18 @@ message Metadata {
string name = 2;
}
// IntPair in a typed pair with an int64 as values
message IntPair {
string key = 1;
int64 value = 2;
bool isNull = 3;
}
// StrPair in a typed pair with a string as values
message StrPair {
string key = 1;
string value = 2;
bool isNull = 3;
}
// IntPair in a typed pair with an array of int64 as values
message IntArrayPair {
string key = 1;
repeated int64 value = 2;
bool isNull = 3;
}
// StrPair in a typed pair with an array of string as values
message StrArrayPair {
string key = 1;
repeated string value = 2;
bool isNull = 3;
}
// Pair is the building block of a record which is equivalent to a key-value pair.
// In the context of Trace, it could be metadata of a trace such as service_name, service_instance, etc.
// Besides, other fields/tags are organized in key-value pair in the underlying storage layer.
// One should notice that the values can be a multi-value.
message TypedPair {
string key = 1;
bool is_null = 2;
oneof typed {
IntPair int_pair = 1;
StrPair str_pair = 2;
IntArrayPair int_array_pair = 3;
StrArrayPair str_array_pair = 4;
Int int_pair = 3;
Str str_pair = 4;
IntArray int_array_pair = 5;
StrArray str_array_pair = 6;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册