Skip to content

Commit

Permalink
add cold.Index
Browse files Browse the repository at this point in the history
  • Loading branch information
gernest committed Feb 9, 2024
1 parent 0c5e37d commit 5f06c00
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions segment/cold/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,20 @@ var skipFields = map[string]struct{}{
camel.Case(v1.Filters_Duration.String()): {},
}

func New(r arrow.Record) (segment.Segment, error) {
type Index struct {
segment.Segment
DiskSize uint64
}

func New(r arrow.Record) (*Index, error) {
document := NewRecord(r, func(r arrow.Record, i int) bool {
_, ok := skipFields[r.ColumnName(i)]
return !ok
})
defer document.Release()
seg, _, err := ice.New([]segment.Document{document}, func(s string, i int) float32 { return 0 })
return seg, err
seg, size, err := ice.New([]segment.Document{document}, func(s string, i int) float32 { return 0 })
if err != nil {
return nil, err
}
return &Index{Segment: seg, DiskSize: size}, nil
}

0 comments on commit 5f06c00

Please sign in to comment.