...
Code Block |
---|
// based on result.Offset, get vector raw data from fieldInfo, // then fill vector raw data into result func (s *Segment) fillRetrieveResults(result *segcorepb.RetrieveResults, fieldInfo *VectorFieldInfo) error |
```go
// fill vector raw data into RetrieveResults
func (s *Segment) fillRetrieveResults(plan *RetrievePlan, result *segcorepb.RetrieveResults) error
// 1. load vector field binlog file from minio
// 2. decode binlog file, get vector raw data
// 3. save raw data into local disk
// 4. do mmap
func (s *Segment) segmentVectorFieldDataMmap(fieldID int64, binlog string, rowCount int, data interface{}) ([]byte, error)
```
- Add new interface in segmentLoader segment_loader
Code Block |
---|
// load vector field's data from info.fieldBinlog, save the raw data into info.rawData func (loader *segmentLoader) loadSegmentVectorFieldsData(info *VectorFieldInfo) error { |
4. 在 retrieve 函数中添加如下逻辑
* 当输出列包含向量列、向量列未加载、且当前 segment 返回值不为空时
```go
if err = q.historical.loader.loadSegmentVectorFieldsData(segment, binlogs); err != nil {
return err
}
if err = segment.fillRetrieveResults(plan, result); err != nil {
return err
}
```
...
- Add new interface in query_collection
Code Block |
---|
// load vector fields' data, and fill in result, if
// 1). result is not empty
// 2). output field contain vector
// 3). vector field has not been loaded into memory
func (q *queryCollection) fillVectorOutputFieldsIfNeeded(msg queryMsg, segment *Segment, result *segcorepb.RetrieveResults) error |
Original vector data storage public interface and struct
...