Copilot commented on code in PR #665:
URL: 
https://github.com/apache/skywalking-banyandb/pull/665#discussion_r2082791976


##########
banyand/stream/tag.go:
##########
@@ -68,6 +73,19 @@ func (t *tag) mustWriteTo(tm *tagMetadata, tagWriter 
*writer) {
        }
        tm.offset = tagWriter.bytesWritten
        tagWriter.MustWrite(bb.Buf)
+
+       if t.filter != nil {
+               bb.Reset()
+               var err error
+               bb.Buf, err = encoding.BloomFilterToBytes(t.filter)
+               if err != nil {
+                       logger.Panicf("cannot marshal filter: %v", err)
+               }
+               tm.filterBlock.size = uint64(len(bb.Buf))
+               tm.filterBlock.offset = tagFilterWriter.bytesWritten
+               // TODO: set min/max for tagMetadata

Review Comment:
   Consider implementing the logic to set the min and max values for 
tagMetadata based on the filter data rather than leaving it as a TODO. This 
will ensure that the filter output is fully useful during query execution.
   ```suggestion
                // Calculate and set min/max for tagMetadata
                if len(t.values) > 0 {
                        tm.min, tm.max = t.values[0], t.values[0]
                        for _, value := range t.values {
                                if bytes.Compare(value, tm.min) < 0 {
                                        tm.min = value
                                }
                                if bytes.Compare(value, tm.max) > 0 {
                                        tm.max = value
                                }
                        }
                }
   ```



-- 
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-unsubscr...@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to