Merge pull request #1355 from travisturner/rename-field

Remove instances of Field
This commit is contained in:
Travis Turner 2018-06-05 09:31:05 -05:00 • committed by GitHub
commit 127d7a7298
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 446 additions and 446 deletions

29
api.go
View file

@ -489,7 +489,7 @@ func (api *API) Schema(ctx context.Context) []*IndexInfo {
}
// CreateField creates a new BSI field in the given index and frame.
func (api *API) CreateField(ctx context.Context, indexName string, frameName string, field *oField) error {
func (api *API) CreateField(ctx context.Context, indexName string, frameName string, bsig *bsiGroup) error {
if err := api.validate(apiCreateField); err != nil {
return errors.Wrap(err, "validating api method")
}
@ -500,17 +500,17 @@ func (api *API) CreateField(ctx context.Context, indexName string, frameName str
return ErrFrameNotFound
}
// Create new field.
if err := f.CreateField(field); err != nil {
return errors.Wrap(err, "creating field")
// Create new bsiGroup.
if err := f.createBSIGroup(bsig); err != nil {
return errors.Wrap(err, "creating bsigroup")
}
// Send the create field message to all nodes.
// Send the create bsigroup message to all nodes.
err := api.Broadcaster.SendSync(
&internal.CreateFieldMessage{
Index: indexName,
Frame: frameName,
Field: encodeField(field),
&internal.CreateBSIGroupMessage{
Index: indexName,
Frame: frameName,
BSIGroup: encodeBSIGroup(bsig),
})
if err != nil {
api.Logger.Printf("problem sending CreateField message: %s", err)
@ -518,6 +518,7 @@ func (api *API) CreateField(ctx context.Context, indexName string, frameName str
return errors.Wrap(err, "sending CreateField message")
}
// TODO: remove this from the API
// DeleteField deletes the given field.
func (api *API) DeleteField(ctx context.Context, indexName string, frameName string, fieldName string) error {
if err := api.validate(apiDeleteField); err != nil {
@ -531,16 +532,16 @@ func (api *API) DeleteField(ctx context.Context, indexName string, frameName str
}
// Delete field.
if err := f.DeleteField(fieldName); err != nil {
if err := f.deleteBSIGroupAndView(fieldName); err != nil {
return errors.Wrap(err, "deleting field")
}
// Send the delete field message to all nodes.
err := api.Broadcaster.SendSync(
&internal.DeleteFieldMessage{
Index: indexName,
Frame: frameName,
Field: fieldName,
&internal.DeleteBSIGroupMessage{
Index: indexName,
Frame: frameName,
BSIGroup: fieldName,
})
if err != nil {
api.Logger.Printf("problem sending DeleteField message: %s", err)

View file

@ -127,8 +127,8 @@ const (
MessageTypeDeleteFrame
MessageTypeCreateView
MessageTypeDeleteView
MessageTypeCreateField
MessageTypeDeleteField
MessageTypeCreateBSIGroup
MessageTypeDeleteBSIGroup
MessageTypeClusterStatus
MessageTypeResizeInstruction
MessageTypeResizeInstructionComplete
@ -157,10 +157,10 @@ func MarshalMessage(m proto.Message) ([]byte, error) {
typ = MessageTypeCreateView
case *internal.DeleteViewMessage:
typ = MessageTypeDeleteView
case *internal.CreateFieldMessage:
typ = MessageTypeCreateField
case *internal.DeleteFieldMessage:
typ = MessageTypeDeleteField
case *internal.CreateBSIGroupMessage:
typ = MessageTypeCreateBSIGroup
case *internal.DeleteBSIGroupMessage:
typ = MessageTypeDeleteBSIGroup
case *internal.ClusterStatus:
typ = MessageTypeClusterStatus
case *internal.ResizeInstruction:
@ -207,10 +207,10 @@ func UnmarshalMessage(buf []byte) (proto.Message, error) {
m = &internal.CreateViewMessage{}
case MessageTypeDeleteView:
m = &internal.DeleteViewMessage{}
case MessageTypeCreateField:
m = &internal.CreateFieldMessage{}
case MessageTypeDeleteField:
m = &internal.DeleteFieldMessage{}
case MessageTypeCreateBSIGroup:
m = &internal.CreateBSIGroupMessage{}
case MessageTypeDeleteBSIGroup:
m = &internal.DeleteBSIGroupMessage{}
case MessageTypeClusterStatus:
m = &internal.ClusterStatus{}
case MessageTypeResizeInstruction:

View file

@ -276,7 +276,7 @@ func TestClient_ImportValue(t *testing.T) {
}
// Verify Sum.
sum, cnt, err := frame.FieldSum(nil, fldName)
sum, cnt, err := frame.Sum(nil, fldName)
if err != nil {
t.Fatal(err)
}
@ -285,7 +285,7 @@ func TestClient_ImportValue(t *testing.T) {
}
// Verify Min.
min, cnt, err := frame.FieldMin(nil, fldName)
min, cnt, err := frame.Min(nil, fldName)
if err != nil {
t.Fatal(err)
}
@ -294,11 +294,11 @@ func TestClient_ImportValue(t *testing.T) {
}
// Verify Min with Filter.
filter, err := frame.FieldRange(fldName, pql.GT, 40)
filter, err := frame.Range(fldName, pql.GT, 40)
if err != nil {
t.Fatal(err)
}
min, cnt, err = frame.FieldMin(filter, fldName)
min, cnt, err = frame.Min(filter, fldName)
if err != nil {
t.Fatal(err)
}
@ -307,7 +307,7 @@ func TestClient_ImportValue(t *testing.T) {
}
// Verify Max.
max, cnt, err := frame.FieldMax(nil, fldName)
max, cnt, err := frame.Max(nil, fldName)
if err != nil {
t.Fatal(err)
}

View file

@ -381,12 +381,12 @@ func (e *Executor) executeSumCountSlice(ctx context.Context, index string, c *pq
return ValCount{}, nil
}
field := frame.Field(fieldName)
field := frame.bsiGroup(fieldName)
if field == nil {
return ValCount{}, nil
}
fragment := e.Holder.Fragment(index, frameName, ViewFieldPrefix+fieldName, slice)
fragment := e.Holder.Fragment(index, frameName, viewBSIGroupPrefix+fieldName, slice)
if fragment == nil {
return ValCount{}, nil
}
@ -420,12 +420,12 @@ func (e *Executor) executeFieldMinSlice(ctx context.Context, index string, c *pq
return ValCount{}, nil
}
field := frame.Field(fieldName)
field := frame.bsiGroup(fieldName)
if field == nil {
return ValCount{}, nil
}
fragment := e.Holder.Fragment(index, frameName, ViewFieldPrefix+fieldName, slice)
fragment := e.Holder.Fragment(index, frameName, viewBSIGroupPrefix+fieldName, slice)
if fragment == nil {
return ValCount{}, nil
}
@ -459,12 +459,12 @@ func (e *Executor) executeFieldMaxSlice(ctx context.Context, index string, c *pq
return ValCount{}, nil
}
field := frame.Field(fieldName)
field := frame.bsiGroup(fieldName)
if field == nil {
return ValCount{}, nil
}
fragment := e.Holder.Fragment(index, frameName, ViewFieldPrefix+fieldName, slice)
fragment := e.Holder.Fragment(index, frameName, viewBSIGroupPrefix+fieldName, slice)
if fragment == nil {
return ValCount{}, nil
}
@ -800,13 +800,13 @@ func (e *Executor) executeFieldRangeSlice(ctx context.Context, index string, c *
// Handle `!= null`.
if cond.Op == pql.NEQ && cond.Value == nil {
// Find field.
field := f.Field(fieldName)
field := f.bsiGroup(fieldName)
if field == nil {
return nil, ErrFieldNotFound
return nil, ErrBSIGroupNotFound
}
// Retrieve fragment.
frag := e.Holder.Fragment(index, frame, ViewFieldPrefix+fieldName, slice)
frag := e.Holder.Fragment(index, frame, viewBSIGroupPrefix+fieldName, slice)
if frag == nil {
return NewRow(), nil
}
@ -830,18 +830,18 @@ func (e *Executor) executeFieldRangeSlice(ctx context.Context, index string, c *
// here is because we need the call to be slice-specific.
// Find field.
field := f.Field(fieldName)
field := f.bsiGroup(fieldName)
if field == nil {
return nil, ErrFieldNotFound
return nil, ErrBSIGroupNotFound
}
baseValueMin, baseValueMax, outOfRange := field.BaseValueBetween(predicates[0], predicates[1])
baseValueMin, baseValueMax, outOfRange := field.baseValueBetween(predicates[0], predicates[1])
if outOfRange {
return NewRow(), nil
}
// Retrieve fragment.
frag := e.Holder.Fragment(index, frame, ViewFieldPrefix+fieldName, slice)
frag := e.Holder.Fragment(index, frame, viewBSIGroupPrefix+fieldName, slice)
if frag == nil {
return NewRow(), nil
}
@ -863,18 +863,18 @@ func (e *Executor) executeFieldRangeSlice(ctx context.Context, index string, c *
}
// Find field.
field := f.Field(fieldName)
field := f.bsiGroup(fieldName)
if field == nil {
return nil, ErrFieldNotFound
return nil, ErrBSIGroupNotFound
}
baseValue, outOfRange := field.BaseValue(cond.Op, value)
baseValue, outOfRange := field.baseValue(cond.Op, value)
if outOfRange && cond.Op != pql.NEQ {
return NewRow(), nil
}
// Retrieve fragment.
frag := e.Holder.Fragment(index, frame, ViewFieldPrefix+fieldName, slice)
frag := e.Holder.Fragment(index, frame, viewBSIGroupPrefix+fieldName, slice)
if frag == nil {
return NewRow(), nil
}
@ -1137,7 +1137,7 @@ func (e *Executor) executeSetValue(ctx context.Context, index string, c *pql.Cal
return err
}
default:
return ErrInvalidFieldValueType
return ErrInvalidBSIGroupValueType
}
frame.Stats.Count("SetValue", 1, 1.0)
}

View file

@ -290,7 +290,7 @@ func TestExecutor_Execute_SetValue(t *testing.T) {
}
f := hldr.Frame("i", "f")
if value, exists, err := f.FieldValue(10, "f"); err != nil {
if value, exists, err := f.Value(10, "f"); err != nil {
t.Fatal(err)
} else if !exists {
t.Fatal("expected value to exist")
@ -298,7 +298,7 @@ func TestExecutor_Execute_SetValue(t *testing.T) {
t.Fatalf("unexpected value: %v", value)
}
if value, exists, err := f.FieldValue(100, "f"); err != nil {
if value, exists, err := f.Value(100, "f"); err != nil {
t.Fatal(err)
} else if !exists {
t.Fatal("expected value to exist")
@ -335,7 +335,7 @@ func TestExecutor_Execute_SetValue(t *testing.T) {
t.Run("ErrInvalidFieldValueType", func(t *testing.T) {
e := test.NewExecutor(hldr.Holder, test.NewCluster(1))
if _, err := e.Execute(context.Background(), "i", test.MustParse(`SetValue(col=10, f="hello")`), nil, nil); err == nil || err.Error() != `invalid field value type` {
if _, err := e.Execute(context.Background(), "i", test.MustParse(`SetValue(col=10, f="hello")`), nil, nil); err == nil || err != pilosa.ErrInvalidBSIGroupValueType {
t.Fatalf("unexpected error: %s", err)
}
})
@ -951,7 +951,7 @@ func TestExecutor_Execute_FieldRange(t *testing.T) {
})
t.Run("ErrFieldNotFound", func(t *testing.T) {
if _, err := e.Execute(context.Background(), "i", test.MustParse(`Range(frame=foo, bad_field >= 20)`), nil, nil); err != pilosa.ErrFieldNotFound {
if _, err := e.Execute(context.Background(), "i", test.MustParse(`Range(frame=foo, bad_field >= 20)`), nil, nil); err != pilosa.ErrBSIGroupNotFound {
t.Fatal(err)
}
})

298
frame.go
View file

@ -64,7 +64,7 @@ type Frame struct {
// Frame options.
options FrameOptions
fields []*oField
bsiGroups []*bsiGroup
Logger Logger
}
@ -325,19 +325,19 @@ func (f *Frame) applyOptions(opt FrameOptions) error {
f.options.Max = opt.Max
f.options.TimeQuantum = ""
// Create new field.
field := &oField{
// Create new bsiGroup.
bsig := &bsiGroup{
Name: f.name,
Type: FieldTypeInt,
Type: bsiGroupTypeInt,
Min: opt.Min,
Max: opt.Max,
}
// Validate field.
if err := ValidateField(field); err != nil {
// Validate bsiGroup.
if err := bsig.validate(); err != nil {
return err
}
if err := f.CreateField(field); err != nil {
return errors.Wrap(err, "creating field")
if err := f.createBSIGroup(bsig); err != nil {
return errors.Wrap(err, "creating bsigroup")
}
case FrameTypeTime:
f.options.Type = opt.Type
@ -378,72 +378,73 @@ func (f *Frame) Close() error {
return nil
}
// Field returns a field by name.
func (f *Frame) Field(name string) *oField {
// bsiGroup returns a bsiGroup by name.
func (f *Frame) bsiGroup(name string) *bsiGroup {
f.mu.RLock()
defer f.mu.RUnlock()
for _, field := range f.fields {
if field.Name == name {
return field
for _, bsig := range f.bsiGroups {
if bsig.Name == name {
return bsig
}
}
return nil
}
// hasField returns true if a field exists on the frame.
func (f *Frame) hasField(name string) bool {
for _, fld := range f.fields {
if fld.Name == name {
// hasBSIGroup returns true if a bsiGroup exists on the frame.
func (f *Frame) hasBSIGroup(name string) bool {
for _, bsig := range f.bsiGroups {
if bsig.Name == name {
return true
}
}
return false
}
// CreateField creates a new field on the frame.
func (f *Frame) CreateField(field *oField) error {
// createBSIGroup creates a new bsiGroup on the frame.
func (f *Frame) createBSIGroup(bsig *bsiGroup) error {
f.mu.Lock()
defer f.mu.Unlock()
// Append field.
if err := f.addField(field); err != nil {
// Append bsiGroup.
if err := f.addBSIGroup(bsig); err != nil {
return err
}
f.saveMeta()
return nil
}
// addField adds a single field to fields.
func (f *Frame) addField(field *oField) error {
if err := ValidateField(field); err != nil {
return errors.Wrap(err, "validating field")
} else if f.hasField(field.Name) {
return ErrFieldExists
// addBSIGroup adds a single bsiGroup to bsiGroups.
func (f *Frame) addBSIGroup(bsig *bsiGroup) error {
if err := bsig.validate(); err != nil {
return errors.Wrap(err, "validating bsigroup")
} else if f.hasBSIGroup(bsig.Name) {
return ErrBSIGroupExists
}
// Add field to list.
f.fields = append(f.fields, field)
// Add bsiGroup to list.
f.bsiGroups = append(f.bsiGroups, bsig)
// Sort fields by name.
sort.Slice(f.fields, func(i, j int) bool {
return f.fields[i].Name < f.fields[j].Name
sort.Slice(f.bsiGroups, func(i, j int) bool {
return f.bsiGroups[i].Name < f.bsiGroups[j].Name
})
return nil
}
// DeleteField deletes an existing field on the schema.
func (f *Frame) DeleteField(name string) error {
// TODO: merge this into the un-exported deleteBSIGroup.
// deleteBSIGroupAndView deletes an existing field on the schema.
func (f *Frame) deleteBSIGroupAndView(name string) error {
f.mu.Lock()
defer f.mu.Unlock()
// Remove field.
if err := f.deleteField(name); err != nil {
if err := f.deleteBSIGroup(name); err != nil {
return err
}
// Remove views.
viewName := ViewFieldPrefix + name
viewName := viewBSIGroupPrefix + name
if view := f.views[viewName]; view != nil {
delete(f.views, viewName)
@ -457,16 +458,16 @@ func (f *Frame) DeleteField(name string) error {
return nil
}
// deleteField removes a single field from fields.
func (f *Frame) deleteField(name string) error {
for i, field := range f.fields {
if field.Name == name {
copy(f.fields[i:], f.fields[i+1:])
f.fields, f.fields[len(f.fields)-1] = f.fields[:len(f.fields)-1], nil
// deleteBSIGroup removes a single bsiGroup from bsiGroups.
func (f *Frame) deleteBSIGroup(name string) error {
for i, bsig := range f.bsiGroups {
if bsig.Name == name {
copy(f.bsiGroups[i:], f.bsiGroups[i+1:])
f.bsiGroups, f.bsiGroups[len(f.bsiGroups)-1] = f.bsiGroups[:len(f.bsiGroups)-1], nil
return nil
}
}
return ErrFieldNotFound
return ErrBSIGroupNotFound
}
// TimeQuantum returns the time quantum for the frame.
@ -704,20 +705,20 @@ func (f *Frame) ClearBit(name string, rowID, colID uint64, t *time.Time) (change
return changed, nil
}
// FieldValue reads a field value for a column.
func (f *Frame) FieldValue(columnID uint64, name string) (value int64, exists bool, err error) {
field := f.Field(name)
// Value reads a bsiGroup value for a column.
func (f *Frame) Value(columnID uint64, name string) (value int64, exists bool, err error) {
field := f.bsiGroup(name)
if field == nil {
return 0, false, ErrFieldNotFound
return 0, false, ErrBSIGroupNotFound
}
// Fetch target view.
view := f.View(ViewFieldPrefix + name)
view := f.View(viewBSIGroupPrefix + name)
if view == nil {
return 0, false, nil
}
v, exists, err := view.FieldValue(columnID, field.BitDepth())
v, exists, err := view.value(columnID, field.BitDepth())
if err != nil {
return 0, false, err
} else if !exists {
@ -729,17 +730,17 @@ func (f *Frame) FieldValue(columnID uint64, name string) (value int64, exists bo
// SetValue sets a field value for a column.
func (f *Frame) SetValue(columnID uint64, value int64) (changed bool, err error) {
// Fetch field and validate value.
field := f.Field(f.name)
field := f.bsiGroup(f.name)
if field == nil {
return false, ErrFieldNotFound
return false, ErrBSIGroupNotFound
} else if value < field.Min {
return false, ErrFieldValueTooLow
return false, ErrBSIGroupValueTooLow
} else if value > field.Max {
return false, ErrFieldValueTooHigh
return false, ErrBSIGroupValueTooHigh
}
// Fetch target view.
view, err := f.CreateViewIfNotExists(ViewFieldPrefix + f.name)
view, err := f.CreateViewIfNotExists(viewBSIGroupPrefix + f.name)
if err != nil {
return false, errors.Wrap(err, "creating view")
}
@ -750,110 +751,110 @@ func (f *Frame) SetValue(columnID uint64, value int64) (changed bool, err error)
return view.setValue(columnID, field.BitDepth(), baseValue)
}
// FieldSum returns the sum and count for a field.
// Sum returns the sum and count for a field.
// An optional filtering row can be provided.
func (f *Frame) FieldSum(filter *Row, name string) (sum, count int64, err error) {
field := f.Field(name)
func (f *Frame) Sum(filter *Row, name string) (sum, count int64, err error) {
field := f.bsiGroup(name)
if field == nil {
return 0, 0, ErrFieldNotFound
return 0, 0, ErrBSIGroupNotFound
}
view := f.View(ViewFieldPrefix + name)
view := f.View(viewBSIGroupPrefix + name)
if view == nil {
return 0, 0, nil
}
vsum, vcount, err := view.FieldSum(filter, field.BitDepth())
vsum, vcount, err := view.sum(filter, field.BitDepth())
if err != nil {
return 0, 0, err
}
return int64(vsum) + (int64(vcount) * field.Min), int64(vcount), nil
}
// FieldMin returns the min for a field.
// Min returns the min for a field.
// An optional filtering row can be provided.
func (f *Frame) FieldMin(filter *Row, name string) (min, count int64, err error) {
field := f.Field(name)
if field == nil {
return 0, 0, ErrFieldNotFound
func (f *Frame) Min(filter *Row, name string) (min, count int64, err error) {
bsig := f.bsiGroup(name)
if bsig == nil {
return 0, 0, ErrBSIGroupNotFound
}
view := f.View(ViewFieldPrefix + name)
view := f.View(viewBSIGroupPrefix + name)
if view == nil {
return 0, 0, nil
}
vmin, vcount, err := view.FieldMin(filter, field.BitDepth())
vmin, vcount, err := view.min(filter, bsig.BitDepth())
if err != nil {
return 0, 0, err
}
return int64(vmin) + field.Min, int64(vcount), nil
return int64(vmin) + bsig.Min, int64(vcount), nil
}
// FieldMax returns the max for a field.
// Max returns the max for a field.
// An optional filtering row can be provided.
func (f *Frame) FieldMax(filter *Row, name string) (max, count int64, err error) {
field := f.Field(name)
func (f *Frame) Max(filter *Row, name string) (max, count int64, err error) {
field := f.bsiGroup(name)
if field == nil {
return 0, 0, ErrFieldNotFound
return 0, 0, ErrBSIGroupNotFound
}
view := f.View(ViewFieldPrefix + name)
view := f.View(viewBSIGroupPrefix + name)
if view == nil {
return 0, 0, nil
}
vmax, vcount, err := view.FieldMax(filter, field.BitDepth())
vmax, vcount, err := view.max(filter, field.BitDepth())
if err != nil {
return 0, 0, err
}
return int64(vmax) + field.Min, int64(vcount), nil
}
func (f *Frame) FieldRange(name string, op pql.Token, predicate int64) (*Row, error) {
func (f *Frame) Range(name string, op pql.Token, predicate int64) (*Row, error) {
// Retrieve and validate field.
field := f.Field(name)
field := f.bsiGroup(name)
if field == nil {
return nil, ErrFieldNotFound
return nil, ErrBSIGroupNotFound
} else if predicate < field.Min || predicate > field.Max {
return nil, nil
}
// Retrieve field's view.
view := f.View(ViewFieldPrefix + name)
view := f.View(viewBSIGroupPrefix + name)
if view == nil {
return nil, nil
}
baseValue, outOfRange := field.BaseValue(op, predicate)
baseValue, outOfRange := field.baseValue(op, predicate)
if outOfRange {
return NewRow(), nil
}
return view.FieldRange(op, field.BitDepth(), baseValue)
return view.rangeOp(op, field.BitDepth(), baseValue)
}
func (f *Frame) FieldRangeBetween(name string, predicateMin, predicateMax int64) (*Row, error) {
func (f *Frame) RangeBetween(name string, predicateMin, predicateMax int64) (*Row, error) {
// Retrieve and validate field.
field := f.Field(name)
field := f.bsiGroup(name)
if field == nil {
return nil, ErrFieldNotFound
return nil, ErrBSIGroupNotFound
} else if predicateMin > predicateMax {
return nil, ErrInvalidBetweenValue
}
// Retrieve field's view.
view := f.View(ViewFieldPrefix + name)
view := f.View(viewBSIGroupPrefix + name)
if view == nil {
return nil, nil
}
baseValueMin, baseValueMax, outOfRange := field.BaseValueBetween(predicateMin, predicateMax)
baseValueMin, baseValueMax, outOfRange := field.baseValueBetween(predicateMin, predicateMax)
if outOfRange {
return NewRow(), nil
}
return view.FieldRangeBetween(field.BitDepth(), baseValueMin, baseValueMax)
return view.rangeBetween(field.BitDepth(), baseValueMin, baseValueMax)
}
// Import bulk imports data.
@ -915,24 +916,24 @@ func (f *Frame) Import(rowIDs, columnIDs []uint64, timestamps []*time.Time) erro
// ImportValue bulk imports range-encoded value data.
func (f *Frame) ImportValue(fieldName string, columnIDs []uint64, values []int64) error {
viewName := ViewFieldPrefix + fieldName
// Get the field so we know bitDepth.
field := f.Field(fieldName)
if field == nil {
return fmt.Errorf("Field does not exist: %s", fieldName)
viewName := viewBSIGroupPrefix + fieldName
// Get the bsiGroup so we know bitDepth.
bsig := f.bsiGroup(fieldName)
if bsig == nil {
return errors.Wrap(ErrBSIGroupNotFound, fieldName)
}
// Split import data by fragment.
dataByFragment := make(map[importKey]importValueData)
for i := range columnIDs {
columnID, value := columnIDs[i], values[i]
if int64(value) > field.Max {
return fmt.Errorf("%v, columnID=%v, value=%v", ErrFieldValueTooHigh, columnID, value)
} else if int64(value) < field.Min {
return fmt.Errorf("%v, columnID=%v, value=%v", ErrFieldValueTooLow, columnID, value)
if int64(value) > bsig.Max {
return fmt.Errorf("%v, columnID=%v, value=%v", ErrBSIGroupValueTooHigh, columnID, value)
} else if int64(value) < bsig.Min {
return fmt.Errorf("%v, columnID=%v, value=%v", ErrBSIGroupValueTooLow, columnID, value)
}
// Attach value to each field view.
// Attach value to each bsiGroup view.
for _, name := range []string{viewName} {
key := importKey{View: name, Slice: columnID / SliceWidth}
data := dataByFragment[key]
@ -959,10 +960,10 @@ func (f *Frame) ImportValue(fieldName string, columnIDs []uint64, values []int64
baseValues := make([]uint64, len(data.Values))
for i, value := range data.Values {
baseValues[i] = uint64(value - field.Min)
baseValues[i] = uint64(value - bsig.Min)
}
if err := frag.ImportValue(data.ColumnIDs, baseValues, field.BitDepth()); err != nil {
if err := frag.ImportValue(data.ColumnIDs, baseValues, bsig.BitDepth()); err != nil {
return err
}
}
@ -1025,7 +1026,7 @@ func (o *FrameOptions) Validate() error {
// TODO: cacheType, cacheSize validation
case FrameTypeInt:
if o.Min > o.Max {
return ErrInvalidFieldRange
return ErrInvalidBSIGroupRange
}
case FrameTypeTime:
if o.TimeQuantum == "" || !o.TimeQuantum.Valid() {
@ -1070,23 +1071,22 @@ func decodeFrameOptions(options *internal.FrameMeta) *FrameOptions {
}
}
// List of field data types.
// List of bsiGroup types.
const (
FieldTypeInt = "int"
bsiGroupTypeInt = "int"
)
func IsValidFieldType(v string) bool {
func isValidBSIGroupType(v string) bool {
switch v {
case FieldTypeInt:
case bsiGroupTypeInt:
return true
default:
return false
}
}
// TODO: finish unexporting this. also, rename it.
// oField represents a range field on a frame.
type oField struct {
// bsiGroup represents a range field on a frame.
type bsiGroup struct {
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Min int64 `json:"min,omitempty"`
@ -1094,101 +1094,101 @@ type oField struct {
}
// BitDepth returns the number of bits required to store a value between min & max.
func (f *oField) BitDepth() uint {
func (b *bsiGroup) BitDepth() uint {
for i := uint(0); i < 63; i++ {
if f.Max-f.Min < (1 << i) {
if b.Max-b.Min < (1 << i) {
return i
}
}
return 63
}
// BaseValue adjusts the value to align with the range for Field for a certain
// baseValue adjusts the value to align with the range for Field for a certain
// operation type.
// Note: There is an edge case for GT and LT where this returns a baseValue
// that does not fully encompass the range.
// ex: Field.Min = 0, Field.Max = 1023
// BaseValue(LT, 2000) returns 1023, which will perform "LT 1023" and effectively
// baseValue(LT, 2000) returns 1023, which will perform "LT 1023" and effectively
// exclude any columns with value = 1023.
// Note that in this case (because the range uses the full BitDepth 0 to 1023),
// we can't simply return 1024.
// In order to make this work, we effectively need to change the operator to LTE.
// Executor.executeFieldRangeSlice() takes this into account and returns
// `frag.FieldNotNull(field.BitDepth())` in such instances.
func (f *oField) BaseValue(op pql.Token, value int64) (baseValue uint64, outOfRange bool) {
func (b *bsiGroup) baseValue(op pql.Token, value int64) (baseValue uint64, outOfRange bool) {
if op == pql.GT || op == pql.GTE {
if value > f.Max {
if value > b.Max {
return baseValue, true
} else if value > f.Min {
baseValue = uint64(value - f.Min)
} else if value > b.Min {
baseValue = uint64(value - b.Min)
}
} else if op == pql.LT || op == pql.LTE {
if value < f.Min {
if value < b.Min {
return baseValue, true
} else if value > f.Max {
baseValue = uint64(f.Max - f.Min)
} else if value > b.Max {
baseValue = uint64(b.Max - b.Min)
} else {
baseValue = uint64(value - f.Min)
baseValue = uint64(value - b.Min)
}
} else if op == pql.EQ || op == pql.NEQ {
if value < f.Min || value > f.Max {
if value < b.Min || value > b.Max {
return baseValue, true
}
baseValue = uint64(value - f.Min)
baseValue = uint64(value - b.Min)
}
return baseValue, false
}
// BaseValueBetween adjusts the min/max value to align with the range for Field.
func (f *oField) BaseValueBetween(min, max int64) (baseValueMin, baseValueMax uint64, outOfRange bool) {
if max < f.Min || min > f.Max {
// baseValueBetween adjusts the min/max value to align with the range for Field.
func (b *bsiGroup) baseValueBetween(min, max int64) (baseValueMin, baseValueMax uint64, outOfRange bool) {
if max < b.Min || min > b.Max {
return baseValueMin, baseValueMax, true
}
// Adjust min/max to range.
if min > f.Min {
baseValueMin = uint64(min - f.Min)
if min > b.Min {
baseValueMin = uint64(min - b.Min)
}
// Make sure the high value of the BETWEEN does not exceed BitDepth.
if max > f.Max {
baseValueMax = uint64(f.Max - f.Min)
} else if max > f.Min {
baseValueMax = uint64(max - f.Min)
if max > b.Max {
baseValueMax = uint64(b.Max - b.Min)
} else if max > b.Min {
baseValueMax = uint64(max - b.Min)
}
return baseValueMin, baseValueMax, false
}
func ValidateField(f *oField) error {
if f.Name == "" {
return ErrFieldNameRequired
} else if !IsValidFieldType(f.Type) {
return ErrInvalidFieldType
} else if f.Min > f.Max {
return ErrInvalidFieldRange
func (b *bsiGroup) validate() error {
if b.Name == "" {
return ErrBSIGroupNameRequired
} else if !isValidBSIGroupType(b.Type) {
return ErrInvalidBSIGroupType
} else if b.Min > b.Max {
return ErrInvalidBSIGroupRange
}
return nil
}
func encodeField(f *oField) *internal.Field {
if f == nil {
func encodeBSIGroup(b *bsiGroup) *internal.BSIGroup {
if b == nil {
return nil
}
return &internal.Field{
Name: f.Name,
Type: f.Type,
Min: int64(f.Min),
Max: int64(f.Max),
return &internal.BSIGroup{
Name: b.Name,
Type: b.Type,
Min: int64(b.Min),
Max: int64(b.Max),
}
}
func decodeField(f *internal.Field) *oField {
if f == nil {
func decodeBSIGroup(b *internal.BSIGroup) *bsiGroup {
if b == nil {
return nil
}
return &oField{
Name: f.Name,
Type: f.Type,
Min: f.Min,
Max: f.Max,
return &bsiGroup{
Name: b.Name,
Type: b.Type,
Min: b.Min,
Max: b.Max,
}
}

View file

@ -23,22 +23,22 @@ import (
// Ensure a field can adjust to its baseValue.
func TestField_BaseValue(t *testing.T) {
f0 := &oField{
Name: "f0",
Type: FieldTypeInt,
b0 := &bsiGroup{
Name: "b0",
Type: bsiGroupTypeInt,
Min: -100,
Max: 900,
}
f1 := &oField{
Name: "f1",
Type: FieldTypeInt,
b1 := &bsiGroup{
Name: "b1",
Type: bsiGroupTypeInt,
Min: 0,
Max: 1000,
}
f2 := &oField{
Name: "f2",
Type: FieldTypeInt,
b2 := &bsiGroup{
Name: "b2",
Type: bsiGroupTypeInt,
Min: 100,
Max: 1100,
}
@ -46,62 +46,62 @@ func TestField_BaseValue(t *testing.T) {
t.Run("Normal Condition", func(t *testing.T) {
for _, tt := range []struct {
f *oField
f *bsiGroup
op pql.Token
val int64
expBaseValue uint64
expOutOfRange bool
}{
// LT
{f0, pql.LT, 5, 105, false},
{f0, pql.LT, -8, 92, false},
{f0, pql.LT, -108, 0, true},
{f0, pql.LT, 1005, 1000, false},
{f0, pql.LT, 0, 100, false},
{b0, pql.LT, 5, 105, false},
{b0, pql.LT, -8, 92, false},
{b0, pql.LT, -108, 0, true},
{b0, pql.LT, 1005, 1000, false},
{b0, pql.LT, 0, 100, false},
{f1, pql.LT, 5, 5, false},
{f1, pql.LT, -8, 0, true},
{f1, pql.LT, 1005, 1000, false},
{f1, pql.LT, 0, 0, false},
{b1, pql.LT, 5, 5, false},
{b1, pql.LT, -8, 0, true},
{b1, pql.LT, 1005, 1000, false},
{b1, pql.LT, 0, 0, false},
{f2, pql.LT, 5, 0, true},
{f2, pql.LT, -8, 0, true},
{f2, pql.LT, 105, 5, false},
{f2, pql.LT, 1105, 1000, false},
{b2, pql.LT, 5, 0, true},
{b2, pql.LT, -8, 0, true},
{b2, pql.LT, 105, 5, false},
{b2, pql.LT, 1105, 1000, false},
// GT
{f0, pql.GT, -105, 0, false},
{f0, pql.GT, 5, 105, false},
{f0, pql.GT, 905, 0, true},
{f0, pql.GT, 0, 100, false},
{b0, pql.GT, -105, 0, false},
{b0, pql.GT, 5, 105, false},
{b0, pql.GT, 905, 0, true},
{b0, pql.GT, 0, 100, false},
{f1, pql.GT, 5, 5, false},
{f1, pql.GT, -8, 0, false},
{f1, pql.GT, 1005, 0, true},
{f1, pql.GT, 0, 0, false},
{b1, pql.GT, 5, 5, false},
{b1, pql.GT, -8, 0, false},
{b1, pql.GT, 1005, 0, true},
{b1, pql.GT, 0, 0, false},
{f2, pql.GT, 5, 0, false},
{f2, pql.GT, -8, 0, false},
{f2, pql.GT, 105, 5, false},
{f2, pql.GT, 1105, 0, true},
{b2, pql.GT, 5, 0, false},
{b2, pql.GT, -8, 0, false},
{b2, pql.GT, 105, 5, false},
{b2, pql.GT, 1105, 0, true},
// EQ
{f0, pql.EQ, -105, 0, true},
{f0, pql.EQ, 5, 105, false},
{f0, pql.EQ, 905, 0, true},
{f0, pql.EQ, 0, 100, false},
{b0, pql.EQ, -105, 0, true},
{b0, pql.EQ, 5, 105, false},
{b0, pql.EQ, 905, 0, true},
{b0, pql.EQ, 0, 100, false},
{f1, pql.EQ, 5, 5, false},
{f1, pql.EQ, -8, 0, true},
{f1, pql.EQ, 1005, 0, true},
{f1, pql.EQ, 0, 0, false},
{b1, pql.EQ, 5, 5, false},
{b1, pql.EQ, -8, 0, true},
{b1, pql.EQ, 1005, 0, true},
{b1, pql.EQ, 0, 0, false},
{f2, pql.EQ, 5, 0, true},
{f2, pql.EQ, -8, 0, true},
{f2, pql.EQ, 105, 5, false},
{f2, pql.EQ, 1105, 0, true},
{b2, pql.EQ, 5, 0, true},
{b2, pql.EQ, -8, 0, true},
{b2, pql.EQ, 105, 5, false},
{b2, pql.EQ, 1105, 0, true},
} {
bv, oor := tt.f.BaseValue(tt.op, tt.val)
bv, oor := tt.f.baseValue(tt.op, tt.val)
if oor != tt.expOutOfRange {
t.Fatalf("baseValue calculation on %s op %s, expected outOfRange %v, got %v", tt.f.Name, tt.op, tt.expOutOfRange, oor)
} else if !reflect.DeepEqual(bv, tt.expBaseValue) {
@ -112,7 +112,7 @@ func TestField_BaseValue(t *testing.T) {
t.Run("Betwween Condition", func(t *testing.T) {
for _, tt := range []struct {
f *oField
f *bsiGroup
predMin int64
predMax int64
expBaseValueMin uint64
@ -120,25 +120,25 @@ func TestField_BaseValue(t *testing.T) {
expOutOfRange bool
}{
{f0, -205, -105, 0, 0, true},
{f0, -105, 80, 0, 180, false},
{f0, 5, 20, 105, 120, false},
{f0, 20, 1005, 120, 1000, false},
{f0, 1005, 2000, 0, 0, true},
{b0, -205, -105, 0, 0, true},
{b0, -105, 80, 0, 180, false},
{b0, 5, 20, 105, 120, false},
{b0, 20, 1005, 120, 1000, false},
{b0, 1005, 2000, 0, 0, true},
{f1, -105, -5, 0, 0, true},
{f1, -5, 20, 0, 20, false},
{f1, 5, 20, 5, 20, false},
{f1, 20, 1005, 20, 1000, false},
{f1, 1005, 2000, 0, 0, true},
{b1, -105, -5, 0, 0, true},
{b1, -5, 20, 0, 20, false},
{b1, 5, 20, 5, 20, false},
{b1, 20, 1005, 20, 1000, false},
{b1, 1005, 2000, 0, 0, true},
{f2, 5, 95, 0, 0, true},
{f2, 95, 120, 0, 20, false},
{f2, 105, 120, 5, 20, false},
{f2, 120, 1105, 20, 1000, false},
{f2, 1105, 2000, 0, 0, true},
{b2, 5, 95, 0, 0, true},
{b2, 95, 120, 0, 20, false},
{b2, 105, 120, 5, 20, false},
{b2, 120, 1105, 20, 1000, false},
{b2, 1105, 2000, 0, 0, true},
} {
min, max, oor := tt.f.BaseValueBetween(tt.predMin, tt.predMax)
min, max, oor := tt.f.baseValueBetween(tt.predMin, tt.predMax)
if oor != tt.expOutOfRange {
t.Fatalf("baseValueBetween calculation on %s, expected outOfRange %v, got %v", tt.f.Name, tt.expOutOfRange, oor)
} else if !reflect.DeepEqual(min, tt.expBaseValueMin) || !reflect.DeepEqual(max, tt.expBaseValueMax) {

View file

@ -94,7 +94,7 @@ func TestFrame_SetValue(t *testing.T) {
}
// Read value.
if value, exists, err := f.FieldValue(100, "f"); err != nil {
if value, exists, err := f.Value(100, "f"); err != nil {
t.Fatal(err)
} else if value != 21 {
t.Fatalf("unexpected value: %d", value)
@ -138,7 +138,7 @@ func TestFrame_SetValue(t *testing.T) {
}
// Read value.
if value, exists, err := f.FieldValue(100, "f"); err != nil {
if value, exists, err := f.Value(100, "f"); err != nil {
t.Fatal(err)
} else if value != 23 {
t.Fatalf("unexpected value: %d", value)
@ -147,7 +147,7 @@ func TestFrame_SetValue(t *testing.T) {
}
})
t.Run("ErrFieldNotFound", func(t *testing.T) {
t.Run("ErrBSIGroupNotFound", func(t *testing.T) {
idx := test.MustOpenIndex()
defer idx.Close()
@ -159,12 +159,12 @@ func TestFrame_SetValue(t *testing.T) {
}
// Set value.
if _, err := f.SetValue(100, 21); err != pilosa.ErrFieldNotFound {
if _, err := f.SetValue(100, 21); err != pilosa.ErrBSIGroupNotFound {
t.Fatalf("unexpected error: %s", err)
}
})
t.Run("ErrFieldValueTooLow", func(t *testing.T) {
t.Run("ErrBSIGroupValueTooLow", func(t *testing.T) {
idx := test.MustOpenIndex()
defer idx.Close()
@ -178,12 +178,12 @@ func TestFrame_SetValue(t *testing.T) {
}
// Set value.
if _, err := f.SetValue(100, 15); err != pilosa.ErrFieldValueTooLow {
if _, err := f.SetValue(100, 15); err != pilosa.ErrBSIGroupValueTooLow {
t.Fatalf("unexpected error: %s", err)
}
})
t.Run("ErrFieldValueTooHigh", func(t *testing.T) {
t.Run("ErrBSIGroupValueTooHigh", func(t *testing.T) {
idx := test.MustOpenIndex()
defer idx.Close()
@ -197,7 +197,7 @@ func TestFrame_SetValue(t *testing.T) {
}
// Set value.
if _, err := f.SetValue(100, 31); err != pilosa.ErrFieldValueTooHigh {
if _, err := f.SetValue(100, 31); err != pilosa.ErrBSIGroupValueTooHigh {
t.Fatalf("unexpected error: %s", err)
}
})

View file

@ -21,8 +21,8 @@
CreateIndexMessage
CreateFrameMessage
DeleteFrameMessage
CreateFieldMessage
DeleteFieldMessage
CreateBSIGroupMessage
DeleteBSIGroupMessage
Frame
Schema
Index
@ -32,7 +32,7 @@
NodeEventMessage
NodeStatus
ClusterStatus
Field
BSIGroup
CreateViewMessage
DeleteViewMessage
ResizeInstruction
@ -366,66 +366,66 @@ func (m *DeleteFrameMessage) GetFrame() string {
return ""
}
type CreateFieldMessage struct {
Index string `protobuf:"bytes,1,opt,name=Index,proto3" json:"Index,omitempty"`
Frame string `protobuf:"bytes,2,opt,name=Frame,proto3" json:"Frame,omitempty"`
Field *Field `protobuf:"bytes,3,opt,name=Field" json:"Field,omitempty"`
type CreateBSIGroupMessage struct {
Index string `protobuf:"bytes,1,opt,name=Index,proto3" json:"Index,omitempty"`
Frame string `protobuf:"bytes,2,opt,name=Frame,proto3" json:"Frame,omitempty"`
BSIGroup *BSIGroup `protobuf:"bytes,3,opt,name=BSIGroup" json:"BSIGroup,omitempty"`
}
func (m *CreateFieldMessage) Reset() { *m = CreateFieldMessage{} }
func (m *CreateFieldMessage) String() string { return proto.CompactTextString(m) }
func (*CreateFieldMessage) ProtoMessage() {}
func (*CreateFieldMessage) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{12} }
func (m *CreateBSIGroupMessage) Reset() { *m = CreateBSIGroupMessage{} }
func (m *CreateBSIGroupMessage) String() string { return proto.CompactTextString(m) }
func (*CreateBSIGroupMessage) ProtoMessage() {}
func (*CreateBSIGroupMessage) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{12} }
func (m *CreateFieldMessage) GetIndex() string {
func (m *CreateBSIGroupMessage) GetIndex() string {
if m != nil {
return m.Index
}
return ""
}
func (m *CreateFieldMessage) GetFrame() string {
func (m *CreateBSIGroupMessage) GetFrame() string {
if m != nil {
return m.Frame
}
return ""
}
func (m *CreateFieldMessage) GetField() *Field {
func (m *CreateBSIGroupMessage) GetBSIGroup() *BSIGroup {
if m != nil {
return m.Field
return m.BSIGroup
}
return nil
}
type DeleteFieldMessage struct {
Index string `protobuf:"bytes,1,opt,name=Index,proto3" json:"Index,omitempty"`
Frame string `protobuf:"bytes,2,opt,name=Frame,proto3" json:"Frame,omitempty"`
Field string `protobuf:"bytes,3,opt,name=Field,proto3" json:"Field,omitempty"`
type DeleteBSIGroupMessage struct {
Index string `protobuf:"bytes,1,opt,name=Index,proto3" json:"Index,omitempty"`
Frame string `protobuf:"bytes,2,opt,name=Frame,proto3" json:"Frame,omitempty"`
BSIGroup string `protobuf:"bytes,3,opt,name=BSIGroup,proto3" json:"BSIGroup,omitempty"`
}
func (m *DeleteFieldMessage) Reset() { *m = DeleteFieldMessage{} }
func (m *DeleteFieldMessage) String() string { return proto.CompactTextString(m) }
func (*DeleteFieldMessage) ProtoMessage() {}
func (*DeleteFieldMessage) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{13} }
func (m *DeleteBSIGroupMessage) Reset() { *m = DeleteBSIGroupMessage{} }
func (m *DeleteBSIGroupMessage) String() string { return proto.CompactTextString(m) }
func (*DeleteBSIGroupMessage) ProtoMessage() {}
func (*DeleteBSIGroupMessage) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{13} }
func (m *DeleteFieldMessage) GetIndex() string {
func (m *DeleteBSIGroupMessage) GetIndex() string {
if m != nil {
return m.Index
}
return ""
}
func (m *DeleteFieldMessage) GetFrame() string {
func (m *DeleteBSIGroupMessage) GetFrame() string {
if m != nil {
return m.Frame
}
return ""
}
func (m *DeleteFieldMessage) GetField() string {
func (m *DeleteBSIGroupMessage) GetBSIGroup() string {
if m != nil {
return m.Field
return m.BSIGroup
}
return ""
}
@ -678,40 +678,40 @@ func (m *ClusterStatus) GetNodes() []*Node {
return nil
}
type Field struct {
type BSIGroup struct {
Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"`
Type string `protobuf:"bytes,2,opt,name=Type,proto3" json:"Type,omitempty"`
Min int64 `protobuf:"varint,3,opt,name=Min,proto3" json:"Min,omitempty"`
Max int64 `protobuf:"varint,4,opt,name=Max,proto3" json:"Max,omitempty"`
}
func (m *Field) Reset() { *m = Field{} }
func (m *Field) String() string { return proto.CompactTextString(m) }
func (*Field) ProtoMessage() {}
func (*Field) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{23} }
func (m *BSIGroup) Reset() { *m = BSIGroup{} }
func (m *BSIGroup) String() string { return proto.CompactTextString(m) }
func (*BSIGroup) ProtoMessage() {}
func (*BSIGroup) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{23} }
func (m *Field) GetName() string {
func (m *BSIGroup) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *Field) GetType() string {
func (m *BSIGroup) GetType() string {
if m != nil {
return m.Type
}
return ""
}
func (m *Field) GetMin() int64 {
func (m *BSIGroup) GetMin() int64 {
if m != nil {
return m.Min
}
return 0
}
func (m *Field) GetMax() int64 {
func (m *BSIGroup) GetMax() int64 {
if m != nil {
return m.Max
}
@ -997,8 +997,8 @@ func init() {
proto.RegisterType((*CreateIndexMessage)(nil), "internal.CreateIndexMessage")
proto.RegisterType((*CreateFrameMessage)(nil), "internal.CreateFrameMessage")
proto.RegisterType((*DeleteFrameMessage)(nil), "internal.DeleteFrameMessage")
proto.RegisterType((*CreateFieldMessage)(nil), "internal.CreateFieldMessage")
proto.RegisterType((*DeleteFieldMessage)(nil), "internal.DeleteFieldMessage")
proto.RegisterType((*CreateBSIGroupMessage)(nil), "internal.CreateBSIGroupMessage")
proto.RegisterType((*DeleteBSIGroupMessage)(nil), "internal.DeleteBSIGroupMessage")
proto.RegisterType((*Frame)(nil), "internal.Frame")
proto.RegisterType((*Schema)(nil), "internal.Schema")
proto.RegisterType((*Index)(nil), "internal.Index")
@ -1008,7 +1008,7 @@ func init() {
proto.RegisterType((*NodeEventMessage)(nil), "internal.NodeEventMessage")
proto.RegisterType((*NodeStatus)(nil), "internal.NodeStatus")
proto.RegisterType((*ClusterStatus)(nil), "internal.ClusterStatus")
proto.RegisterType((*Field)(nil), "internal.Field")
proto.RegisterType((*BSIGroup)(nil), "internal.BSIGroup")
proto.RegisterType((*CreateViewMessage)(nil), "internal.CreateViewMessage")
proto.RegisterType((*DeleteViewMessage)(nil), "internal.DeleteViewMessage")
proto.RegisterType((*ResizeInstruction)(nil), "internal.ResizeInstruction")
@ -1436,7 +1436,7 @@ func (m *DeleteFrameMessage) MarshalTo(dAtA []byte) (int, error) {
return i, nil
}
func (m *CreateFieldMessage) Marshal() (dAtA []byte, err error) {
func (m *CreateBSIGroupMessage) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
@ -1446,7 +1446,7 @@ func (m *CreateFieldMessage) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil
}
func (m *CreateFieldMessage) MarshalTo(dAtA []byte) (int, error) {
func (m *CreateBSIGroupMessage) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
@ -1463,11 +1463,11 @@ func (m *CreateFieldMessage) MarshalTo(dAtA []byte) (int, error) {
i = encodeVarintPrivate(dAtA, i, uint64(len(m.Frame)))
i += copy(dAtA[i:], m.Frame)
}
if m.Field != nil {
if m.BSIGroup != nil {
dAtA[i] = 0x1a
i++
i = encodeVarintPrivate(dAtA, i, uint64(m.Field.Size()))
n9, err := m.Field.MarshalTo(dAtA[i:])
i = encodeVarintPrivate(dAtA, i, uint64(m.BSIGroup.Size()))
n9, err := m.BSIGroup.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
@ -1476,7 +1476,7 @@ func (m *CreateFieldMessage) MarshalTo(dAtA []byte) (int, error) {
return i, nil
}
func (m *DeleteFieldMessage) Marshal() (dAtA []byte, err error) {
func (m *DeleteBSIGroupMessage) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
@ -1486,7 +1486,7 @@ func (m *DeleteFieldMessage) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil
}
func (m *DeleteFieldMessage) MarshalTo(dAtA []byte) (int, error) {
func (m *DeleteBSIGroupMessage) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
@ -1503,11 +1503,11 @@ func (m *DeleteFieldMessage) MarshalTo(dAtA []byte) (int, error) {
i = encodeVarintPrivate(dAtA, i, uint64(len(m.Frame)))
i += copy(dAtA[i:], m.Frame)
}
if len(m.Field) > 0 {
if len(m.BSIGroup) > 0 {
dAtA[i] = 0x1a
i++
i = encodeVarintPrivate(dAtA, i, uint64(len(m.Field)))
i += copy(dAtA[i:], m.Field)
i = encodeVarintPrivate(dAtA, i, uint64(len(m.BSIGroup)))
i += copy(dAtA[i:], m.BSIGroup)
}
return i, nil
}
@ -1859,7 +1859,7 @@ func (m *ClusterStatus) MarshalTo(dAtA []byte) (int, error) {
return i, nil
}
func (m *Field) Marshal() (dAtA []byte, err error) {
func (m *BSIGroup) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
@ -1869,7 +1869,7 @@ func (m *Field) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil
}
func (m *Field) MarshalTo(dAtA []byte) (int, error) {
func (m *BSIGroup) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
@ -2459,7 +2459,7 @@ func (m *DeleteFrameMessage) Size() (n int) {
return n
}
func (m *CreateFieldMessage) Size() (n int) {
func (m *CreateBSIGroupMessage) Size() (n int) {
var l int
_ = l
l = len(m.Index)
@ -2470,14 +2470,14 @@ func (m *CreateFieldMessage) Size() (n int) {
if l > 0 {
n += 1 + l + sovPrivate(uint64(l))
}
if m.Field != nil {
l = m.Field.Size()
if m.BSIGroup != nil {
l = m.BSIGroup.Size()
n += 1 + l + sovPrivate(uint64(l))
}
return n
}
func (m *DeleteFieldMessage) Size() (n int) {
func (m *DeleteBSIGroupMessage) Size() (n int) {
var l int
_ = l
l = len(m.Index)
@ -2488,7 +2488,7 @@ func (m *DeleteFieldMessage) Size() (n int) {
if l > 0 {
n += 1 + l + sovPrivate(uint64(l))
}
l = len(m.Field)
l = len(m.BSIGroup)
if l > 0 {
n += 1 + l + sovPrivate(uint64(l))
}
@ -2642,7 +2642,7 @@ func (m *ClusterStatus) Size() (n int) {
return n
}
func (m *Field) Size() (n int) {
func (m *BSIGroup) Size() (n int) {
var l int
_ = l
l = len(m.Name)
@ -4304,7 +4304,7 @@ func (m *DeleteFrameMessage) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *CreateFieldMessage) Unmarshal(dAtA []byte) error {
func (m *CreateBSIGroupMessage) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@ -4327,10 +4327,10 @@ func (m *CreateFieldMessage) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: CreateFieldMessage: wiretype end group for non-group")
return fmt.Errorf("proto: CreateBSIGroupMessage: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: CreateFieldMessage: illegal tag %d (wire type %d)", fieldNum, wire)
return fmt.Errorf("proto: CreateBSIGroupMessage: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
@ -4393,7 +4393,7 @@ func (m *CreateFieldMessage) Unmarshal(dAtA []byte) error {
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Field", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field BSIGroup", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
@ -4417,10 +4417,10 @@ func (m *CreateFieldMessage) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Field == nil {
m.Field = &Field{}
if m.BSIGroup == nil {
m.BSIGroup = &BSIGroup{}
}
if err := m.Field.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
if err := m.BSIGroup.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
@ -4445,7 +4445,7 @@ func (m *CreateFieldMessage) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *DeleteFieldMessage) Unmarshal(dAtA []byte) error {
func (m *DeleteBSIGroupMessage) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@ -4468,10 +4468,10 @@ func (m *DeleteFieldMessage) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: DeleteFieldMessage: wiretype end group for non-group")
return fmt.Errorf("proto: DeleteBSIGroupMessage: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: DeleteFieldMessage: illegal tag %d (wire type %d)", fieldNum, wire)
return fmt.Errorf("proto: DeleteBSIGroupMessage: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
@ -4534,7 +4534,7 @@ func (m *DeleteFieldMessage) Unmarshal(dAtA []byte) error {
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Field", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field BSIGroup", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
@ -4559,7 +4559,7 @@ func (m *DeleteFieldMessage) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Field = string(dAtA[iNdEx:postIndex])
m.BSIGroup = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
@ -5671,7 +5671,7 @@ func (m *ClusterStatus) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *Field) Unmarshal(dAtA []byte) error {
func (m *BSIGroup) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@ -5694,10 +5694,10 @@ func (m *Field) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Field: wiretype end group for non-group")
return fmt.Errorf("proto: BSIGroup: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Field: illegal tag %d (wire type %d)", fieldNum, wire)
return fmt.Errorf("proto: BSIGroup: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
@ -7075,70 +7075,70 @@ var (
func init() { proto.RegisterFile("private.proto", fileDescriptorPrivate) }
var fileDescriptorPrivate = []byte{
// 1029 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcb, 0x6f, 0x1b, 0x45,
0x18, 0x67, 0xbd, 0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0xb7, 0x7f, 0x76, 0xff, 0xf7, 0xb4, 0x85, 0xdf, 0xf3, 0x47,
0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xa3, 0xc6, 0x83, 0xfe, 0xaf, 0x0b, 0x00, 0x00,
}

View file

@ -12,7 +12,6 @@ message FrameMeta {
int64 Min = 9;
int64 Max = 10;
string TimeQuantum = 5;
//repeated Field Fields = 7;
}
message ImportResponse {
@ -65,16 +64,16 @@ message DeleteFrameMessage {
string Frame = 2;
}
message CreateFieldMessage {
message CreateBSIGroupMessage {
string Index = 1;
string Frame = 2;
Field Field = 3;
BSIGroup BSIGroup = 3;
}
message DeleteFieldMessage {
message DeleteBSIGroupMessage {
string Index = 1;
string Frame = 2;
string Field = 3;
string BSIGroup = 3;
}
message Frame {
@ -126,7 +125,7 @@ message ClusterStatus {
repeated Node Nodes = 3;
}
message Field {
message BSIGroup {
string Name = 1;
string Type = 2;
int64 Min = 3;

View file

@ -36,16 +36,16 @@ var (
ErrFrameExists = errors.New("frame already exists")
ErrFrameNotFound = errors.New("frame not found")
ErrFieldNotFound = errors.New("field not found")
ErrFieldExists = errors.New("field already exists")
ErrFieldNameRequired = errors.New("field name required")
ErrInvalidFieldType = errors.New("invalid field type")
ErrInvalidFieldRange = errors.New("invalid field range")
ErrInvalidFieldValueType = errors.New("invalid field value type")
ErrFieldValueTooLow = errors.New("field value too low")
ErrFieldValueTooHigh = errors.New("field value too high")
ErrInvalidRangeOperation = errors.New("invalid range operation")
ErrInvalidBetweenValue = errors.New("invalid value for between operation")
ErrBSIGroupNotFound = errors.New("bsigroup not found")
ErrBSIGroupExists = errors.New("bsigroup already exists")
ErrBSIGroupNameRequired = errors.New("bsigroup name required")
ErrInvalidBSIGroupType = errors.New("invalid bsigroup type")
ErrInvalidBSIGroupRange = errors.New("invalid bsigroup range")
ErrInvalidBSIGroupValueType = errors.New("invalid bsigroup value type")
ErrBSIGroupValueTooLow = errors.New("bsigroup value too low")
ErrBSIGroupValueTooHigh = errors.New("bsigroup value too high")
ErrInvalidRangeOperation = errors.New("invalid range operation")
ErrInvalidBetweenValue = errors.New("invalid value for between operation")
ErrInvalidView = errors.New("invalid view")
ErrInvalidCacheType = errors.New("invalid cache type")

View file

@ -470,15 +470,15 @@ func (s *Server) ReceiveMessage(pb proto.Message) error {
if err := idx.DeleteFrame(obj.Frame); err != nil {
return err
}
case *internal.CreateFieldMessage:
case *internal.CreateBSIGroupMessage:
f := s.Holder.Frame(obj.Index, obj.Frame)
field := decodeField(obj.Field)
if err := f.CreateField(field); err != nil {
field := decodeBSIGroup(obj.BSIGroup)
if err := f.createBSIGroup(field); err != nil {
return err
}
case *internal.DeleteFieldMessage:
case *internal.DeleteBSIGroupMessage:
f := s.Holder.Frame(obj.Index, obj.Frame)
if err := f.DeleteField(obj.Field); err != nil {
if err := f.deleteBSIGroupAndView(obj.BSIGroup); err != nil {
return err
}
case *internal.CreateViewMessage:

28
view.go
View file

@ -31,7 +31,7 @@ import (
const (
ViewStandard = "standard"
ViewFieldPrefix = "field_"
viewBSIGroupPrefix = "bsig_"
)
// IsValidView returns true if name is valid.
@ -98,7 +98,7 @@ func (v *View) Path() string { return v.path }
func (v *View) Open() error {
// Never keep a cache for field views.
if strings.HasPrefix(v.name, ViewFieldPrefix) {
if strings.HasPrefix(v.name, viewBSIGroupPrefix) {
v.cacheType = CacheTypeNone
}
@ -323,8 +323,8 @@ func (v *View) ClearBit(rowID, columnID uint64) (changed bool, err error) {
return frag.ClearBit(rowID, columnID)
}
// FieldValue uses a column of bits to read a multi-bit value.
func (v *View) FieldValue(columnID uint64, bitDepth uint) (value uint64, exists bool, err error) {
// value uses a column of bits to read a multi-bit value.
func (v *View) value(columnID uint64, bitDepth uint) (value uint64, exists bool, err error) {
slice := columnID / SliceWidth
frag, err := v.CreateFragmentIfNotExists(slice)
if err != nil {
@ -343,8 +343,8 @@ func (v *View) setValue(columnID uint64, bitDepth uint, value uint64) (changed b
return frag.SetValue(columnID, bitDepth, value)
}
// FieldSum returns the sum & count of a field.
func (v *View) FieldSum(filter *Row, bitDepth uint) (sum, count uint64, err error) {
// sum returns the sum & count of a field.
func (v *View) sum(filter *Row, bitDepth uint) (sum, count uint64, err error) {
for _, f := range v.Fragments() {
fsum, fcount, err := f.FieldSum(filter, bitDepth)
if err != nil {
@ -356,8 +356,8 @@ func (v *View) FieldSum(filter *Row, bitDepth uint) (sum, count uint64, err erro
return sum, count, nil
}
// FieldMin returns the min and count of a field.
func (v *View) FieldMin(filter *Row, bitDepth uint) (min, count uint64, err error) {
// min returns the min and count of a field.
func (v *View) min(filter *Row, bitDepth uint) (min, count uint64, err error) {
var minHasValue bool
for _, f := range v.Fragments() {
fmin, fcount, err := f.FieldMin(filter, bitDepth)
@ -384,8 +384,8 @@ func (v *View) FieldMin(filter *Row, bitDepth uint) (min, count uint64, err erro
return min, count, nil
}
// FieldMax returns the max and count of a field.
func (v *View) FieldMax(filter *Row, bitDepth uint) (max, count uint64, err error) {
// max returns the max and count of a field.
func (v *View) max(filter *Row, bitDepth uint) (max, count uint64, err error) {
for _, f := range v.Fragments() {
fmax, fcount, err := f.FieldMax(filter, bitDepth)
if err != nil {
@ -399,8 +399,8 @@ func (v *View) FieldMax(filter *Row, bitDepth uint) (max, count uint64, err erro
return max, count, nil
}
// FieldRange returns rows with a field value encoding matching the predicate.
func (v *View) FieldRange(op pql.Token, bitDepth uint, predicate uint64) (*Row, error) {
// rangeOp returns rows with a field value encoding matching the predicate.
func (v *View) rangeOp(op pql.Token, bitDepth uint, predicate uint64) (*Row, error) {
r := NewRow()
for _, frag := range v.Fragments() {
other, err := frag.FieldRange(op, bitDepth, predicate)
@ -412,9 +412,9 @@ func (v *View) FieldRange(op pql.Token, bitDepth uint, predicate uint64) (*Row,
return r, nil
}
// FieldRangeBetween returns bitmaps with a field value encoding matching any
// rangeBetween returns bitmaps with a field value encoding matching any
// value between predicateMin and predicateMax.
func (v *View) FieldRangeBetween(bitDepth uint, predicateMin, predicateMax uint64) (*Row, error) {
func (v *View) rangeBetween(bitDepth uint, predicateMin, predicateMax uint64) (*Row, error) {
r := NewRow()
for _, frag := range v.Fragments() {
other, err := frag.FieldRangeBetween(bitDepth, predicateMin, predicateMax)