mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
enable roaring import for time fields; build view name
This commit is contained in:
parent
1642e22872
commit
2bab6eb5ec
1 changed files with 10 additions and 4 deletions
14
api.go
14
api.go
|
|
@ -280,11 +280,12 @@ func (api *API) ImportRoaring(ctx context.Context, indexName, fieldName string,
|
|||
return newNotFoundError(ErrFieldNotFound)
|
||||
}
|
||||
|
||||
// only set fields are supported
|
||||
if field.Type() != FieldTypeSet {
|
||||
return NewBadRequestError(errors.New("roaring import is only supported for set fields"))
|
||||
// only set and time fields are supported
|
||||
if field.Type() != FieldTypeSet && field.Type() != FieldTypeTime {
|
||||
return NewBadRequestError(errors.New("roaring import is only supported for set and time fields"))
|
||||
}
|
||||
|
||||
var viewName string
|
||||
for _, node := range nodes {
|
||||
node := node
|
||||
if node.ID == api.server.nodeID {
|
||||
|
|
@ -295,7 +296,12 @@ func (api *API) ImportRoaring(ctx context.Context, indexName, fieldName string,
|
|||
// field.importRoaring changes data
|
||||
data := make([]byte, len(view.Data))
|
||||
copy(data, view.Data)
|
||||
err = field.importRoaring(data, shard, view.Name, req.Clear)
|
||||
if view.Name == "" {
|
||||
viewName = viewStandard
|
||||
} else {
|
||||
viewName = fmt.Sprintf("%s_%s", viewStandard, view.Name)
|
||||
}
|
||||
err = field.importRoaring(data, shard, viewName, req.Clear)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue