You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "zesiar0 (via GitHub)" <gi...@apache.org> on 2024/01/27 12:28:51 UTC
[PR] feat: remove entity info from ".tf"&".tfm" file [skywalking-banyandb]
zesiar0 opened a new pull request, #384:
URL: https://github.com/apache/skywalking-banyandb/pull/384
- [x] remove entity from ".tf"&".tfm" file, and find entity in series index
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: remove entity info from ".tf"&".tfm" file [skywalking-banyandb]
Posted by "hanahmily (via GitHub)" <gi...@apache.org>.
hanahmily commented on code in PR #384:
URL: https://github.com/apache/skywalking-banyandb/pull/384#discussion_r1471221702
##########
banyand/measure/query.go:
##########
@@ -128,6 +140,28 @@ func (s *measure) Query(ctx context.Context, mqo pbv1.MeasureQueryOptions) (pbv1
if tstIter.Error() != nil {
return nil, fmt.Errorf("cannot iterate tstIter: %w", tstIter.Error())
}
+
+ entities := make([]string, 0)
+ if s.GetSchema().GetTagFamilies()[0].GetName() == topNTagFamily {
+ for _, topNAggregation := range s.topNAggregations {
+ if topNAggregation.GetMetadata().GetName() == s.schema.GetMetadata().GetName() {
+ entities = append(entities, "sortDirection", "rankNumber")
Review Comment:
The entity used to define the topN result measure lacks tags, causing a mismatch between writing and reading. https://github.com/apache/skywalking-banyandb/blob/main/banyand/measure/metadata.go#L214 is relevant.
Please correct this issue, please prepend "sortDirection" and "rankNumber" to the above Entity field.
##########
banyand/measure/query.go:
##########
@@ -141,13 +175,59 @@ func (s *measure) Query(ctx context.Context, mqo pbv1.MeasureQueryOptions) (pbv1
return &result, nil
}
- result.sidToIndex = make(map[common.SeriesID]int)
- for i, si := range originalSids {
- result.sidToIndex[si] = i
- }
return &result, nil
}
+func mustEncodeTagValue(tagType databasev1.TagType, tagValue *modelv1.TagValue, num int) [][]byte {
+ values := make([][]byte, 0)
+ switch tagType {
+ case databasev1.TagType_TAG_TYPE_INT:
+ if tagValue.GetInt() != nil {
+ for i := 0; i < num; i++ {
+ values = append(values, convert.Int64ToBytes(tagValue.GetInt().GetValue()))
+ }
+ }
+ case databasev1.TagType_TAG_TYPE_STRING:
+ if tagValue.GetStr() != nil {
+ for i := 0; i < num; i++ {
+ values = append(values, []byte(tagValue.GetStr().GetValue()))
+ }
+ }
+ case databasev1.TagType_TAG_TYPE_DATA_BINARY:
+ if tagValue.GetBinaryData() != nil {
+ for i := 0; i < num; i++ {
+ values = append(values, bytes.Clone(tagValue.GetBinaryData()))
+ }
+ }
+ case databasev1.TagType_TAG_TYPE_INT_ARRAY:
+ if tagValue.GetIntArray() == nil {
+ return values
+ }
+ for i := 0; i < num; i++ {
+ value := make([]byte, 0)
+ for j := range tagValue.GetIntArray().Value {
+ value = append(value, byte(128))
+ value = append(value, convert.Int64ToBytes(tagValue.GetIntArray().Value[j])...)
+ }
+ values = append(values, value)
+ }
+ case databasev1.TagType_TAG_TYPE_STRING_ARRAY:
+ if tagValue.GetStrArray() == nil {
+ return values
+ }
+ for i := 0; i < num; i++ {
+ var value string
+ for j := range tagValue.GetStrArray().Value {
Review Comment:
The encoding method is incorrect.
According to `block.mustInitFromTagsAndFields`, the encoding process should contain two steps:
1. Convert `tagValue` to `nameValue` using `encodeTagValue` laid in `write.go`
2. `nameValue.marshal` could serialize the value to a byte slice.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: remove entity info from ".tf"&".tfm" file [skywalking-banyandb]
Posted by "hanahmily (via GitHub)" <gi...@apache.org>.
hanahmily merged PR #384:
URL: https://github.com/apache/skywalking-banyandb/pull/384
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org