diff --git a/api.go b/api.go index e5562602b..beb2741d0 100644 --- a/api.go +++ b/api.go @@ -686,10 +686,10 @@ func (api *API) Import(_ context.Context, req *ImportRequest) error { timestamps[i] = &t } - // Import columnIDs into notnull field. - if err := importNotNullColumns(index, req.ColumnIDs); err != nil { - api.server.logger.Printf("import notnull error: index=%s, field=%s, shard=%d, columns=%d, err=%s", req.Index, req.Field, req.Shard, len(req.ColumnIDs), err) - return errors.Wrap(err, "importing notnull columns") + // Import columnIDs into existence field. + if err := importExistenceColumns(index, req.ColumnIDs); err != nil { + api.server.logger.Printf("import existence error: index=%s, field=%s, shard=%d, columns=%d, err=%s", req.Index, req.Field, req.Shard, len(req.ColumnIDs), err) + return errors.Wrap(err, "importing existence columns") } // Import into fragment. @@ -726,10 +726,10 @@ func (api *API) ImportValue(_ context.Context, req *ImportValueRequest) error { } } - // Import columnIDs into notnull field. - if err := importNotNullColumns(index, req.ColumnIDs); err != nil { - api.server.logger.Printf("import notnull error: index=%s, field=%s, shard=%d, columns=%d, err=%s", req.Index, req.Field, req.Shard, len(req.ColumnIDs), err) - return errors.Wrap(err, "importing notnull columns") + // Import columnIDs into existence field. + if err := importExistenceColumns(index, req.ColumnIDs); err != nil { + api.server.logger.Printf("import existence error: index=%s, field=%s, shard=%d, columns=%d, err=%s", req.Index, req.Field, req.Shard, len(req.ColumnIDs), err) + return errors.Wrap(err, "importing existence columns") } // Import into fragment. @@ -740,14 +740,14 @@ func (api *API) ImportValue(_ context.Context, req *ImportValueRequest) error { return errors.Wrap(err, "importing") } -func importNotNullColumns(index *Index, columnIDs []uint64) error { - nnf := index.unprotectedNotNullField() +func importExistenceColumns(index *Index, columnIDs []uint64) error { + nnf := index.unprotectedExistenceField() if nnf == nil { return nil } - notNullRowIDs := make([]uint64, len(columnIDs)) - return nnf.Import(notNullRowIDs, columnIDs, nil) + existenceRowIDs := make([]uint64, len(columnIDs)) + return nnf.Import(existenceRowIDs, columnIDs, nil) } // MaxShards returns the maximum shard number for each index in a map. diff --git a/encoding/proto/proto.go b/encoding/proto/proto.go index c00e71b40..0fcd9df3a 100644 --- a/encoding/proto/proto.go +++ b/encoding/proto/proto.go @@ -509,8 +509,8 @@ func encodeCreateIndexMessage(m *pilosa.CreateIndexMessage) *internal.CreateInde func encodeIndexMeta(m *pilosa.IndexOptions) *internal.IndexMeta { return &internal.IndexMeta{ - Keys: m.Keys, - TrackNotNull: m.TrackNotNull, + Keys: m.Keys, + TrackExistence: m.TrackExistence, } } @@ -742,7 +742,7 @@ func decodeCreateIndexMessage(pb *internal.CreateIndexMessage, m *pilosa.CreateI func decodeIndexMeta(pb *internal.IndexMeta, m *pilosa.IndexOptions) { m.Keys = pb.Keys - m.TrackNotNull = pb.TrackNotNull + m.TrackExistence = pb.TrackExistence } func decodeDeleteIndexMessage(pb *internal.DeleteIndexMessage, m *pilosa.DeleteIndexMessage) { diff --git a/executor.go b/executor.go index 1149f8c0e..5681644aa 100644 --- a/executor.go +++ b/executor.go @@ -1131,10 +1131,10 @@ func (e *executor) executeSet(ctx context.Context, index string, c *pql.Call, op return false, ErrFieldNotFound } - // Set column on not-null field. - if nnf := idx.unprotectedNotNullField(); nnf != nil { + // Set column on existence field. + if nnf := idx.unprotectedExistenceField(); nnf != nil { if _, err := nnf.SetBit(0, colID, nil); err != nil { - return false, errors.Wrap(err, "setting not-null column") + return false, errors.Wrap(err, "setting existence column") } } diff --git a/executor_test.go b/executor_test.go index 602be93a5..25465411c 100644 --- a/executor_test.go +++ b/executor_test.go @@ -1497,13 +1497,13 @@ func TestExecutor_QueryCall(t *testing.T) { }) } -// Ensure a notnull field is maintained. -func TestExecutor_Execute_NotNull(t *testing.T) { +// Ensure an existence field is maintained. +func TestExecutor_Execute_Existence(t *testing.T) { t.Run("Row", func(t *testing.T) { c := test.MustRunCluster(t, 1) defer c.Close() hldr := test.Holder{Holder: c[0].Server.Holder()} - index := hldr.MustCreateIndexIfNotExists("i", pilosa.IndexOptions{TrackNotNull: true}) + index := hldr.MustCreateIndexIfNotExists("i", pilosa.IndexOptions{TrackExistence: true}) _, err := index.CreateField("f", pilosa.OptFieldTypeDefault()) if err != nil { t.Fatal(err) @@ -1524,26 +1524,26 @@ func TestExecutor_Execute_NotNull(t *testing.T) { t.Fatalf("unexpected columns: %+v", bits) } - if res, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Row(notnull=0)`}); err != nil { + if res, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Row(exists=0)`}); err != nil { t.Fatal(err) } else if bits := res.Results[0].(*pilosa.Row).Columns(); !reflect.DeepEqual(bits, []uint64{3, ShardWidth + 1, ShardWidth + 2}) { - t.Fatalf("unexpected notnull columns: %+v", bits) + t.Fatalf("unexpected existence columns: %+v", bits) } - // Reopen cluster to ensure not-null is reloaded. + // Reopen cluster to ensure existence field is reloaded. if err := c[0].Reopen(); err != nil { t.Fatal(err) } - if res, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Row(notnull=0)`}); err != nil { + if res, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Row(exists=0)`}); err != nil { t.Fatal(err) } else if bits := res.Results[0].(*pilosa.Row).Columns(); !reflect.DeepEqual(bits, []uint64{3, ShardWidth + 1, ShardWidth + 2}) { - t.Fatalf("unexpected notnull columns after reopen: %+v", bits) + t.Fatalf("unexpected existence columns after reopen: %+v", bits) } }) } -func benchmarkNotNull(nn bool, b *testing.B) { +func benchmarkExistence(nn bool, b *testing.B) { c := test.MustRunCluster(b, 1) defer c.Close() hldr := test.Holder{Holder: c[0].Server.Holder()} @@ -1551,7 +1551,7 @@ func benchmarkNotNull(nn bool, b *testing.B) { indexName := "i" fieldName := "f" - index := hldr.MustCreateIndexIfNotExists(indexName, pilosa.IndexOptions{TrackNotNull: nn}) + index := hldr.MustCreateIndexIfNotExists(indexName, pilosa.IndexOptions{TrackExistence: nn}) // Create field. if _, err := index.CreateFieldIfNotExists(fieldName); err != nil { b.Fatal(err) @@ -1568,5 +1568,5 @@ func benchmarkNotNull(nn bool, b *testing.B) { } } -func BenchmarkExecutor_NotNull_True(b *testing.B) { benchmarkNotNull(true, b) } -func BenchmarkExecutor_NotNull_False(b *testing.B) { benchmarkNotNull(false, b) } +func BenchmarkExecutor_Existence_True(b *testing.B) { benchmarkExistence(true, b) } +func BenchmarkExecutor_Existence_False(b *testing.B) { benchmarkExistence(false, b) } diff --git a/holder.go b/holder.go index 252fca2db..794104e53 100644 --- a/holder.go +++ b/holder.go @@ -39,8 +39,8 @@ const ( // fileLimit is the maximum open file limit (ulimit -n) to automatically set. fileLimit = 262144 // (512^2) - // notNullFieldName is the name of the internal field used to store not-null values. - notNullFieldName = "notnull" // TODO: use a name less likely to collide? + // existenceFieldName is the name of the internal field used to store existence values. + existenceFieldName = "exists" ) // Holder represents a container for indexes. @@ -357,7 +357,7 @@ func (h *Holder) createIndex(name string, opt IndexOptions) (*Index, error) { } index.keys = opt.Keys - index.trackNotNull = opt.TrackNotNull + index.trackExistence = opt.TrackExistence if err := index.Open(); err != nil { return nil, errors.Wrap(err, "opening") diff --git a/http/client_test.go b/http/client_test.go index 33a452f7b..f0e8cf132 100644 --- a/http/client_test.go +++ b/http/client_test.go @@ -655,8 +655,8 @@ func TestClient_ImportValue(t *testing.T) { } } -// Ensure client can bulk import data while tracking notnull. -func TestClient_ImportNotNull(t *testing.T) { +// Ensure client can bulk import data while tracking existence. +func TestClient_ImportExistence(t *testing.T) { cmd := test.MustRunCluster(t, 1)[0] host := cmd.URL() holder := cmd.Server.Holder() @@ -666,7 +666,7 @@ func TestClient_ImportNotNull(t *testing.T) { idxName := "iset" fldName := "fset" - index := hldr.MustCreateIndexIfNotExists(idxName, pilosa.IndexOptions{TrackNotNull: true}) + index := hldr.MustCreateIndexIfNotExists(idxName, pilosa.IndexOptions{TrackExistence: true}) _, err := index.CreateFieldIfNotExists(fldName) if err != nil { t.Fatal(err) @@ -690,9 +690,9 @@ func TestClient_ImportNotNull(t *testing.T) { t.Fatalf("unexpected columns: %+v", a) } - // Verify notnull. - if a := hldr.Row(idxName, "notnull", 0).Columns(); !reflect.DeepEqual(a, []uint64{1, 5, 6}) { - t.Fatalf("unexpected notnull columns: %+v", a) + // Verify existence. + if a := hldr.ReadRow(idxName, "exists", 0).Columns(); !reflect.DeepEqual(a, []uint64{1, 5, 6}) { + t.Fatalf("unexpected existence columns: %+v", a) } }) @@ -700,7 +700,7 @@ func TestClient_ImportNotNull(t *testing.T) { idxName := "iint" fldName := "fint" - index := hldr.MustCreateIndexIfNotExists(idxName, pilosa.IndexOptions{TrackNotNull: true}) + index := hldr.MustCreateIndexIfNotExists(idxName, pilosa.IndexOptions{TrackExistence: true}) field, err := index.CreateFieldIfNotExists(fldName, pilosa.OptFieldTypeInt(-100, 100)) if err != nil { t.Fatal(err) @@ -725,9 +725,9 @@ func TestClient_ImportNotNull(t *testing.T) { t.Fatalf("unexpected values: got sum=%v, count=%v; expected sum=50, cnt=3", sum, cnt) } - // Verify notnull. - if a := hldr.Row(idxName, "notnull", 0).Columns(); !reflect.DeepEqual(a, []uint64{1, 2, 3}) { - t.Fatalf("unexpected notnull columns: %+v", a) + // Verify existence. + if a := hldr.ReadRow(idxName, "exists", 0).Columns(); !reflect.DeepEqual(a, []uint64{1, 2, 3}) { + t.Fatalf("unexpected existence columns: %+v", a) } }) } diff --git a/index.go b/index.go index cccf2de69..a78fd8365 100644 --- a/index.go +++ b/index.go @@ -37,8 +37,8 @@ type Index struct { keys bool // use string keys // Not-null tracking. - trackNotNull bool - notNullField *Field + trackExistence bool + existenceField *Field // Fields by name. fields map[string]*Field @@ -96,8 +96,8 @@ func (i *Index) Options() IndexOptions { func (i *Index) options() IndexOptions { return IndexOptions{ - Keys: i.keys, - TrackNotNull: i.trackNotNull, + Keys: i.keys, + TrackExistence: i.trackExistence, } } @@ -117,9 +117,9 @@ func (i *Index) Open() error { return errors.Wrap(err, "opening fields") } - if i.trackNotNull { - if err := i.openNotNullField(); err != nil { - return errors.Wrap(err, "opening not-null field") + if i.trackExistence { + if err := i.openExistenceField(); err != nil { + return errors.Wrap(err, "opening existence field") } } @@ -160,13 +160,13 @@ func (i *Index) openFields() error { return nil } -// openNotNullField gets or creates the not-null field and associates it to the index. -func (i *Index) openNotNullField() error { - f, err := i.createFieldIfNotExists(notNullFieldName, FieldOptions{CacheType: CacheTypeNone, CacheSize: 0}) +// openExistenceField gets or creates the existence field and associates it to the index. +func (i *Index) openExistenceField() error { + f, err := i.createFieldIfNotExists(existenceFieldName, FieldOptions{CacheType: CacheTypeNone, CacheSize: 0}) if err != nil { - return errors.Wrap(err, "creating not-null field") + return errors.Wrap(err, "creating existence field") } - i.notNullField = f + i.existenceField = f return nil } @@ -188,7 +188,7 @@ func (i *Index) loadMeta() error { // Copy metadata fields. i.keys = pb.Keys - i.trackNotNull = pb.TrackNotNull + i.trackExistence = pb.TrackExistence return nil } @@ -197,8 +197,8 @@ func (i *Index) loadMeta() error { func (i *Index) saveMeta() error { // Marshal metadata. buf, err := proto.Marshal(&internal.IndexMeta{ - Keys: i.keys, - TrackNotNull: i.trackNotNull, + Keys: i.keys, + TrackExistence: i.trackExistence, }) if err != nil { return errors.Wrap(err, "marshalling") @@ -275,9 +275,9 @@ func (i *Index) Fields() []*Field { return a } -// unprotectedNotNullField returns the internal field used to track not-null columns. -func (i *Index) unprotectedNotNullField() *Field { - return i.notNullField +// unprotectedExistenceField returns the internal field used to track column existence. +func (i *Index) unprotectedExistenceField() *Field { + return i.existenceField } // recalculateCaches recalculates caches on every field in the index. @@ -448,8 +448,8 @@ func (p indexInfoSlice) Less(i, j int) bool { return p[i].Name < p[j].Name } // IndexOptions represents options to set when initializing an index. type IndexOptions struct { - Keys bool `json:"keys"` - TrackNotNull bool `json:"trackNotNull"` + Keys bool `json:"keys"` + TrackExistence bool `json:"trackExistence"` } // hasTime returns true if a contains a non-nil time. diff --git a/internal/private.pb.go b/internal/private.pb.go index 2d1c0deef..c65049d51 100644 --- a/internal/private.pb.go +++ b/internal/private.pb.go @@ -62,8 +62,8 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type IndexMeta struct { - Keys bool `protobuf:"varint,3,opt,name=Keys,proto3" json:"Keys,omitempty"` - TrackNotNull bool `protobuf:"varint,4,opt,name=TrackNotNull,proto3" json:"TrackNotNull,omitempty"` + Keys bool `protobuf:"varint,3,opt,name=Keys,proto3" json:"Keys,omitempty"` + TrackExistence bool `protobuf:"varint,4,opt,name=TrackExistence,proto3" json:"TrackExistence,omitempty"` } func (m *IndexMeta) Reset() { *m = IndexMeta{} } @@ -78,9 +78,9 @@ func (m *IndexMeta) GetKeys() bool { return false } -func (m *IndexMeta) GetTrackNotNull() bool { +func (m *IndexMeta) GetTrackExistence() bool { if m != nil { - return m.TrackNotNull + return m.TrackExistence } return false } @@ -1059,10 +1059,10 @@ func (m *IndexMeta) MarshalTo(dAtA []byte) (int, error) { } i++ } - if m.TrackNotNull { + if m.TrackExistence { dAtA[i] = 0x20 i++ - if m.TrackNotNull { + if m.TrackExistence { dAtA[i] = 1 } else { dAtA[i] = 0 @@ -2318,7 +2318,7 @@ func (m *IndexMeta) Size() (n int) { if m.Keys { n += 2 } - if m.TrackNotNull { + if m.TrackExistence { n += 2 } return n @@ -2925,7 +2925,7 @@ func (m *IndexMeta) Unmarshal(dAtA []byte) error { m.Keys = bool(v != 0) case 4: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TrackNotNull", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TrackExistence", wireType) } var v int for shift := uint(0); ; shift += 7 { @@ -2942,7 +2942,7 @@ func (m *IndexMeta) Unmarshal(dAtA []byte) error { break } } - m.TrackNotNull = bool(v != 0) + m.TrackExistence = bool(v != 0) default: iNdEx = preIndex skippy, err := skipPrivate(dAtA[iNdEx:]) @@ -7184,74 +7184,74 @@ var ( func init() { proto.RegisterFile("private.proto", fileDescriptorPrivate) } var fileDescriptorPrivate = []byte{ - // 1093 bytes of a gzipped FileDescriptorProto + // 1095 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xdd, 0x6e, 0xdc, 0x44, - 0x14, 0xc6, 0x3f, 0xbb, 0xd9, 0x3d, 0x9b, 0x4d, 0x13, 0x97, 0x06, 0x17, 0xa1, 0x10, 0x46, 0x95, - 0x1a, 0x2a, 0x11, 0xaa, 0xf6, 0x86, 0xbf, 0x4a, 0x25, 0xbb, 0x01, 0x4c, 0x49, 0x28, 0xe3, 0x24, - 0x77, 0xbd, 0x98, 0xec, 0x8e, 0x1a, 0x2b, 0x5e, 0x8f, 0xb1, 0xc7, 0x49, 0xb6, 0x17, 0xdc, 0x82, - 0xc4, 0x0b, 0x20, 0x9e, 0x84, 0x47, 0xe0, 0x92, 0x47, 0x40, 0xe1, 0x45, 0xd0, 0x9c, 0x19, 0xff, - 0x64, 0xb3, 0x21, 0x55, 0xe8, 0xdd, 0x9c, 0xef, 0x9c, 0x39, 0xe7, 0x9b, 0xf3, 0x67, 0x43, 0x3f, - 0xcd, 0xa2, 0x13, 0x26, 0xf9, 0x66, 0x9a, 0x09, 0x29, 0xbc, 0x4e, 0x94, 0x48, 0x9e, 0x25, 0x2c, - 0x26, 0x03, 0xe8, 0x06, 0xc9, 0x98, 0x9f, 0xed, 0x70, 0xc9, 0x3c, 0x0f, 0xdc, 0x67, 0x7c, 0x9a, - 0xfb, 0xce, 0xba, 0xb5, 0xd1, 0xa1, 0x78, 0xf6, 0x08, 0x2c, 0xee, 0x65, 0x6c, 0x74, 0xbc, 0x2b, - 0xe4, 0x6e, 0x11, 0xc7, 0xbe, 0x8b, 0xba, 0x0b, 0x18, 0xf9, 0xc3, 0x82, 0xc5, 0xaf, 0x22, 0x1e, - 0x8f, 0xbf, 0x4f, 0x65, 0x24, 0x92, 0xdc, 0x7b, 0x0f, 0xba, 0x03, 0x36, 0x3a, 0xe2, 0x7b, 0xd3, - 0x94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28, 0xf7, 0x28, 0x90, 0xc7, - 0xd0, 0x0e, 0x47, 0x47, 0x7c, 0xc2, 0xbc, 0x0f, 0x61, 0x01, 0x79, 0xf0, 0xdc, 0x34, 0xdb, 0xad, - 0x99, 0x24, 0xd2, 0x52, 0x4f, 0x86, 0x86, 0xff, 0x5c, 0x4e, 0xf7, 0xa1, 0x8d, 0xd1, 0x73, 0xdf, - 0x9d, 0x75, 0x83, 0x38, 0x35, 0x6a, 0xb2, 0x0d, 0xce, 0x3e, 0x0d, 0xd4, 0x10, 0x21, 0x83, 0xd2, - 0x8b, 0x91, 0x94, 0xef, 0x6f, 0x44, 0x2e, 0x4d, 0x36, 0xf0, 0xac, 0xb0, 0xe7, 0x22, 0x93, 0x98, - 0xfa, 0x3e, 0xc5, 0x33, 0x79, 0x01, 0xee, 0xae, 0x18, 0x73, 0x6f, 0x09, 0xec, 0x60, 0x68, 0x7c, - 0xd8, 0xc1, 0xd0, 0x7b, 0x1f, 0xdd, 0x9b, 0xd4, 0xf4, 0x6b, 0x12, 0xfb, 0x34, 0xa0, 0x18, 0xf8, - 0x1e, 0xf4, 0x83, 0x7c, 0x20, 0x44, 0x36, 0x8e, 0x12, 0x26, 0x45, 0x66, 0x56, 0xee, 0x45, 0x90, - 0x3c, 0x85, 0x65, 0xe5, 0x3e, 0x94, 0x4c, 0xf2, 0xb2, 0x7e, 0xab, 0xd0, 0x56, 0x58, 0x15, 0xce, - 0x48, 0x38, 0x08, 0xca, 0xae, 0xac, 0x20, 0x0a, 0xe4, 0x3b, 0xed, 0x61, 0xfb, 0x84, 0x27, 0xb2, - 0xd1, 0x01, 0x28, 0xa3, 0x83, 0x3e, 0xd5, 0x82, 0x47, 0xf4, 0x53, 0x0c, 0xe7, 0xa5, 0x9a, 0xb3, - 0x42, 0x29, 0xea, 0xc8, 0xaf, 0x16, 0x40, 0x49, 0xa8, 0xc8, 0xab, 0x2b, 0xd6, 0xd5, 0x57, 0xbc, - 0x8d, 0xb2, 0xc6, 0xa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--git a/internal/private.proto b/internal/private.proto index 1e97e29bc..88d16363f 100644 --- a/internal/private.proto +++ b/internal/private.proto @@ -4,7 +4,7 @@ package internal; message IndexMeta { bool Keys = 3; - bool TrackNotNull = 4; + bool TrackExistence = 4; } message FieldOptions { diff --git a/pilosa.go b/pilosa.go index 45d77a9f3..7378eb628 100644 --- a/pilosa.go +++ b/pilosa.go @@ -49,6 +49,8 @@ var ( ErrName = errors.New("invalid index or field name, must match [a-z0-9_-]") ErrLabel = errors.New("invalid row or column label, must match [A-Za-z0-9_-]") + ErrReservedName = errors.New("reserved index or field name") + // ErrFragmentNotFound is returned when a fragment does not exist. ErrFragmentNotFound = errors.New("fragment not found") ErrQueryRequired = errors.New("query required") @@ -125,6 +127,9 @@ const TimeFormat = "2006-01-02T15:04" // validateName ensures that the name is a valid format. func validateName(name string) error { + if name == existenceFieldName { + return ErrReservedName + } if !nameRegexp.Match([]byte(name)) { return ErrName } diff --git a/pilosa_internal_test.go b/pilosa_internal_test.go index 139d5c2b7..96dae1433 100644 --- a/pilosa_internal_test.go +++ b/pilosa_internal_test.go @@ -34,6 +34,7 @@ func TestValidateNameInvalid(t *testing.T) { names := []string{ "", "'", "^", "/", "\\", "A", "*", "a:b", "valid?no", "yüce", "1", "_", "-", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1", + "exists", } for _, name := range names { if validateName(name) == nil { diff --git a/test/holder.go b/test/holder.go index 80778fe2a..8d080e493 100644 --- a/test/holder.go +++ b/test/holder.go @@ -91,6 +91,20 @@ func (h *Holder) Row(index, field string, rowID uint64) *pilosa.Row { return row } +// ReadRow returns a Row for a given field. If the field does not exist, +// it panics rather than creating the field. +func (h *Holder) ReadRow(index, field string, rowID uint64) *pilosa.Row { + f := h.Holder.Field(index, field) + if f == nil { + panic(pilosa.ErrFieldNotFound) + } + row, err := f.Row(rowID) + if err != nil { + panic(err) + } + return row +} + func (h *Holder) RowAttrStore(index, field string) pilosa.AttrStore { idx := h.MustCreateIndexIfNotExists(index, pilosa.IndexOptions{}) f, err := idx.CreateFieldIfNotExists(field, pilosa.OptFieldTypeDefault())