Skip to content

Commit

Permalink
Merge branch 'main' into speed-up-traverse
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmo314 authored Feb 11, 2024
2 parents f7bdb0c + f7fdcae commit c12a974
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pkg/appendable/index_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func (i *IndexFile) IsEmpty() (bool, error) {
}

func (i *IndexFile) IndexFieldNames() ([]string, error) {
var fieldNames []string
uniqueFieldNames := make(map[string]bool)

mp := i.tree
Expand All @@ -118,15 +119,13 @@ func (i *IndexFile) IndexFieldNames() ([]string, error) {
return nil, fmt.Errorf("failed to unmarshal metadata: %w", err)
}

uniqueFieldNames[metadata.FieldName] = true
if _, ok := uniqueFieldNames[metadata.FieldName]; !ok {
uniqueFieldNames[metadata.FieldName] = true
fieldNames = append(fieldNames, metadata.FieldName)
}
mp = next
}

var fieldNames []string
for fieldName := range uniqueFieldNames {
fieldNames = append(fieldNames, fieldName)
}

return fieldNames, nil
}

Expand Down

0 comments on commit c12a974

Please sign in to comment.