From f4ba34247f9c1ed4eaee0ebe57bc7fd3ca41f4b2 Mon Sep 17 00:00:00 2001 From: Nia Weiss Date: Thu, 13 May 2021 16:03:17 -0400 Subject: [PATCH] remove attributes Attributes are unmaintained and unused. They have become more of a liability than a benefit. This change eliminates them from the codebase. The only user-visible change (assuming that attrs are not used) is that the attrs field will no longer appear in row JSON. --- api.go | 141 +- api_test.go | 140 - apimethod_string.go | 48 +- attr.go | 211 -- attr_test.go | 204 -- boltdb/attrstore.go | 433 --- boltdb/translate.go | 10 + cache.go | 29 - client.go | 23 - client/client.go | 39 +- client/client_it_test.go | 69 +- client/client_test.go | 73 +- client/docs/data-model-queries.md | 3 - client/docs/server-interaction.md | 18 - client/orm.go | 117 +- client/orm_test.go | 92 +- client/response.go | 109 +- client/response_test.go | 65 +- ctl/backup.go | 68 +- encoding/proto/proto.go | 152 +- executor.go | 414 +-- executor_test.go | 306 +- field.go | 20 - fragment.go | 31 - fragment_internal_test.go | 43 - handler.go | 33 +- holder.go | 119 - holder_test.go | 16 - http/client.go | 180 -- http/client_test.go | 75 - http/handler.go | 164 +- index.go | 19 - metrics.go | 6 - pb/private.pb.go | 14 - pb/public.pb.go | 1830 +----------- pb/public.proto | 33 - pilosa.go | 30 - pilosa_internal_test.go | 29 - pql/ast.go | 31 +- pql/pql.peg | 5 - pql/pql.peg.go | 4413 +++++++++++++---------------- pql/pqlpeg_test.go | 138 +- row.go | 21 +- server.go | 10 - server/cluster_test.go | 12 +- server/config.go | 3 +- server/grpc.go | 1 - server/handler_test.go | 156 +- server/server.go | 1 - server/server_test.go | 131 - sql/mapper.go | 2 - sql/select.go | 4 +- stats/stats_test.go | 68 - test/holder.go | 11 - txfactory.go | 4 +- view.go | 7 +- view_internal_test.go | 3 - 57 files changed, 2175 insertions(+), 8252 deletions(-) delete mode 100644 attr.go delete mode 100644 attr_test.go delete mode 100644 boltdb/attrstore.go diff --git a/api.go b/api.go index c40cc1a93..75becc899 100644 --- a/api.go +++ b/api.go @@ -189,13 +189,10 @@ func (api *API) query(ctx context.Context, req *QueryRequest) (QueryResponse, er // TODO can we get rid of exec options and pass the QueryRequest directly to executor? execOpts := &execOptions{ - Remote: req.Remote, - Profile: req.Profile, - ExcludeRowAttrs: req.ExcludeRowAttrs, // NOTE: Kept for Pilosa 1.x compat. - ExcludeColumns: req.ExcludeColumns, // NOTE: Kept for Pilosa 1.x compat. - ColumnAttrs: req.ColumnAttrs, // NOTE: Kept for Pilosa 1.x compat. - PreTranslated: req.PreTranslated, - EmbeddedData: req.EmbeddedData, // precomputed values that needed to be passed with the request + Remote: req.Remote, + Profile: req.Profile, + PreTranslated: req.PreTranslated, + EmbeddedData: req.EmbeddedData, // precomputed values that needed to be passed with the request } resp, err := api.server.executor.Execute(ctx, req.Index, q, req.Shards, execOpts) if err != nil { @@ -280,15 +277,6 @@ func (api *API) DeleteIndex(ctx context.Context, indexName string) error { return nil } -func (api *API) WriteColumnAttrDataTo(ctx context.Context, w io.Writer, indexName string) error { - index := api.holder.Index(indexName) - if index == nil { - return newNotFoundError(ErrIndexNotFound, indexName) - } - _, err := index.ColumnAttrStore().WriteTo(w) - return err -} - // CreateField makes the named field in the named index with the given options. // This method currently only takes a single functional option, but that may be // changed in the future to support multiple options. @@ -346,15 +334,6 @@ func (api *API) Field(ctx context.Context, indexName, fieldName string) (*Field, return field, nil } -func (api *API) WriteRowAttrDataTo(ctx context.Context, w io.Writer, indexName, fieldName string) error { - field := api.holder.Field(indexName, fieldName) - if field == nil { - return newNotFoundError(ErrFieldNotFound, fieldName) - } - _, err := field.RowAttrStore().WriteTo(w) - return err -} - func setUpImportOptions(opts ...ImportOption) (*ImportOptions, error) { options := &ImportOptions{} for _, opt := range opts { @@ -1187,82 +1166,6 @@ func (api *API) DeleteView(ctx context.Context, indexName string, fieldName stri return errors.Wrap(err, "sending DeleteView message") } -// IndexAttrDiff determines the local column attribute data blocks which differ from those provided. -func (api *API) IndexAttrDiff(ctx context.Context, indexName string, blocks []AttrBlock) (map[uint64]map[string]interface{}, error) { - span, _ := tracing.StartSpanFromContext(ctx, "API.IndexAttrDiff") - defer span.Finish() - - if err := api.validate(apiIndexAttrDiff); err != nil { - return nil, errors.Wrap(err, "validating api method") - } - - // Retrieve index from holder. - index := api.holder.Index(indexName) - if index == nil { - return nil, newNotFoundError(ErrIndexNotFound, indexName) - } - - // Retrieve local blocks. - localBlocks, err := index.ColumnAttrStore().Blocks() - if err != nil { - return nil, errors.Wrap(err, "getting blocks") - } - - // Read all attributes from all mismatched blocks. - attrs := make(map[uint64]map[string]interface{}) - for _, blockID := range attrBlocks(localBlocks).Diff(blocks) { - // Retrieve block data. - m, err := index.ColumnAttrStore().BlockData(blockID) - if err != nil { - return nil, errors.Wrap(err, "getting block") - } - - // Copy to index-wide struct. - for k, v := range m { - attrs[k] = v - } - } - return attrs, nil -} - -// FieldAttrDiff determines the local row attribute data blocks which differ from those provided. -func (api *API) FieldAttrDiff(ctx context.Context, indexName string, fieldName string, blocks []AttrBlock) (map[uint64]map[string]interface{}, error) { - span, _ := tracing.StartSpanFromContext(ctx, "API.FieldAttrDiff") - defer span.Finish() - - if err := api.validate(apiFieldAttrDiff); err != nil { - return nil, errors.Wrap(err, "validating api method") - } - - // Retrieve index from holder. - f := api.holder.Field(indexName, fieldName) - if f == nil { - return nil, newNotFoundError(ErrFieldNotFound, fieldName) - } - - // Retrieve local blocks. - localBlocks, err := f.RowAttrStore().Blocks() - if err != nil { - return nil, errors.Wrap(err, "getting blocks") - } - - // Read all attributes from all mismatched blocks. - attrs := make(map[uint64]map[string]interface{}) - for _, blockID := range attrBlocks(localBlocks).Diff(blocks) { - // Retrieve block data. - m, err := f.RowAttrStore().BlockData(blockID) - if err != nil { - return nil, errors.Wrap(err, "getting block") - } - - // Copy to index-wide struct. - for k, v := range m { - attrs[k] = v - } - } - return attrs, nil -} - // IndexShardSnapshot returns a reader that contains the contents of an RBF snapshot for an index/shard. func (api *API) IndexShardSnapshot(ctx context.Context, indexName string, shard uint64) (io.ReadCloser, error) { span, _ := tracing.StartSpanFromContext(ctx, "API.IndexShardSnapshot") @@ -1768,36 +1671,6 @@ func (api *API) ImportValueWithTx(ctx context.Context, qcx *Qcx, req *ImportValu return nil } -func (api *API) ImportColumnAttrs(ctx context.Context, req *ImportColumnAttrsRequest, opts ...ImportOption) error { - span, _ := tracing.StartSpanFromContext(ctx, "API.ImportColumnAttrs") - defer span.Finish() - - index, err := api.Index(ctx, req.Index) - if err != nil { - return errors.Wrap(err, "getting index") - } - - if err := api.validateShardOwnership(req.Index, uint64(req.Shard)); err != nil { - return errors.Wrap(err, "validating shard ownership") - } - - if req.IndexCreatedAt != 0 { - if index.CreatedAt() != req.IndexCreatedAt { - return ErrPreconditionFailed - } - } - - bulkAttrs := make(map[uint64]map[string]interface{}) - for n := 0; n < len(req.ColumnIDs); n++ { - bulkAttrs[uint64(req.ColumnIDs[n])] = map[string]interface{}{req.AttrKey: req.AttrVals[n]} - } - if err := index.ColumnAttrStore().SetBulkAttrs(bulkAttrs); err != nil { - api.server.logger.Errorf("import error: index=%s, shard=%d, len(columns)=%d, err=%s", req.Index, req.Shard, len(req.ColumnIDs), err) - return errors.Wrap(err, "importing column attrs") - } - return nil -} - func importExistenceColumns(qcx *Qcx, index *Index, columnIDs []uint64) error { ef := index.existenceField() if ef == nil { @@ -2369,12 +2242,10 @@ const ( apiTranslateData apiFieldTranslateData apiField - apiFieldAttrDiff //apiHosts // not implemented apiImport apiImportValue apiIndex - apiIndexAttrDiff //apiLocalID // not implemented //apiLongQueryTime // not implemented //apiMaxShards // not implemented @@ -2418,9 +2289,7 @@ var methodsDegraded = map[apiMethod]struct{}{ apiFragmentBlockData: {}, apiFragmentBlocks: {}, apiField: {}, - apiFieldAttrDiff: {}, apiIndex: {}, - apiIndexAttrDiff: {}, apiQuery: {}, apiRecalculateCaches: {}, apiRemoveNode: {}, @@ -2446,11 +2315,9 @@ var methodsNormal = map[apiMethod]struct{}{ apiFragmentBlocks: {}, apiField: {}, apiFieldTranslateData: {}, - apiFieldAttrDiff: {}, apiImport: {}, apiImportValue: {}, apiIndex: {}, - apiIndexAttrDiff: {}, apiQuery: {}, apiRecalculateCaches: {}, apiRemoveNode: {}, diff --git a/api_test.go b/api_test.go index 893d6f1b8..60e1f5401 100644 --- a/api_test.go +++ b/api_test.go @@ -21,7 +21,6 @@ import ( "fmt" "math" "reflect" - "strconv" "strings" "testing" "time" @@ -34,145 +33,6 @@ import ( . "github.com/pilosa/pilosa/v2/vprint" // nolint:staticcheck ) -// attrFun defines a mapping from columnID -> attr value -func attrFun(id uint64) string { - //return fmt.Sprintf("%x", md5.Sum([]byte(strconv.FormatInt(int64(id), 10)))) - return strconv.FormatInt(int64(id), 10) -} - -func TestAPI_ImportColumnAttrs(t *testing.T) { - /* - columns seconds - 100 1.150 - 1000 1.568 - 10000 5.156 - 100000 38.179 - */ - c := test.MustRunCluster(t, 3, - []server.CommandOption{ - server.OptCommandServerOptions( - pilosa.OptServerNodeID("node0"), - pilosa.OptServerClusterHasher(&offsetModHasher{}), - )}, - []server.CommandOption{ - server.OptCommandServerOptions( - pilosa.OptServerNodeID("node1"), - pilosa.OptServerClusterHasher(&offsetModHasher{}), - )}, - []server.CommandOption{ - server.OptCommandServerOptions( - pilosa.OptServerNodeID("node2"), - pilosa.OptServerClusterHasher(&offsetModHasher{}), - )}, - ) - defer c.Close() - - m0 := c.GetNode(0) - m1 := c.GetNode(1) - - t.Run("ImportColumnAttrs", func(t *testing.T) { - ctx := context.Background() - indexName := "i" - fieldName := "f" - attrKey := "k" - - index, err := m0.API.CreateIndex(ctx, indexName, pilosa.IndexOptions{}) - if err != nil { - t.Fatalf("creating index: %v", err) - } - _, err = m0.API.CreateField(ctx, indexName, fieldName) - if err != nil { - t.Fatalf("creating field: %v", err) - } - - // Generate some attrs for two shards - numAttrs := 100 - columnIDs0 := make([]uint64, 0, numAttrs) - attrVals0 := make([]string, 0, numAttrs) - columnIDs1 := make([]uint64, 0, numAttrs) - attrVals1 := make([]string, 0, numAttrs) - for n := 0; n < 1000000; n += 1000000 / numAttrs { - columnIDs0 = append(columnIDs0, uint64(n)) - val0 := attrFun(uint64(n)) - attrVals0 = append(attrVals0, val0) - setPql0 := fmt.Sprintf("Set(%d, %s=0) ", n, fieldName) - if _, err := m0.API.Query(ctx, &pilosa.QueryRequest{Index: indexName, Query: setPql0}); err != nil { - t.Fatal(err) - } - - columnIDs1 = append(columnIDs1, uint64(n+ShardWidth)) - val1 := attrFun(uint64(n + ShardWidth)) - attrVals1 = append(attrVals1, val1) - setPql1 := fmt.Sprintf("Set(%d, %s=0) ", n+ShardWidth, fieldName) - if _, err := m1.API.Query(ctx, &pilosa.QueryRequest{Index: indexName, Query: setPql1}); err != nil { - t.Fatal(err) - } - } - - // send shard0 to node1 - req := &pilosa.ImportColumnAttrsRequest{ - AttrKey: attrKey, - ColumnIDs: columnIDs0, - AttrVals: attrVals0, - Shard: 0, - Index: indexName, - IndexCreatedAt: index.CreatedAt(), - } - - if err := m0.API.ImportColumnAttrs(ctx, req); err != nil { - t.Fatal(err) - } - - // send shard1 to node0 - req = &pilosa.ImportColumnAttrsRequest{ - AttrKey: attrKey, - ColumnIDs: columnIDs1, - AttrVals: attrVals1, - Shard: 1, - Index: indexName, - IndexCreatedAt: index.CreatedAt(), - } - - if err := m1.API.ImportColumnAttrs(ctx, req); err != nil { - t.Fatal(err) - } - - // Query node0. - pql := fmt.Sprintf("Options(Row(%s=0), columnAttrs=true)", fieldName) - res, err := m0.API.Query(ctx, &pilosa.QueryRequest{Index: indexName, Query: pql}) - if err != nil { - t.Fatal(err) - } - m := len(res.ColumnAttrSets) - if m != 100 { - t.Fatalf("incorrect number of column attrs set; m = %v", m) - } - - for _, v := range res.ColumnAttrSets { - attrVal := attrFun(v.ID) - if attrVal != v.Attrs[attrKey] { - t.Fatal(err) - } - } - // Query node1. - pql = fmt.Sprintf("Options(Row(%s=0), columnAttrs=true)", fieldName) - res, err = m1.API.Query(ctx, &pilosa.QueryRequest{Index: indexName, Query: pql}) - if err != nil { - t.Fatal(err) - } - if len(res.ColumnAttrSets) != 100 { - t.Fatal("incorrect number of column attrs set") - } - - for _, v := range res.ColumnAttrSets { - attrVal := attrFun(v.ID) - if attrVal != v.Attrs[attrKey] { - t.Fatal(err) - } - } - }) -} - func TestAPI_Import(t *testing.T) { c := test.MustRunCluster(t, 3, []server.CommandOption{ diff --git a/apimethod_string.go b/apimethod_string.go index 59549438d..11ed5a916 100644 --- a/apimethod_string.go +++ b/apimethod_string.go @@ -22,34 +22,32 @@ func _() { _ = x[apiTranslateData-11] _ = x[apiFieldTranslateData-12] _ = x[apiField-13] - _ = x[apiFieldAttrDiff-14] - _ = x[apiImport-15] - _ = x[apiImportValue-16] - _ = x[apiIndex-17] - _ = x[apiIndexAttrDiff-18] - _ = x[apiQuery-19] - _ = x[apiRecalculateCaches-20] - _ = x[apiRemoveNode-21] - _ = x[apiResizeAbort-22] - _ = x[apiSchema-23] - _ = x[apiShardNodes-24] - _ = x[apiState-25] - _ = x[apiViews-26] - _ = x[apiApplySchema-27] - _ = x[apiStartTransaction-28] - _ = x[apiFinishTransaction-29] - _ = x[apiTransactions-30] - _ = x[apiGetTransaction-31] - _ = x[apiActiveQueries-32] - _ = x[apiPastQueries-33] - _ = x[apiIDReserve-34] - _ = x[apiIDCommit-35] - _ = x[apiIDReset-36] + _ = x[apiImport-14] + _ = x[apiImportValue-15] + _ = x[apiIndex-16] + _ = x[apiQuery-17] + _ = x[apiRecalculateCaches-18] + _ = x[apiRemoveNode-19] + _ = x[apiResizeAbort-20] + _ = x[apiSchema-21] + _ = x[apiShardNodes-22] + _ = x[apiState-23] + _ = x[apiViews-24] + _ = x[apiApplySchema-25] + _ = x[apiStartTransaction-26] + _ = x[apiFinishTransaction-27] + _ = x[apiTransactions-28] + _ = x[apiGetTransaction-29] + _ = x[apiActiveQueries-30] + _ = x[apiPastQueries-31] + _ = x[apiIDReserve-32] + _ = x[apiIDCommit-33] + _ = x[apiIDReset-34] } -const _apiMethod_name = "apiClusterMessageapiCreateFieldapiCreateIndexapiDeleteFieldapiDeleteAvailableShardapiDeleteIndexapiDeleteViewapiExportCSVapiFragmentBlockDataapiFragmentBlocksapiFragmentDataapiTranslateDataapiFieldTranslateDataapiFieldapiFieldAttrDiffapiImportapiImportValueapiIndexapiIndexAttrDiffapiQueryapiRecalculateCachesapiRemoveNodeapiResizeAbortapiSchemaapiShardNodesapiStateapiViewsapiApplySchemaapiStartTransactionapiFinishTransactionapiTransactionsapiGetTransactionapiActiveQueriesapiPastQueriesapiIDReserveapiIDCommitapiIDReset" +const _apiMethod_name = "apiClusterMessageapiCreateFieldapiCreateIndexapiDeleteFieldapiDeleteAvailableShardapiDeleteIndexapiDeleteViewapiExportCSVapiFragmentBlockDataapiFragmentBlocksapiFragmentDataapiTranslateDataapiFieldTranslateDataapiFieldapiImportapiImportValueapiIndexapiQueryapiRecalculateCachesapiRemoveNodeapiResizeAbortapiSchemaapiShardNodesapiStateapiViewsapiApplySchemaapiStartTransactionapiFinishTransactionapiTransactionsapiGetTransactionapiActiveQueriesapiPastQueriesapiIDReserveapiIDCommitapiIDReset" -var _apiMethod_index = [...]uint16{0, 17, 31, 45, 59, 82, 96, 109, 121, 141, 158, 173, 189, 210, 218, 234, 243, 257, 265, 281, 289, 309, 322, 336, 345, 358, 366, 374, 388, 407, 427, 442, 459, 475, 489, 501, 512, 522} +var _apiMethod_index = [...]uint16{0, 17, 31, 45, 59, 82, 96, 109, 121, 141, 158, 173, 189, 210, 218, 227, 241, 249, 257, 277, 290, 304, 313, 326, 334, 342, 356, 375, 395, 410, 427, 443, 457, 469, 480, 490} func (i apiMethod) String() string { if i < 0 || i >= apiMethod(len(_apiMethod_index)-1) { diff --git a/attr.go b/attr.go deleted file mode 100644 index fa5d11eca..000000000 --- a/attr.go +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright 2017 Pilosa Corp. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package pilosa - -import ( - "bytes" - "io" - "sort" - - "github.com/gogo/protobuf/proto" - "github.com/pilosa/pilosa/v2/pb" -) - -// Attribute data type enum. -const ( - attrTypeString = 1 - attrTypeInt = 2 - attrTypeBool = 3 - attrTypeFloat = 4 -) - -// AttrStore represents an interface for handling row/column attributes. -type AttrStore interface { - io.WriterTo - - Path() string - Open() error - Close() error - Attrs(id uint64) (m map[string]interface{}, err error) - SetAttrs(id uint64, m map[string]interface{}) error - SetBulkAttrs(m map[uint64]map[string]interface{}) error - Blocks() ([]AttrBlock, error) - BlockData(i uint64) (map[uint64]map[string]interface{}, error) -} - -// nopStore represents an AttrStore that doesn't do anything. -var nopStore AttrStore = nopAttrStore{} - -// newNopAttrStore returns an attr store which does nothing. It returns a global -// object to avoid unnecessary allocations. -func newNopAttrStore(string) AttrStore { return nopStore } - -// nopAttrStore represents a no-op implementation of the AttrStore interface. -type nopAttrStore struct{} - -// Path is a no-op implementation of AttrStore Path method. -func (s nopAttrStore) Path() string { return "" } - -// Open is a no-op implementation of AttrStore Open method. -func (s nopAttrStore) Open() error { return nil } - -// Close is a no-op implementation of AttrStore Close method. -func (s nopAttrStore) Close() error { return nil } - -// Attrs is a no-op implementation of AttrStore Attrs method. -func (s nopAttrStore) Attrs(id uint64) (m map[string]interface{}, err error) { return nil, nil } - -// SetAttrs is a no-op implementation of AttrStore SetAttrs method. -func (s nopAttrStore) SetAttrs(id uint64, m map[string]interface{}) error { return nil } - -// SetBulkAttrs is a no-op implementation of AttrStore SetBulkAttrs method. -func (s nopAttrStore) SetBulkAttrs(m map[uint64]map[string]interface{}) error { return nil } - -// Blocks is a no-op implementation of AttrStore Blocks method. -func (s nopAttrStore) Blocks() ([]AttrBlock, error) { return nil, nil } - -// BlockData is a no-op implementation of AttrStore BlockData method. -func (s nopAttrStore) BlockData(i uint64) (map[uint64]map[string]interface{}, error) { return nil, nil } - -// WriteTo is a no-op implementation of AttrStore WriteTo method. -func (s nopAttrStore) WriteTo(w io.Writer) (int64, error) { return 0, nil } - -// AttrBlock represents a checksummed block of the attribute store. -type AttrBlock struct { - ID uint64 `json:"id"` - Checksum []byte `json:"checksum"` -} - -// attrBlocks represents a list of blocks. -type attrBlocks []AttrBlock - -// Diff returns a list of block ids that are different or are new in other. -// Block lists must be in sorted order. -func (a attrBlocks) Diff(other []AttrBlock) []uint64 { - var ids []uint64 - for { - // Read next block from each list. - var blk0, blk1 *AttrBlock - if len(a) > 0 { - blk0 = &a[0] - } - if len(other) > 0 { - blk1 = &other[0] - } - - // Exit if "a" contains no more blocks. - if blk0 == nil { - return ids - } - - // Add block ID if it's different or if it's only in "a". - if blk1 == nil || blk0.ID < blk1.ID { - ids = append(ids, blk0.ID) - a = a[1:] - } else if blk1.ID < blk0.ID { - other = other[1:] - } else { - if !bytes.Equal(blk0.Checksum, blk1.Checksum) { - ids = append(ids, blk0.ID) - } - a, other = a[1:], other[1:] - } - } -} - -func encodeAttrs(m map[string]interface{}) []*pb.Attr { - keys := make([]string, 0, len(m)) - for k := range m { - keys = append(keys, k) - } - sort.Strings(keys) - - a := make([]*pb.Attr, len(keys)) - for i := range keys { - a[i] = encodeAttr(keys[i], m[keys[i]]) - } - return a -} - -func decodeAttrs(pb []*pb.Attr) map[string]interface{} { - m := make(map[string]interface{}, len(pb)) - for i := range pb { - key, value := decodeAttr(pb[i]) - m[key] = value - } - return m -} - -// encodeAttr converts a key/value pair into an Attr pb.representation. -func encodeAttr(key string, value interface{}) *pb.Attr { - pb := &pb.Attr{Key: key} - switch value := value.(type) { - case string: - pb.Type = attrTypeString - pb.StringValue = value - case float64: - pb.Type = attrTypeFloat - pb.FloatValue = value - case uint64: - pb.Type = attrTypeInt - pb.IntValue = int64(value) - case int64: - pb.Type = attrTypeInt - pb.IntValue = value - case bool: - pb.Type = attrTypeBool - pb.BoolValue = value - } - return pb -} - -// decodeAttr converts from an Attr pb.representation to a key/value pair. -func decodeAttr(attr *pb.Attr) (key string, value interface{}) { - switch attr.Type { - case attrTypeString: - return attr.Key, attr.StringValue - case attrTypeInt: - return attr.Key, attr.IntValue - case attrTypeBool: - return attr.Key, attr.BoolValue - case attrTypeFloat: - return attr.Key, attr.FloatValue - default: - return attr.Key, nil - } -} - -// cloneAttrs returns a shallow clone of m. -func cloneAttrs(m map[string]interface{}) map[string]interface{} { - other := make(map[string]interface{}, len(m)) - for k, v := range m { - other[k] = v - } - return other -} - -// EncodeAttrs encodes an attribute map into a byte slice. -func EncodeAttrs(attr map[string]interface{}) ([]byte, error) { - return proto.Marshal(&pb.AttrMap{Attrs: encodeAttrs(attr)}) -} - -// DecodeAttrs decodes a byte slice into an attribute map. -func DecodeAttrs(v []byte) (map[string]interface{}, error) { - var pb pb.AttrMap - if err := proto.Unmarshal(v, &pb); err != nil { - return nil, err - } - return decodeAttrs(pb.GetAttrs()), nil -} diff --git a/attr_test.go b/attr_test.go deleted file mode 100644 index cc40daf3c..000000000 --- a/attr_test.go +++ /dev/null @@ -1,204 +0,0 @@ -// Copyright 2017 Pilosa Corp. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package pilosa_test - -import ( - "os" - "reflect" - "runtime" - "sync" - "testing" - - "github.com/pilosa/pilosa/v2" - "github.com/pilosa/pilosa/v2/boltdb" - "github.com/pilosa/pilosa/v2/testhook" -) - -// Ensure database can set and retrieve column attributes. -func TestAttrStore_Attrs(t *testing.T) { - s := MustOpenAttrStore(t) - defer s.Close() - - // Set attributes. - if err := s.SetAttrs(1, map[string]interface{}{"A": 100, "C": -27}); err != nil { - t.Fatal(err) - } else if err := s.SetAttrs(2, map[string]interface{}{"A": uint64(200)}); err != nil { - t.Fatal(err) - } else if err := s.SetAttrs(1, map[string]interface{}{"B": "VALUE"}); err != nil { - t.Fatal(err) - } - - // Retrieve attributes for column #1. - if m, err := s.Attrs(1); err != nil { - t.Fatal(err) - } else if !reflect.DeepEqual(m, map[string]interface{}{"A": int64(100), "B": "VALUE", "C": int64(-27)}) { - t.Fatalf("unexpected attrs(1): %#v", m) - } - - // Retrieve attributes for column #2. - if m, err := s.Attrs(2); err != nil { - t.Fatal(err) - } else if !reflect.DeepEqual(m, map[string]interface{}{"A": int64(200)}) { - t.Fatalf("unexpected attrs(2): %#v", m) - } -} - -// Ensure database returns a non-nil empty map if unset. -func TestAttrStore_Attrs_Empty(t *testing.T) { - s := MustOpenAttrStore(t) - defer s.Close() - - if m, err := s.Attrs(100); err != nil { - t.Fatal(err) - } else if m == nil || len(m) > 0 { - t.Fatalf("unexpected attrs: %#v", m) - } -} - -// Ensure database can unset attributes if explicitly set to nil. -func TestAttrStore_Attrs_Unset(t *testing.T) { - s := MustOpenAttrStore(t) - defer s.Close() - - // Set attributes. - if err := s.SetAttrs(1, map[string]interface{}{"A": "X", "B": "Y"}); err != nil { - t.Fatal(err) - } else if err := s.SetAttrs(1, map[string]interface{}{"B": nil}); err != nil { - t.Fatal(err) - } - - // Verify attributes. - if m, err := s.Attrs(1); err != nil { - t.Fatal(err) - } else if !reflect.DeepEqual(m, map[string]interface{}{"A": "X"}) { - t.Fatalf("unexpected attrs: %#v", m) - } -} - -// Ensure attribute block checksums can be returned. -func TestAttrStore_Blocks(t *testing.T) { - s := MustOpenAttrStore(t) - defer s.Close() - - // Set attributes. - if err := s.SetAttrs(1, map[string]interface{}{"A": uint64(100)}); err != nil { - t.Fatal(err) - } else if err := s.SetAttrs(2, map[string]interface{}{"A": uint64(200)}); err != nil { - t.Fatal(err) - } else if err := s.SetAttrs(100, map[string]interface{}{"B": "VALUE"}); err != nil { - t.Fatal(err) - } else if err := s.SetAttrs(350, map[string]interface{}{"C": "FOO"}); err != nil { - t.Fatal(err) - } - - // Retrieve blocks. - blks0, err := s.Blocks() - if err != nil { - t.Fatal(err) - } else if len(blks0) != 3 || blks0[0].ID != 0 || blks0[1].ID != 1 || blks0[2].ID != 3 { - t.Fatalf("unexpected blocks: %#v", blks0) - } - - // Change second block. - if err := s.SetAttrs(100, map[string]interface{}{"X": 12}); err != nil { - t.Fatal(err) - } - - // Ensure second block changed. - blks1, err := s.Blocks() - if err != nil { - t.Fatal(err) - } else if !reflect.DeepEqual(blks0[0], blks1[0]) { - t.Fatalf("block 0 mismatch: %#v != %#v", blks0[0], blks1[0]) - } else if reflect.DeepEqual(blks0[1], blks1[1]) { - t.Fatalf("block 1 match: %#v ", blks0[0]) - } else if !reflect.DeepEqual(blks0[2], blks1[2]) { - t.Fatalf("block 2 mismatch: %#v != %#v", blks0[2], blks1[2]) - } -} - -// AttrStore represents a test wrapper for pilosa.AttrStore. -type AttrStore struct { - pilosa.AttrStore -} - -// NewAttrStore returns a new instance of AttrStore. -func NewAttrStore(tb testing.TB) pilosa.AttrStore { - f, err := testhook.TempFile(tb, "pilosa-attr-") - if err != nil { - panic(err) - } - // Note, even though the file is closed, TempFile will still avoid - // creating the same name again if we leave it existing. The boltdb - // code may already be deleting this, so the TestHook deletion - // may not matter but it's more reliable this way. - f.Close() - - return &AttrStore{boltdb.NewAttrStore(f.Name())} -} - -func BenchmarkAttrStore_Duplicate(b *testing.B) { - s := MustOpenAttrStore(b) - defer s.Close() - - // Set attributes. - const n = 5 - for i := 0; i < n; i++ { - if err := s.SetAttrs(uint64(i), map[string]interface{}{"A": 100, "B": "foo", "C": true, "D": 100.2}); err != nil { - b.Fatal(err) - } - } - - b.ReportAllocs() - b.ResetTimer() - - // Update attributes with an existing subset. - cpuN := runtime.GOMAXPROCS(0) - var wg sync.WaitGroup - errchan := make(chan error) - for i := 0; i < cpuN; i++ { - wg.Add(1) - go func() { - defer wg.Done() - for j := 0; j < b.N/cpuN; j++ { - if err := s.SetAttrs(uint64(j%n), map[string]interface{}{"A": int64(100), "B": "foo", "D": 100.2}); err != nil { - errchan <- err - } - } - }() - } - go func() { - wg.Wait() - close(errchan) - }() - if err := <-errchan; err != nil { - b.Fatal(err) - } -} - -// MustOpenAttrStore returns a new, opened attribute store at a temporary path. Panic on error. -func MustOpenAttrStore(tb testing.TB) pilosa.AttrStore { - s := NewAttrStore(tb) - if err := s.Open(); err != nil { - panic(err) - } - return s -} - -// Close closes the database and removes the underlying data. -func (s *AttrStore) Close() error { - defer os.RemoveAll(s.Path()) - return s.AttrStore.Close() -} diff --git a/boltdb/attrstore.go b/boltdb/attrstore.go deleted file mode 100644 index 7367e31f1..000000000 --- a/boltdb/attrstore.go +++ /dev/null @@ -1,433 +0,0 @@ -// Copyright 2017 Pilosa Corp. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package boltdb - -import ( - "bytes" - "encoding/binary" - "fmt" - "io" - "sort" - "sync" - "time" - - "github.com/cespare/xxhash" - - "github.com/pilosa/pilosa/v2" - "github.com/pkg/errors" - bolt "go.etcd.io/bbolt" -) - -// attrBlockSize is the size of attribute blocks for anti-entropy. -const attrBlockSize = 100 - -// attrCache represents a cache for attributes. -type attrCache struct { - mu sync.RWMutex - attrs map[uint64]map[string]interface{} -} - -// Get returns the cached attributes for a given id. -func (c *attrCache) Get(id uint64) map[string]interface{} { - c.mu.RLock() - defer c.mu.RUnlock() - attrs := c.attrs[id] - if attrs == nil { - return nil - } - - // Make a copy for safety - ret := make(map[string]interface{}) - for k, v := range attrs { - ret[k] = v - } - return ret -} - -// Set updates the cached attributes for a given id. -func (c *attrCache) Set(id uint64, attrs map[string]interface{}) { - c.mu.Lock() - defer c.mu.Unlock() - c.attrs[id] = attrs -} - -// attrStore represents a storage layer for attributes. -type attrStore struct { - mu sync.RWMutex - path string - db *bolt.DB - attrCache *attrCache -} - -// newAttrCache returns a new instance of AttrCache. -func newAttrCache() *attrCache { - return &attrCache{ - attrs: make(map[uint64]map[string]interface{}), - } -} - -// NewAttrStore returns a new instance of AttrStore. -func NewAttrStore(path string) pilosa.AttrStore { - return &attrStore{ - path: path, - attrCache: newAttrCache(), - } -} - -// Path returns path to the store's data file. -func (s *attrStore) Path() string { return s.path } - -// Open opens and initializes the store. -func (s *attrStore) Open() error { - // Open storage. - db, err := bolt.Open(s.path, 0666, &bolt.Options{Timeout: 1 * time.Second}) - if err != nil { - return errors.Wrap(err, "opening storage") - } - s.db = db - - // Initialize database. - if err := s.db.Update(func(tx *bolt.Tx) error { - _, err := tx.CreateBucketIfNotExists([]byte("attrs")) - return err - }); err != nil { - return errors.Wrap(err, "initializing") - } - - return nil -} - -// Close closes the store. -func (s *attrStore) Close() error { - if s.db != nil { - s.db.Close() - } - return nil -} - -// Attrs returns a set of attributes by ID. -func (s *attrStore) Attrs(id uint64) (m map[string]interface{}, err error) { - s.mu.RLock() - defer s.mu.RUnlock() - - // Check cache for map. - if m = s.attrCache.Get(id); m != nil { - return m, nil - } - - // Find attributes from storage. - if err = s.db.View(func(tx *bolt.Tx) error { - m, err = txAttrs(tx, id) - return err - }); err != nil { - return nil, errors.Wrap(err, "finding attributes") - } - - // Add to cache. - s.attrCache.Set(id, m) - - return m, nil -} - -// SetAttrs sets attribute values for a given ID. -func (s *attrStore) SetAttrs(id uint64, m map[string]interface{}) error { - // Ignore empty maps. - if len(m) == 0 { - return nil - } - - // Check if the attributes already exist under a read-only lock. - if attr, err := s.Attrs(id); err != nil { - return errors.Wrap(err, "checking attrs") - } else if attr != nil && mapContains(attr, m) { - return nil - } - - // Obtain write lock. - s.mu.Lock() - defer s.mu.Unlock() - - var attr map[string]interface{} - if err := s.db.Update(func(tx *bolt.Tx) error { - tmp, err := txUpdateAttrs(tx, id, m) - if err != nil { - return err - } - attr = tmp - - return nil - }); err != nil { - return errors.Wrap(err, "updating store") - } - - // Swap attributes map in cache. - s.attrCache.Set(id, attr) - - return nil -} - -// SetBulkAttrs sets attribute values for a set of ids. -func (s *attrStore) SetBulkAttrs(m map[uint64]map[string]interface{}) error { - s.mu.Lock() - defer s.mu.Unlock() - - attrs := make(map[uint64]map[string]interface{}) - if err := s.db.Update(func(tx *bolt.Tx) error { - // Collect and sort keys. - ids := make([]uint64, 0, len(m)) - for id := range m { - ids = append(ids, id) - } - sort.Slice(ids, func(i, j int) bool { return ids[i] < ids[j] }) - - // Update attributes for each id. - for _, id := range ids { - attr, err := txUpdateAttrs(tx, id, m[id]) - if err != nil { - return err - } - attrs[id] = attr - } - - return nil - }); err != nil { - return err - } - - // Swap attributes map in cache. - for id, attr := range attrs { - s.attrCache.Set(id, attr) - } - - return nil -} - -// Blocks returns a list of all blocks in the store. -func (s *attrStore) Blocks() (blocks []pilosa.AttrBlock, err error) { - err = s.db.View(func(tx *bolt.Tx) error { - // Wrap cursor to segment by block. - cur := newBlockCursor(tx.Bucket([]byte("attrs")).Cursor(), attrBlockSize) - - // Iterate over each block. - for cur.nextBlock() { - block := pilosa.AttrBlock{ID: cur.blockID()} - - // Compute checksum of every key/value in block. - h := xxhash.New() - for k, v := cur.next(); k != nil; k, v = cur.next() { - // hash function writes don't usually need to be checked - _, _ = h.Write(k) - _, _ = h.Write(v) - } - block.Checksum = h.Sum(nil) - - // Append block. - blocks = append(blocks, block) - } - return nil - }) - if err != nil { - return nil, errors.Wrap(err, "getting blocks") - } - return blocks, nil -} - -// BlockData returns all data for a single block. -func (s *attrStore) BlockData(i uint64) (m map[uint64]map[string]interface{}, err error) { - m = make(map[uint64]map[string]interface{}) - - // Start read-only transaction. - err = s.db.View(func(tx *bolt.Tx) error { - // Move to the start of the block. - min := u64tob(i * attrBlockSize) - max := u64tob((i + 1) * attrBlockSize) - cur := tx.Bucket([]byte("attrs")).Cursor() - for k, v := cur.Seek(min); k != nil; k, v = cur.Next() { - // Exit if we're past the end of the block. - if bytes.Compare(k, max) != -1 { - break - } - - // Decode attribute map and associate with id. - attrs, err := pilosa.DecodeAttrs(v) - if err != nil { - return errors.Wrap(err, "decoding attrs") - } - m[btou64(k)] = attrs - - } - return nil - }) - if err != nil { - return nil, errors.Wrap(err, "getting block data") - } - return m, nil -} - -// WriteTo writes the underlying database to w. -func (s *attrStore) WriteTo(w io.Writer) (int64, error) { - tx, err := s.db.Begin(false) - if err != nil { - return 0, err - } - defer func() { _ = tx.Rollback() }() - return tx.WriteTo(w) -} - -// txAttrs returns a map of attributes for an id. -func txAttrs(tx *bolt.Tx, id uint64) (map[string]interface{}, error) { - v := tx.Bucket([]byte("attrs")).Get(u64tob(id)) - if v == nil { - return emptyMap, nil - } - return pilosa.DecodeAttrs(v) -} - -// txUpdateAttrs updates the attributes for an id. -// Returns the new combined set of attributes for the id. -func txUpdateAttrs(tx *bolt.Tx, id uint64, m map[string]interface{}) (map[string]interface{}, error) { - attr, err := txAttrs(tx, id) - if err != nil { - return nil, err - } - - // Create a new map if it is empty so we don't update emptyMap. - if len(attr) == 0 { - attr = make(map[string]interface{}, len(m)) - } - - // Merge attributes with original values. - // Nil values should delete keys. - for k, v := range m { - if v == nil { - delete(attr, k) - continue - } - - switch v := v.(type) { - case int: - attr[k] = int64(v) - case uint: - attr[k] = int64(v) - case uint64: - attr[k] = int64(v) - case string, int64, bool, float64: - attr[k] = v - default: - return nil, fmt.Errorf("invalid attr type: %T", v) - } - } - - // Marshal and save new values. - buf, err := pilosa.EncodeAttrs(attr) - if err != nil { - return nil, errors.Wrap(err, "encoding attrs") - } - if err := tx.Bucket([]byte("attrs")).Put(u64tob(id), buf); err != nil { - return nil, errors.Wrap(err, "saving attrs") - } - return attr, nil -} - -// u64tob encodes v to big endian encoding. -func u64tob(v uint64) []byte { - b := make([]byte, 8) - binary.BigEndian.PutUint64(b, v) - return b -} - -// btou64 decodes b from big endian encoding. -func btou64(b []byte) uint64 { return binary.BigEndian.Uint64(b) } - -// emptyMap is a reusable map that contains no keys. -var emptyMap = make(map[string]interface{}) - -// mapContains returns true if all keys & values of subset are in m. -func mapContains(m, subset map[string]interface{}) bool { - for k, v := range subset { - value, ok := m[k] - if !ok || value != v { - return false - } - } - return true -} - -// blockCursor represents a cursor for iterating over blocks of a bolt bucket. -type blockCursor struct { - cur *bolt.Cursor - base uint64 - n uint64 - - buf struct { - key []byte - value []byte - filled bool - } -} - -// newBlockCursor returns a new block cursor that wraps cur using n sized blocks. -func newBlockCursor(c *bolt.Cursor, n int) blockCursor { // nolint: unparam - cur := blockCursor{ - cur: c, - n: uint64(n), - } - cur.buf.key, cur.buf.value = c.First() - cur.buf.filled = true - return cur -} - -// blockID returns the current block ID. Only valid after call to nextBlock(). -func (cur *blockCursor) blockID() uint64 { return cur.base } - -// nextBlock moves the cursor to the next block. -// Returns true if another block exists, otherwise returns false. -func (cur *blockCursor) nextBlock() bool { - if cur.buf.key == nil { - return false - } - - cur.base = binary.BigEndian.Uint64(cur.buf.key) / cur.n - return true -} - -// next returns the next key/value within the block. -// Returns nils at the end of the block. -func (cur *blockCursor) next() (key, value []byte) { - // Use buffered value, if set. - if cur.buf.filled { - key, value = cur.buf.key, cur.buf.value - cur.buf.filled = false - return key, value - } - - // Read next key. - key, value = cur.cur.Next() - - // Fill buffer for EOF. - if key == nil { - cur.buf.key, cur.buf.value, cur.buf.filled = key, value, false - return nil, nil - } - - // Parse key and buffer if outside of block. - id := binary.BigEndian.Uint64(key) - if id/cur.n > cur.base { - cur.buf.key, cur.buf.value, cur.buf.filled = key, value, true - return nil, nil - } - - return key, value -} diff --git a/boltdb/translate.go b/boltdb/translate.go index 6a7156373..714470eb5 100644 --- a/boltdb/translate.go +++ b/boltdb/translate.go @@ -615,3 +615,13 @@ func findKeyByID(bkt *bolt.Bucket, id uint64) string { } return string(boltKey) } + +// u64tob encodes v to big endian encoding. +func u64tob(v uint64) []byte { + b := make([]byte, 8) + binary.BigEndian.PutUint64(b, v) + return b +} + +// btou64 decodes b from big endian encoding. +func btou64(b []byte) uint64 { return binary.BigEndian.Uint64(b) } diff --git a/cache.go b/cache.go index 746934c47..769392baf 100644 --- a/cache.go +++ b/cache.go @@ -580,35 +580,6 @@ func (p uint64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } func (p uint64Slice) Len() int { return len(p) } func (p uint64Slice) Less(i, j int) bool { return p[i] < p[j] } -// merge combines p and other to a unique sorted set of values. -// p and other must both have unique sets and be sorted. -func (p uint64Slice) merge(other []uint64) []uint64 { - ret := make([]uint64, 0, len(p)) - - i, j := 0, 0 - for i < len(p) && j < len(other) { - a, b := p[i], other[j] - if a == b { - ret = append(ret, a) - i, j = i+1, j+1 - } else if a < b { - ret = append(ret, a) - i++ - } else { - ret = append(ret, b) - j++ - } - } - - if i < len(p) { - ret = append(ret, p[i:]...) - } else if j < len(other) { - ret = append(ret, other[j:]...) - } - - return ret -} - // simpleCache implements a bitmap Rowcache. // it is meant to be a short-lived cache for cases where writes are continuing to access // the same row within a short time frame (i.e. good for write-heavy loads) diff --git a/client.go b/client.go index 9985e1342..cbce63d39 100644 --- a/client.go +++ b/client.go @@ -74,20 +74,15 @@ type InternalClient interface { CreateFieldWithOptions(ctx context.Context, index, field string, opt FieldOptions) error FragmentBlocks(ctx context.Context, uri *pnet.URI, index, field, view string, shard uint64) ([]FragmentBlock, error) BlockData(ctx context.Context, uri *pnet.URI, index, field, view string, shard uint64, block int) ([]uint64, []uint64, error) - ColumnAttrDiff(ctx context.Context, uri *pnet.URI, index string, blks []AttrBlock) (map[uint64]map[string]interface{}, error) - RowAttrDiff(ctx context.Context, uri *pnet.URI, index, field string, blks []AttrBlock) (map[uint64]map[string]interface{}, error) SendMessage(ctx context.Context, uri *pnet.URI, msg []byte) error RetrieveShardFromURI(ctx context.Context, index, field, view string, shard uint64, uri pnet.URI) (io.ReadCloser, error) RetrieveTranslatePartitionFromURI(ctx context.Context, index string, partition int, uri pnet.URI) (io.ReadCloser, error) ImportRoaring(ctx context.Context, uri *pnet.URI, index, field string, shard uint64, remote bool, req *ImportRoaringRequest) error - ImportColumnAttrs(ctx context.Context, uri *pnet.URI, index string, req *ImportColumnAttrsRequest) error ShardReader(ctx context.Context, index string, shard uint64) (io.ReadCloser, error) IDAllocDataReader(ctx context.Context) (io.ReadCloser, error) IndexTranslateDataReader(ctx context.Context, index string, partitionID int) (io.ReadCloser, error) - IndexAttrDataReader(ctx context.Context, index string) (io.ReadCloser, error) FieldTranslateDataReader(ctx context.Context, index, field string) (io.ReadCloser, error) - FieldAttrDataReader(ctx context.Context, index, field string) (io.ReadCloser, error) StartTransaction(ctx context.Context, id string, timeout time.Duration, exclusive bool) (*Transaction, error) FinishTransaction(ctx context.Context, id string) (*Transaction, error) @@ -205,10 +200,6 @@ func (n nopInternalClient) ImportRoaring(ctx context.Context, uri *pnet.URI, ind return nil } -func (n nopInternalClient) ImportColumnAttrs(ctx context.Context, uri *pnet.URI, index string, req *ImportColumnAttrsRequest) error { - return nil -} - func (n nopInternalClient) ShardReader(ctx context.Context, index string, shard uint64) (io.ReadCloser, error) { return nil, nil } @@ -221,18 +212,10 @@ func (n nopInternalClient) IndexTranslateDataReader(ctx context.Context, index s return nil, nil } -func (n nopInternalClient) IndexAttrDataReader(ctx context.Context, index string) (io.ReadCloser, error) { - return nil, nil -} - func (n nopInternalClient) FieldTranslateDataReader(ctx context.Context, index, field string) (io.ReadCloser, error) { return nil, nil } -func (n nopInternalClient) FieldAttrDataReader(ctx context.Context, index, field string) (io.ReadCloser, error) { - return nil, nil -} - func (n nopInternalClient) EnsureIndex(ctx context.Context, name string, options IndexOptions) error { return nil } @@ -261,12 +244,6 @@ func (n nopInternalClient) FragmentBlocks(ctx context.Context, uri *pnet.URI, in func (n nopInternalClient) BlockData(ctx context.Context, uri *pnet.URI, index, field, view string, shard uint64, block int) ([]uint64, []uint64, error) { return nil, nil, nil } -func (n nopInternalClient) ColumnAttrDiff(ctx context.Context, uri *pnet.URI, index string, blks []AttrBlock) (map[uint64]map[string]interface{}, error) { - return nil, nil -} -func (n nopInternalClient) RowAttrDiff(ctx context.Context, uri *pnet.URI, index, field string, blks []AttrBlock) (map[uint64]map[string]interface{}, error) { - return nil, nil -} func (n nopInternalClient) SendMessage(ctx context.Context, uri *pnet.URI, msg []byte) error { return nil } diff --git a/client/client.go b/client/client.go index 25c866bb0..c8ad44e3b 100644 --- a/client/client.go +++ b/client/client.go @@ -36,8 +36,8 @@ import ( "github.com/golang/protobuf/proto" //nolint:staticcheck "github.com/opentracing/opentracing-go" "github.com/pilosa/pilosa/v2" - pnet "github.com/pilosa/pilosa/v2/net" "github.com/pilosa/pilosa/v2/logger" + pnet "github.com/pilosa/pilosa/v2/net" "github.com/pilosa/pilosa/v2/pb" "github.com/pilosa/pilosa/v2/pql" "github.com/pilosa/pilosa/v2/roaring" @@ -1318,11 +1318,8 @@ func newHTTPClient(options *ClientOptions) *http.Client { func makeRequestData(query string, options *QueryOptions) ([]byte, error) { request := &pb.QueryRequest{ - Query: query, - Shards: options.Shards, - ColumnAttrs: options.ColumnAttrs, - ExcludeRowAttrs: options.ExcludeRowAttrs, - ExcludeColumns: options.ExcludeColumns, + Query: query, + Shards: options.Shards, } r, err := proto.Marshal(request) if err != nil { @@ -1492,12 +1489,6 @@ func (co *ClientOptions) withDefaults() (updated *ClientOptions) { type QueryOptions struct { // Shards restricts query to a subset of shards. Queries all shards if nil. Shards []uint64 - // ColumnAttrs enables returning columns in the query response. - ColumnAttrs bool - // ExcludeRowAttrs inhibits returning attributes - ExcludeRowAttrs bool - // ExcludeColumns inhibits returning columns - ExcludeColumns bool } func (qo *QueryOptions) addOptions(options ...interface{}) error { @@ -1528,14 +1519,6 @@ func (qo *QueryOptions) addOptions(options ...interface{}) error { // QueryOption is used when using options with a client.Query, type QueryOption func(options *QueryOptions) error -// OptQueryColumnAttrs enables returning column attributes in the result. -func OptQueryColumnAttrs(enable bool) QueryOption { - return func(options *QueryOptions) error { - options.ColumnAttrs = enable - return nil - } -} - // OptQueryShards restricts the set of shards on which a query operates. func OptQueryShards(shards ...uint64) QueryOption { return func(options *QueryOptions) error { @@ -1544,22 +1527,6 @@ func OptQueryShards(shards ...uint64) QueryOption { } } -// OptQueryExcludeAttrs enables discarding attributes from a result, -func OptQueryExcludeAttrs(enable bool) QueryOption { - return func(options *QueryOptions) error { - options.ExcludeRowAttrs = enable - return nil - } -} - -// OptQueryExcludeColumns enables discarding columns from a result, -func OptQueryExcludeColumns(enable bool) QueryOption { - return func(options *QueryOptions) error { - options.ExcludeColumns = enable - return nil - } -} - // ImportOptions are the options for controlling the importer type ImportOptions struct { threadCount int diff --git a/client/client_it_test.go b/client/client_it_test.go index 5fda05def..7c65c1b14 100644 --- a/client/client_it_test.go +++ b/client/client_it_test.go @@ -132,59 +132,6 @@ func TestClientAgainstCluster(t *testing.T) { require.Equalf([]uint64{1, shardWidth * 3}, cols, "Unexpected results: %#v", cols) }) - t.Run("QueryWithColumns", func(t *testing.T) { - setup(t, require, cli) - defer tearDown(t, require, cli) - - targetAttrs := map[string]interface{}{ - "name": "some string", - "age": int64(95), - "registered": true, - "height": 1.83, - } - _, err := cli.Query(testField.Set(1, 100)) - require.NoErrorf(err, "Set(1, 100)") - - resp, err := cli.Query(testIndex.SetColumnAttrs(100, targetAttrs)) - require.NoErrorf(err, "SetColumnAttrs(100, %v)", targetAttrs) - require.Equalf(ColumnItem{}, resp.Column(), "No columns should be returned if it wasn't explicitly requested") - - resp, err = cli.Query(testField.Row(1), &QueryOptions{ColumnAttrs: true}) - require.NoErrorf(err, "Row(1) QueryOptions{ColumnAttrs: true}") - require.Equalf(1, len(resp.ColumnAttrs()), "ColumnAttrs count should be == 1") - - cols := resp.Columns() - require.Equalf(1, len(cols), "Column count") - require.Equalf(uint64(100), cols[0].ID, "Column ID") - - require.Equalf(targetAttrs, cols[0].Attributes, "Column attrs.") - - require.Equalf(cols[0], resp.Column(), "Column() should be equivalent to first column in the response") - }) - - t.Run("SetRowAttrs", func(t *testing.T) { - setup(t, require, cli) - defer tearDown(t, require, cli) - - targetAttrs := map[string]interface{}{ - "name": "some string", - "age": int64(95), - "registered": true, - "height": 1.83, - } - - _, err := cli.Query(testField.Set(1, 100)) - require.NoErrorf(err, "Set(1, 100)") - - _, err = cli.Query(testField.SetRowAttrs(1, targetAttrs)) - require.NoErrorf(err, "SetRowAttrs(1, %v)", targetAttrs) - - resp, err := cli.Query(testField.Row(1), &QueryOptions{ColumnAttrs: true}) - require.NoErrorf(err, "Row(1) QueryOptions{ColumnAttrs: true}") - - require.Equalf(targetAttrs, resp.Result().Row().Attributes, "Row attributes should be set") - }) - t.Run("OrmCount", func(t *testing.T) { setup(t, require, cli) defer tearDown(t, require, cli) @@ -278,19 +225,6 @@ func TestClientAgainstCluster(t *testing.T) { item := items[0] require.Equalf(uint64(10), item.ID, "TopN result item[0].ID") require.Equalf(uint64(3), item.Count, "TopN result item[0].Count") - - _, err = cli.Query(testFieldTopN.SetRowAttrs(10, map[string]interface{}{"foo": "bar"})) - require.NoErrorf(err, "SetRowAttrs(10)") - - resp, err = cli.Query(testFieldTopN.FilterAttrTopN(5, nil, "foo", "bar")) - require.NoErrorf(err, `FilterAttrTopN(5, nil, "foo", "bar")`) - - items = resp.Result().CountItems() - require.Equalf(1, len(items), "FilterAttrTopN result CountItems") - - item = items[0] - require.Equalf(uint64(10), item.ID, "FilterAttrTopN result item[0].ID") - require.Equalf(uint64(3), item.Count, "FilterAttrTopN result item[0].Count") }) t.Run("MinMaxRow", func(t *testing.T) { @@ -575,8 +509,7 @@ func TestClientAgainstCluster(t *testing.T) { uri, _ := pnet.NewURIFromAddress("does-not-resolve.foo.bar") tmpcli, _ := NewClient(NewClusterWithHost(uri, uri, uri, uri), OptClientRetries(0)) - attrs := map[string]interface{}{"a": 1} - _, err := tmpcli.Query(testIndex.SetColumnAttrs(0, attrs)) + _, err := tmpcli.Query(testIndex.All()) require.Error(err, ErrTriedMaxHosts) }) diff --git a/client/client_test.go b/client/client_test.go index 0833b7739..1353b789b 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -30,8 +30,7 @@ func TestQueryWithError(t *testing.T) { var err error client := DefaultClient() index := NewIndex("foo") - field := index.Field("foo") - invalid := field.FilterAttrTopN(12, field.Row(7), "$invalid$", 80, 81) + invalid := NewPQLRowQuery("", index, errors.New("invalid")) _, err = client.Query(invalid, nil) if err == nil { t.Fatalf("Should have failed") @@ -207,76 +206,6 @@ func ClientOptionErr(int) ClientOption { } } -func TestQueryOptions(t *testing.T) { - targets := []*QueryOptions{ - {ColumnAttrs: true}, - {ColumnAttrs: false}, - {ExcludeRowAttrs: true}, - {ExcludeRowAttrs: false}, - {ExcludeColumns: true}, - {ExcludeColumns: false}, - } - - optionsList := [][]interface{}{ - {OptQueryColumnAttrs(true)}, - {OptQueryColumnAttrs(false)}, - {OptQueryExcludeAttrs(true)}, - {OptQueryExcludeAttrs(false)}, - {OptQueryExcludeColumns(true)}, - {OptQueryExcludeColumns(false)}, - } - - for i := 0; i < len(targets); i++ { - options := &QueryOptions{} - err := options.addOptions(optionsList[i]...) - if err != nil { - t.Fatal(err) - } - target := targets[i] - if !reflect.DeepEqual(target, options) { - t.Fatalf("%v != %v", target, options) - } - } - - target := &QueryOptions{ - ColumnAttrs: true, - ExcludeRowAttrs: true, - ExcludeColumns: true, - } - options := &QueryOptions{} - err := options.addOptions(&QueryOptions{ - ColumnAttrs: true, - ExcludeRowAttrs: true, - ExcludeColumns: true, - }) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(target, options) { - t.Fatalf("%v != %v", target, options) - } -} - -func TestQueryOptionsWithError(t *testing.T) { - options := &QueryOptions{} - err := options.addOptions(1) - if err == nil { - t.Fatalf("should have failed") - } - err = options.addOptions(OptQueryColumnAttrs(true), nil) - if err == nil { - t.Fatalf("should have failed") - } - err = options.addOptions(OptQueryColumnAttrs(true), &QueryOptions{}) - if err == nil { - t.Fatalf("should have failed") - } - err = options.addOptions(QueryOptionErr(0)) - if err == nil { - t.Fatalf("should have failed") - } -} - func TestQueryOptionsError(t *testing.T) { client := DefaultClient() index := NewIndex("foo") diff --git a/client/docs/data-model-queries.md b/client/docs/data-model-queries.md index 9e88f7781..5ddcd572f 100644 --- a/client/docs/data-model-queries.md +++ b/client/docs/data-model-queries.md @@ -124,7 +124,6 @@ Index: * `Xor(rows ...*PQLRowQuery) *PQLRowQuery` * `Not(row) *PQLRowQuery` * `Count(row *PQLRowQuery) *PQLBaseQuery` -* `SetColumnAttrs(columnID uint64, attrs map[string]interface{}) *PQLBaseQuery` * `Options(row *PQLRowQuery, opts ...OptionsOption) *PQLBaseQuery` Field: @@ -135,10 +134,8 @@ Field: * `Clear(rowID uint64, columnID uint64) *PQLBaseQuery` * `TopN(n uint64) *PQLRowQuery` * `RowTopN(n uint64, row *PQLRowQuery) *PQLRowQuery` -* `FilterFieldTopN(n uint64, row *PQLRowQuery, field string, values ...interface{}) *PQLRowQuery` * `Range(rowID uint64, start time.Time, end time.Time) *PQLRowQuery` * `RowRange(rowID uint64, start time.Time, end time.Time) *PQLRowQuery` -* `SetRowAttrs(rowID uint64, attrs map[string]interface{}) *PQLBaseQuery` * `ClearRow(rowIDOrKey interface{}) *PQLBaseQuery` * `Store(row *PQLRowQuery, rowIDOrKey interface{}) *PQLBaseQuery` * `LT(n int) *PQLRowQuery` diff --git a/client/docs/server-interaction.md b/client/docs/server-interaction.md index a713c30c3..74ea5aacb 100644 --- a/client/docs/server-interaction.md +++ b/client/docs/server-interaction.md @@ -101,12 +101,6 @@ You can send queries to a Pilosa server using the `Query` function of the `Clien response, err := cli.Query(field.Row(5)); ``` -`Query` accepts zero or more options: - -```go -response, err := cli.Query(field.Row(5), pilosa.ColumnAttrs(true), pilosa.ExcludeColumns(true)) -``` - ## Server Response When a query is sent to a Pilosa server, the server either fulfills the query or sends an error message. In the case of an error, a `pilosa.Error` struct is returned, otherwise a `QueryResponse` struct is returned. @@ -131,17 +125,6 @@ for _, result := range response.Results() { } ``` -Similarly, a `QueryResponse` struct may include a number of column attributes if `ColumnAttrs` query option was set to `true`: - -```go -var column *pilosa.ColumnItem - -// iterate over all columns -for _, column = range response.ColumnAttrs() { - // Act on the column item -} -``` - `QueryResult` objects contain: * `Row()` function to retrieve a row result, @@ -153,7 +136,6 @@ for _, column = range response.ColumnAttrs() { ```go row := result.Row() columns := row.Columns -attributes := row.Attributes countItems := result.CountItems() diff --git a/client/orm.go b/client/orm.go index f8b0d3222..d8ad25ca1 100644 --- a/client/orm.go +++ b/client/orm.go @@ -21,7 +21,6 @@ import ( "encoding/json" "fmt" "math" - "sort" "strconv" "strings" "sync" @@ -343,51 +342,24 @@ func OptIndexTrackExistence(trackExistence bool) IndexOption { // OptionsOptions is used to pass an option to Option call. type OptionsOptions struct { - columnAttrs bool - excludeColumns bool - excludeRowAttrs bool - shards []uint64 + shards []uint64 } func (oo OptionsOptions) marshal() string { - part1 := fmt.Sprintf("columnAttrs=%s,excludeColumns=%s,excludeRowAttrs=%s", - strconv.FormatBool(oo.columnAttrs), - strconv.FormatBool(oo.excludeColumns), - strconv.FormatBool(oo.excludeRowAttrs)) if oo.shards != nil { shardsStr := make([]string, len(oo.shards)) for i, shard := range oo.shards { shardsStr[i] = strconv.FormatUint(shard, 10) } - return fmt.Sprintf("%s,shards=[%s]", part1, strings.Join(shardsStr, ",")) + return fmt.Sprintf("shards=[%s]", strings.Join(shardsStr, ",")) } - return part1 + + return "" } // OptionsOption is an option for Index.Options call. type OptionsOption func(options *OptionsOptions) -// OptOptionsColumnAttrs enables returning column attributes. -func OptOptionsColumnAttrs(enable bool) OptionsOption { - return func(options *OptionsOptions) { - options.columnAttrs = enable - } -} - -// OptOptionsExcludeColumns enables preventing returning columns. -func OptOptionsExcludeColumns(enable bool) OptionsOption { - return func(options *OptionsOptions) { - options.excludeColumns = enable - } -} - -// OptOptionsExcludeRowAttrs enables preventing returning row attributes. -func OptOptionsExcludeRowAttrs(enable bool) OptionsOption { - return func(options *OptionsOptions) { - options.excludeRowAttrs = enable - } -} - // OptOptionsShards run the query using only the data from the given shards. // By default, the entire data set (i.e. data from all shards) is used. func OptOptionsShards(shards ...uint64) OptionsOption { @@ -397,7 +369,7 @@ func OptOptionsShards(shards ...uint64) OptionsOption { } // Index is a Pilosa index. The purpose of the Index is to represent a data namespace. -// You cannot perform cross-index queries. Column-level attributes are global to the Index. +// You cannot perform cross-index queries. type Index struct { mu sync.RWMutex name string @@ -582,22 +554,6 @@ func (idx *Index) All() *PQLRowQuery { // TODO: impelement AllLimit(limit, offset uint64) *PQLRowQuery -// SetColumnAttrs creates a SetColumnAttrs query. -// SetColumnAttrs associates arbitrary key/value pairs with a column in an index. -// Following types are accepted: integer, float, string and boolean types. -func (idx *Index) SetColumnAttrs(colIDOrKey interface{}, attrs map[string]interface{}) *PQLBaseQuery { - colStr, err := formatIDKey(colIDOrKey) - if err != nil { - return NewPQLBaseQuery("", idx, err) - } - attrsString, err := createAttributesString(attrs) - if err != nil { - return NewPQLBaseQuery("", idx, err) - } - q := fmt.Sprintf("SetColumnAttrs(%s,%s)", colStr, attrsString) - return NewPQLBaseQuery(q, idx, nil) -} - // Options creates an Options query. func (idx *Index) Options(row *PQLRowQuery, opts ...OptionsOption) *PQLBaseQuery { oo := &OptionsOptions{} @@ -1053,7 +1009,6 @@ func OptFieldForeignIndex(index string) FieldOption { // Field structs are used to segment and define different functional characteristics within your entire index. // You can think of a Field as a table-like data partition within your Index. -// Row-level attributes are namespaced at the Field level. type Field struct { name string createdAt int64 @@ -1096,7 +1051,6 @@ func (f *Field) copy() *Field { // Row creates a Row query. // Row retrieves the indices of all the set columns in a row. -// It also retrieves any attributes set on that row or column. func (f *Field) Row(rowIDOrKey interface{}) *PQLRowQuery { rowStr, err := formatIDKeyBool(rowIDOrKey) if err != nil { @@ -1174,32 +1128,6 @@ func (f *Field) RowTopN(n uint64, row *PQLRowQuery) *PQLRowQuery { return q } -// FilterAttrTopN creates a TopN query with the given item count, row, attribute name and filter values for that field -// The attrName and attrValues arguments work together to only return Rows which have the attribute specified by attrName with one of the values specified in attrValues. -func (f *Field) FilterAttrTopN(n uint64, row *PQLRowQuery, attrName string, attrValues ...interface{}) *PQLRowQuery { - return f.filterAttrTopN(n, row, attrName, attrValues...) -} - -func (f *Field) filterAttrTopN(n uint64, row *PQLRowQuery, field string, values ...interface{}) *PQLRowQuery { - if err := validateLabel(field); err != nil { - return NewPQLRowQuery("", f.index, err) - } - b, err := json.Marshal(values) - if err != nil { - return NewPQLRowQuery("", f.index, err) - } - var q *PQLRowQuery - if row == nil { - q = NewPQLRowQuery(fmt.Sprintf("TopN(%s,n=%d,attrName='%s',attrValues=%s)", - f.name, n, field, string(b)), f.index, nil) - } else { - serializedRow := row.serialize() - q = NewPQLRowQuery(fmt.Sprintf("TopN(%s,%s,n=%d,attrName='%s',attrValues=%s)", - f.name, serializedRow.String(), n, field, string(b)), f.index, nil) - } - return q -} - // Range creates a Range query. // Similar to Row, but only returns columns which were set with timestamps between the given start and end timestamps. // *Deprecated at Pilosa 1.3* @@ -1226,24 +1154,6 @@ func (f *Field) RowRange(rowIDOrKey interface{}, start time.Time, end time.Time) return q } -// SetRowAttrs creates a SetRowAttrs query. -// SetRowAttrs associates arbitrary key/value pairs with a row in a field. -// Following types are accepted: integer, float, string and boolean types. -func (f *Field) SetRowAttrs(rowIDOrKey interface{}, attrs map[string]interface{}) *PQLBaseQuery { - rowStr, err := formatIDKeyBool(rowIDOrKey) - if err != nil { - return NewPQLBaseQuery("", f.index, err) - } - attrsString, err := createAttributesString(attrs) - if err != nil { - return NewPQLBaseQuery("", f.index, err) - } - text := fmt.Sprintf("SetRowAttrs(%s,%s,%s)", f.name, rowStr, attrsString) - q := NewPQLBaseQuery(text, f.index, nil) - q.hasKeys = f.options.keys || f.index.options.keys - return q -} - // Store creates a Store call. // Store writes the result of the row query to the specified row. If the row already exists, it will be replaced. The destination field must be of field type set. func (f *Field) Store(row *PQLRowQuery, rowIDOrKey interface{}) *PQLBaseQuery { @@ -1254,23 +1164,6 @@ func (f *Field) Store(row *PQLRowQuery, rowIDOrKey interface{}) *PQLBaseQuery { return NewPQLBaseQuery(fmt.Sprintf("Store(%s,%s=%s)", row.serialize().String(), f.name, rowStr), f.index, nil) } -func createAttributesString(attrs map[string]interface{}) (string, error) { - attrsList := make([]string, 0, len(attrs)) - for k, v := range attrs { - // TODO: validate the type of v is one of string, int64, float64, bool - if err := validateLabel(k); err != nil { - return "", err - } - if vs, ok := v.(string); ok { - attrsList = append(attrsList, fmt.Sprintf("%s=%s", k, strconv.Quote(vs))) - } else { - attrsList = append(attrsList, fmt.Sprintf("%s=%v", k, v)) - } - } - sort.Strings(attrsList) - return strings.Join(attrsList, ","), nil -} - func formatIDKey(idKey interface{}) (string, error) { switch v := idKey.(type) { case uint: diff --git a/client/orm_test.go b/client/orm_test.go index b77621258..7a6076d2e 100644 --- a/client/orm_test.go +++ b/client/orm_test.go @@ -398,12 +398,6 @@ func TestORM(t *testing.T) { comparePQL(t, "TopN(collaboration,Row(collaboration=3),n=10)", collabField.RowTopN(10, collabField.Row(3))) - comparePQL(t, - "TopN(sample-field,Row(collaboration=7),n=12,attrName='category',attrValues=[80,81])", - sampleField.FilterAttrTopN(12, collabField.Row(7), "category", 80, 81)) - comparePQL(t, - "TopN(sample-field,n=12,attrName='category',attrValues=[80,81])", - sampleField.FilterAttrTopN(12, nil, "category", 80, 81)) }) t.Run("FieldLT", func(t *testing.T) { @@ -511,22 +505,8 @@ func TestORM(t *testing.T) { } }) - t.Run("FilterFieldTopNInvalidField", func(t *testing.T) { - q := sampleField.FilterAttrTopN(12, collabField.Row(7), "$invalid$", 80, 81) - if q.Error() == nil { - t.Fatalf("should have failed") - } - }) - - t.Run("FilterFieldTopNInvalidValue", func(t *testing.T) { - q := sampleField.FilterAttrTopN(12, collabField.Row(7), "category", 80, func() {}) - if q.Error() == nil { - t.Fatalf("should have failed") - } - }) - t.Run("RowOperationInvalidArg", func(t *testing.T) { - invalid := sampleField.FilterAttrTopN(12, collabField.Row(7), "$invalid$", 80, 81) + invalid := NewPQLRowQuery("", sampleIndex, errors.New("invalid")) // invalid argument in pos 1 q := sampleIndex.Union(invalid, b1) if q.Error() == nil { @@ -560,64 +540,6 @@ func TestORM(t *testing.T) { } }) - t.Run("SetColumnAttrs", func(t *testing.T) { - attrs := map[string]interface{}{ - "quote": "\"Don't worry, be happy\"", - "happy": true, - } - comparePQL(t, - "SetColumnAttrs(5,happy=true,quote=\"\\\"Don't worry, be happy\\\"\")", - projectIndex.SetColumnAttrs(5, attrs)) - - q := projectIndex.SetColumnAttrs(false, attrs) - if q.err == nil { - t.Fatalf("should have failed") - } - }) - - t.Run("SetColumnAttrsInvalidAttr", func(t *testing.T) { - attrs := map[string]interface{}{ - "color": "blue", - "$invalid$": true, - } - if projectIndex.SetColumnAttrs(5, attrs).Error() == nil { - t.Fatalf("Should have failed") - } - }) - - t.Run("SetRowAttrs", func(t *testing.T) { - attrs := map[string]interface{}{ - "quote": "\"Don't worry, be happy\"", - "active": true, - } - comparePQL(t, - `SetRowAttrs(collaboration,5,active=true,quote="\"Don't worry, be happy\"")`, - collabField.SetRowAttrs(5, attrs)) - - comparePQL(t, - "SetRowAttrs(collaboration,'foo',active=true,quote=\"\\\"Don't worry, be happy\\\"\")", - collabField.SetRowAttrs("foo", attrs)) - - q := collabField.SetRowAttrs(nil, attrs) - if q.err == nil { - t.Fatalf("should have failed") - } - }) - - t.Run("SetRowAttrsInvalidAttr", func(t *testing.T) { - attrs := map[string]interface{}{ - "color": "blue", - "$invalid$": true, - } - if collabField.SetRowAttrs(5, attrs).Error() == nil { - t.Fatalf("Should have failed") - } - - if collabField.SetRowAttrs("foo", attrs).Error() == nil { - t.Fatalf("Should have failed") - } - }) - t.Run("Store", func(t *testing.T) { comparePQL(t, "Store(Row(collaboration=5),sample-field=10)", @@ -630,18 +552,10 @@ func TestORM(t *testing.T) { t.Run("Options", func(t *testing.T) { comparePQL(t, - "Options(Row(collaboration=5),columnAttrs=true,excludeColumns=true,excludeRowAttrs=true,shards=[1,3])", + "Options(Row(collaboration=5),shards=[1,3])", sampleIndex.Options(collabField.Row(5), - OptOptionsColumnAttrs(true), - OptOptionsExcludeColumns(true), - OptOptionsExcludeRowAttrs(true), OptOptionsShards(1, 3), )) - comparePQL(t, - "Options(Row(collaboration=5),columnAttrs=true,excludeColumns=false,excludeRowAttrs=false)", - sampleIndex.Options(collabField.Row(5), - OptOptionsColumnAttrs(true), - )) }) t.Run("BatchQuery", func(t *testing.T) { @@ -664,7 +578,7 @@ func TestORM(t *testing.T) { t.Run("BatchQueryWithError", func(t *testing.T) { q := sampleIndex.BatchQuery() - q.Add(sampleField.FilterAttrTopN(12, collabField.Row(7), "$invalid$", 80, 81)) + q.Add(NewPQLBaseQuery("", nil, errors.New("invalid"))) if q.Error() == nil { t.Fatalf("The error must be set") } diff --git a/client/response.go b/client/response.go index 0ec9382ee..0e7ba1f54 100644 --- a/client/response.go +++ b/client/response.go @@ -19,7 +19,6 @@ package client import ( "encoding/json" - "errors" "fmt" "github.com/pilosa/pilosa/v2/pb" @@ -45,7 +44,6 @@ const ( // QueryResponse represents the response from a Pilosa query. type QueryResponse struct { ResultList []QueryResult `json:"results,omitempty"` - ColumnList []ColumnItem `json:"columns,omitempty"` ErrorMessage string `json:"error-message,omitempty"` Success bool `json:"success,omitempty"` } @@ -65,18 +63,9 @@ func newQueryResponseFromInternal(response *pb.QueryResponse) (*QueryResponse, e } results = append(results, result) } - columns := make([]ColumnItem, 0, len(response.ColumnAttrSets)) - for _, p := range response.ColumnAttrSets { - columnItem, err := newColumnItemFromInternal(p) - if err != nil { - return nil, err - } - columns = append(columns, columnItem) - } return &QueryResponse{ ResultList: results, - ColumnList: columns, Success: true, }, nil } @@ -94,26 +83,6 @@ func (qr *QueryResponse) Result() QueryResult { return qr.ResultList[0] } -// Columns returns all column attributes in the response. -// *DEPRECATED* -func (qr *QueryResponse) Columns() []ColumnItem { - return qr.ColumnList -} - -// Column returns the attributes for first column. -// *DEPRECATED* -func (qr *QueryResponse) Column() ColumnItem { - if len(qr.ColumnList) == 0 { - return ColumnItem{} - } - return qr.ColumnList[0] -} - -// ColumnAttrs returns all column attributes in the response. -func (qr *QueryResponse) ColumnAttrs() []ColumnItem { - return qr.ColumnList -} - // QueryResult represents one of the results in the response. type QueryResult interface { Type() uint32 @@ -256,22 +225,15 @@ func (TopNResult) RowIdentifiers() RowIdentifiersResult { return RowIdentifiersR // RowResult represents a result from Row, Union, Intersect, Difference and Range PQL calls. type RowResult struct { - Attributes map[string]interface{} `json:"attrs"` - Columns []uint64 `json:"columns"` - Keys []string `json:"keys"` + Columns []uint64 `json:"columns"` + Keys []string `json:"keys"` } func newRowResultFromInternal(row *pb.Row) (*RowResult, error) { - attrs, err := convertInternalAttrsToMap(row.Attrs) - if err != nil { - return nil, err - } - result := &RowResult{ - Attributes: attrs, - Columns: row.Columns, - Keys: row.Keys, - } - return result, nil + return &RowResult{ + Columns: row.Columns, + Keys: row.Keys, + }, nil } // Type is the type of this result. @@ -312,13 +274,11 @@ func (b RowResult) MarshalJSON() ([]byte, error) { keys = []string{} } return json.Marshal(struct { - Attributes map[string]interface{} `json:"attrs"` - Columns []uint64 `json:"columns"` - Keys []string `json:"keys"` + Columns []uint64 `json:"columns"` + Keys []string `json:"keys"` }{ - Attributes: b.Attributes, - Columns: columns, - Keys: keys, + Columns: columns, + Keys: keys, }) } @@ -415,7 +375,7 @@ func (BoolResult) GroupCounts() []GroupCount { return nil } // RowIdentifiers returns the result of a Rows call. func (BoolResult) RowIdentifiers() RowIdentifiersResult { return RowIdentifiersResult{} } -// NilResult is returned from calls which don't return a value, such as SetRowAttrs. +// NilResult is returned from calls which don't return a value. type NilResult struct{} // Type is the type of this result. @@ -546,50 +506,3 @@ func groupCountsFromInternal(items *pb.GroupCounts) GroupCountResult { } return GroupCountResult(result) } - -const ( - stringType = 1 - intType = 2 - boolType = 3 - floatType = 4 -) - -func convertInternalAttrsToMap(attrs []*pb.Attr) (attrsMap map[string]interface{}, err error) { - attrsMap = make(map[string]interface{}, len(attrs)) - for _, attr := range attrs { - switch attr.Type { - case stringType: - attrsMap[attr.Key] = attr.StringValue - case intType: - attrsMap[attr.Key] = attr.IntValue - case boolType: - attrsMap[attr.Key] = attr.BoolValue - case floatType: - attrsMap[attr.Key] = attr.FloatValue - default: - return nil, errors.New("Unknown attribute type") - } - } - - return attrsMap, nil -} - -// ColumnItem represents data about a column. -// Column data is only returned if QueryOptions.Columns was set to true. -type ColumnItem struct { - ID uint64 `json:"id,omitempty"` - Key string `json:"key,omitempty"` - Attributes map[string]interface{} `json:"attributes,omitempty"` -} - -func newColumnItemFromInternal(column *pb.ColumnAttrSet) (ColumnItem, error) { - attrs, err := convertInternalAttrsToMap(column.Attrs) - if err != nil { - return ColumnItem{}, err - } - return ColumnItem{ - ID: column.ID, - Key: column.Key, - Attributes: attrs, - }, nil -} diff --git a/client/response_test.go b/client/response_test.go index 12efdf533..7511173c5 100644 --- a/client/response_test.go +++ b/client/response_test.go @@ -28,55 +28,25 @@ import ( ) func TestNewRowResultFromInternal(t *testing.T) { - targetAttrs := map[string]interface{}{ - "name": "some string", - "age": int64(95), - "registered": true, - "height": 1.83, - } targetColumns := []uint64{5, 10} - attrs := []*pb.Attr{ - {Key: "name", StringValue: "some string", Type: 1}, - {Key: "age", IntValue: 95, Type: 2}, - {Key: "registered", BoolValue: true, Type: 3}, - {Key: "height", FloatValue: 1.83, Type: 4}, - } row := &pb.Row{ - Attrs: attrs, Columns: []uint64{5, 10}, } result, err := newRowResultFromInternal(row) if err != nil { t.Fatalf("Failed with error: %s", err) } - // assertMapEquals(t, targetAttrs, result.Attributes) - if !reflect.DeepEqual(targetAttrs, result.Attributes) { - t.Fatal() - } if !reflect.DeepEqual(targetColumns, result.Columns) { t.Fatal() } } func TestNewQueryResponseFromInternal(t *testing.T) { - targetAttrs := map[string]interface{}{ - "name": "some string", - "age": int64(95), - "registered": true, - "height": 1.83, - } targetColumns := []uint64{5, 10} targetCountItems := []CountResultItem{ {ID: 10, Count: 100}, } - attrs := []*pb.Attr{ - {Key: "name", StringValue: "some string", Type: 1}, - {Key: "age", IntValue: 95, Type: 2}, - {Key: "registered", BoolValue: true, Type: 3}, - {Key: "height", FloatValue: 1.83, Type: 4}, - } row := &pb.Row{ - Attrs: attrs, Columns: []uint64{5, 10}, } pairs := []*pb.Pair{ @@ -107,9 +77,6 @@ func TestNewQueryResponseFromInternal(t *testing.T) { if results[0] != qr.Result() { t.Fatalf("Result() should return the first result") } - if !reflect.DeepEqual(targetAttrs, results[0].Row().Attributes) { - t.Fatalf("The row result should contain the attributes") - } if !reflect.DeepEqual(targetColumns, results[0].Row().Columns) { t.Fatalf("The row result should contain the columns") } @@ -137,29 +104,6 @@ func TestNewQueryResponseWithErrorFromInternal(t *testing.T) { } } -func TestNewQueryResponseFromInternalFailure(t *testing.T) { - attrs := []*pb.Attr{ - {Key: "name", StringValue: "some string", Type: 99}, - } - row := &pb.Row{ - Attrs: attrs, - } - response := &pb.QueryResponse{ - Results: []*pb.QueryResult{{Type: QueryResultTypeRow, Row: row}}, - } - qr, err := newQueryResponseFromInternal(response) - if qr != nil && err == nil { - t.Fatalf("Should have failed") - } - response = &pb.QueryResponse{ - ColumnAttrSets: []*pb.ColumnAttrSet{{ID: 1, Attrs: attrs}}, - } - qr, err = newQueryResponseFromInternal(response) - if qr != nil && err == nil { - t.Fatalf("Should have failed") - } -} - func TestCountResultItemToString(t *testing.T) { tests := []struct { item *CountResultItem @@ -182,14 +126,7 @@ func TestCountResultItemToString(t *testing.T) { } func TestMarshalResults(t *testing.T) { - attrs := []*pb.Attr{ - {Key: "name", StringValue: "some string", Type: 1}, - {Key: "age", IntValue: 95, Type: 2}, - {Key: "registered", BoolValue: true, Type: 3}, - {Key: "height", FloatValue: 1.83, Type: 4}, - } row := &pb.Row{ - Attrs: attrs, Columns: []uint64{5, 10}, } pairs := []*pb.Pair{ @@ -212,7 +149,7 @@ func TestMarshalResults(t *testing.T) { resultJSONStrings[i] = string(b) } targetJSON := []string{ - `{"attrs":{"age":95,"height":1.83,"name":"some string","registered":true},"columns":[5,10],"keys":[]}`, + `{"columns":[5,10],"keys":[]}`, `[{"id":10,"count":100}]`, } for i := range targetJSON { diff --git a/ctl/backup.go b/ctl/backup.go index d92316b2f..9351589b3 100644 --- a/ctl/backup.go +++ b/ctl/backup.go @@ -198,18 +198,12 @@ func (cmd *BackupCommand) backupIndex(ctx context.Context, tw *tar.Writer, ii *p if err := cmd.backupIndexTranslateData(ctx, tw, ii.Name); err != nil { return err } - if err := cmd.backupIndexAttrData(ctx, tw, ii.Name); err != nil { - return err - } - // Back up field translation & attribute data. + // Back up field translation data. for _, fi := range ii.Fields { if err := cmd.backupFieldTranslateData(ctx, tw, ii.Name, fi.Name); err != nil { return fmt.Errorf("cannot backup field translation data for field %q on index %q: %w", fi.Name, ii.Name, err) } - if err := cmd.backupFieldAttrData(ctx, tw, ii.Name, fi.Name); err != nil { - return fmt.Errorf("cannot backup field attr data for field %q on index %q: %w", fi.Name, ii.Name, err) - } } return nil @@ -294,36 +288,6 @@ func (cmd *BackupCommand) backupIndexPartitionTranslateData(ctx context.Context, return nil } -func (cmd *BackupCommand) backupIndexAttrData(ctx context.Context, tw *tar.Writer, name string) error { - logger := cmd.Logger() - logger.Printf("backing up index attr data: %s", name) - - rc, err := cmd.client.IndexAttrDataReader(ctx, name) - if err != nil { - return fmt.Errorf("fetching index attr data reader: %w", err) - } - defer rc.Close() - - // Read to buffer to determine size. - var buf bytes.Buffer - if _, err := buf.ReadFrom(rc); err != nil { - return fmt.Errorf("copying index attr data to memory: %w", err) - } - - // Build header & copy data to archive. - if err = tw.WriteHeader(&tar.Header{ - Name: path.Join("indexes", name, "attributes"), - Mode: 0666, - Size: int64(buf.Len()), - ModTime: time.Now(), - }); err != nil { - return err - } else if _, err := io.Copy(tw, &buf); err != nil { - return fmt.Errorf("copying index attr data to archive: %w", err) - } - return nil -} - func (cmd *BackupCommand) backupFieldTranslateData(ctx context.Context, tw *tar.Writer, indexName, fieldName string) error { logger := cmd.Logger() logger.Printf("backing up field translation data: %s/%s", indexName, fieldName) @@ -356,36 +320,6 @@ func (cmd *BackupCommand) backupFieldTranslateData(ctx context.Context, tw *tar. return nil } -func (cmd *BackupCommand) backupFieldAttrData(ctx context.Context, tw *tar.Writer, indexName, fieldName string) error { - logger := cmd.Logger() - logger.Printf("backing up field attr data: %s/%s", indexName, fieldName) - - rc, err := cmd.client.FieldAttrDataReader(ctx, indexName, fieldName) - if err != nil { - return fmt.Errorf("fetching field attr data reader: %w", err) - } - defer rc.Close() - - // Read to buffer to determine size. - var buf bytes.Buffer - if _, err := buf.ReadFrom(rc); err != nil { - return fmt.Errorf("copying field attr data to memory: %w", err) - } - - // Build header & copy data to archive. - if err = tw.WriteHeader(&tar.Header{ - Name: path.Join("indexes", indexName, "fields", fieldName, "attributes"), - Mode: 0666, - Size: int64(buf.Len()), - ModTime: time.Now(), - }); err != nil { - return err - } else if _, err := io.Copy(tw, &buf); err != nil { - return fmt.Errorf("copying field attr data to archive: %w", err) - } - return nil -} - func (cmd *BackupCommand) TLSHost() string { return cmd.Host } func (cmd *BackupCommand) TLSConfiguration() server.TLSConfig { return cmd.TLS } diff --git a/encoding/proto/proto.go b/encoding/proto/proto.go index 008e3f3dc..33c05fe50 100644 --- a/encoding/proto/proto.go +++ b/encoding/proto/proto.go @@ -16,7 +16,6 @@ package proto import ( "fmt" - "sort" "time" "github.com/gogo/protobuf/proto" @@ -227,14 +226,6 @@ func (s Serializer) Unmarshal(buf []byte, m pilosa.Message) error { } s.decodeImportRoaringRequest(msg, mt) return nil - case *pilosa.ImportColumnAttrsRequest: - msg := &pb.ImportColumnAttrsRequest{} - err := proto.Unmarshal(buf, msg) - if err != nil { - return errors.Wrap(err, "unmarshaling ImportColumnAttrsRequest") - } - s.decodeImportColumnAttrsRequest(msg, mt) - return nil case *pilosa.ImportResponse: msg := &pb.ImportResponse{} err := proto.Unmarshal(buf, msg) @@ -385,8 +376,6 @@ func (s Serializer) encodeToProto(m pilosa.Message) proto.Message { return s.encodeImportValueRequest(mt) case *pilosa.ImportRoaringRequest: return s.encodeImportRoaringRequest(mt) - case *pilosa.ImportColumnAttrsRequest: - return s.encodeImportColumnAttrsRequest(mt) case *pilosa.ImportResponse: return s.encodeImportResponse(mt) case *pilosa.BlockDataRequest: @@ -488,27 +477,13 @@ func (s Serializer) encodeImportRoaringRequest(m *pilosa.ImportRoaringRequest) * } } -func (s Serializer) encodeImportColumnAttrsRequest(m *pilosa.ImportColumnAttrsRequest) *pb.ImportColumnAttrsRequest { - return &pb.ImportColumnAttrsRequest{ - Index: m.Index, - IndexCreatedAt: m.IndexCreatedAt, - Shard: m.Shard, - AttrKey: m.AttrKey, - AttrVals: m.AttrVals, - ColumnIDs: m.ColumnIDs, - } -} - func (s Serializer) encodeQueryRequest(m *pilosa.QueryRequest) *pb.QueryRequest { r := &pb.QueryRequest{ - Query: m.Query, - Shards: m.Shards, - ColumnAttrs: m.ColumnAttrs, - Remote: m.Remote, - ExcludeRowAttrs: m.ExcludeRowAttrs, - ExcludeColumns: m.ExcludeColumns, - PreTranslated: m.PreTranslated, - EmbeddedData: make([]*pb.Row, len(m.EmbeddedData)), + Query: m.Query, + Shards: m.Shards, + Remote: m.Remote, + PreTranslated: m.PreTranslated, + EmbeddedData: make([]*pb.Row, len(m.EmbeddedData)), } for i := range m.EmbeddedData { r.EmbeddedData[i] = s.encodeRow(m.EmbeddedData[i]) @@ -518,8 +493,7 @@ func (s Serializer) encodeQueryRequest(m *pilosa.QueryRequest) *pb.QueryRequest func (s Serializer) encodeQueryResponse(m *pilosa.QueryResponse) *pb.QueryResponse { resp := &pb.QueryResponse{ - Results: make([]*pb.QueryResult, len(m.Results)), - ColumnAttrSets: s.encodeColumnAttrSets(m.ColumnAttrSets), + Results: make([]*pb.QueryResult, len(m.Results)), } for i := range m.Results { @@ -1209,10 +1183,7 @@ func (s Serializer) decodeLoadSchemaMessage(pb *pb.LoadSchemaMessage, m *pilosa. func (s Serializer) decodeQueryRequest(pb *pb.QueryRequest, m *pilosa.QueryRequest) { m.Query = pb.Query m.Shards = pb.Shards - m.ColumnAttrs = pb.ColumnAttrs m.Remote = pb.Remote - m.ExcludeRowAttrs = pb.ExcludeRowAttrs - m.ExcludeColumns = pb.ExcludeColumns m.EmbeddedData = make([]*pilosa.Row, len(pb.EmbeddedData)) m.PreTranslated = pb.PreTranslated for i := range pb.EmbeddedData { @@ -1262,15 +1233,6 @@ func (s Serializer) decodeImportRoaringRequest(pb *pb.ImportRoaringRequest, m *p m.UpdateExistence = pb.UpdateExistence } -func (s Serializer) decodeImportColumnAttrsRequest(pb *pb.ImportColumnAttrsRequest, m *pilosa.ImportColumnAttrsRequest) { - m.Index = pb.Index - m.IndexCreatedAt = pb.IndexCreatedAt - m.Shard = pb.Shard - m.AttrKey = pb.AttrKey - m.AttrVals = pb.AttrVals - m.ColumnIDs = pb.ColumnIDs -} - func (s Serializer) decodeImportResponse(pb *pb.ImportResponse, m *pilosa.ImportResponse) { m.Err = pb.Err } @@ -1289,8 +1251,6 @@ func (s Serializer) decodeBlockDataResponse(pb *pb.BlockDataResponse, m *pilosa. } func (s Serializer) decodeQueryResponse(pb *pb.QueryResponse, m *pilosa.QueryResponse) { - m.ColumnAttrSets = make([]*pilosa.ColumnAttrSet, len(pb.ColumnAttrSets)) - s.decodeColumnAttrSets(pb.ColumnAttrSets, m.ColumnAttrSets) if pb.Err == "" { m.Err = nil } else { @@ -1300,19 +1260,6 @@ func (s Serializer) decodeQueryResponse(pb *pb.QueryResponse, m *pilosa.QueryRes s.decodeQueryResults(pb.Results, m.Results) } -func (s Serializer) decodeColumnAttrSets(pb []*pb.ColumnAttrSet, m []*pilosa.ColumnAttrSet) { - for i := range pb { - m[i] = &pilosa.ColumnAttrSet{} - s.decodeColumnAttrSet(pb[i], m[i]) - } -} - -func (s Serializer) decodeColumnAttrSet(pb *pb.ColumnAttrSet, m *pilosa.ColumnAttrSet) { - m.ID = pb.ID - m.Key = pb.Key - m.Attrs = s.decodeAttrs(pb.Attrs) -} - func (s Serializer) decodeQueryResults(pb []*pb.QueryResult, m []interface{}) { for i := range pb { m[i] = s.decodeQueryResult(pb[i]) @@ -1457,7 +1404,6 @@ func (s Serializer) decodeRow(pr *pb.Row) *pilosa.Row { r.SetBit(v) } } - r.Attrs = s.decodeAttrs(pr.Attrs) r.Keys = pr.Keys r.Index = pr.Index r.Field = pr.Field @@ -1476,37 +1422,6 @@ func (s Serializer) decodeSignedRow(pr *pb.SignedRow) pilosa.SignedRow { return r } -func (s Serializer) decodeAttrs(pb []*pb.Attr) map[string]interface{} { - m := make(map[string]interface{}, len(pb)) - for i := range pb { - key, value := s.decodeAttr(pb[i]) - m[key] = value - } - return m -} - -const ( - attrTypeString = 1 - attrTypeInt = 2 - attrTypeBool = 3 - attrTypeFloat = 4 -) - -func (s Serializer) decodeAttr(attr *pb.Attr) (key string, value interface{}) { - switch attr.Type { - case attrTypeString: - return attr.Key, attr.StringValue - case attrTypeInt: - return attr.Key, attr.IntValue - case attrTypeBool: - return attr.Key, attr.BoolValue - case attrTypeFloat: - return attr.Key, attr.FloatValue - default: - return attr.Key, nil - } -} - func (s Serializer) decodeExtractedIDMatrix(m *pb.ExtractedIDMatrix) pilosa.ExtractedIDMatrix { cols := make([]pilosa.ExtractedIDColumn, len(m.Columns)) for i, c := range m.Columns { @@ -1682,22 +1597,6 @@ func (s Serializer) decodeDecimalStruct(pb *pb.Decimal) *pql.Decimal { } } -func (s Serializer) encodeColumnAttrSets(a []*pilosa.ColumnAttrSet) []*pb.ColumnAttrSet { - other := make([]*pb.ColumnAttrSet, len(a)) - for i := range a { - other[i] = s.encodeColumnAttrSet(a[i]) - } - return other -} - -func (s Serializer) encodeColumnAttrSet(set *pilosa.ColumnAttrSet) *pb.ColumnAttrSet { - return &pb.ColumnAttrSet{ - ID: set.ID, - Key: set.Key, - Attrs: s.encodeAttrs(set.Attrs), - } -} - func (s Serializer) encodeSignedRow(r pilosa.SignedRow) *pb.SignedRow { ir := &pb.SignedRow{ Pos: s.encodeRow(r.Pos), @@ -1713,7 +1612,6 @@ func (s Serializer) encodeRow(r *pilosa.Row) *pb.Row { ir := &pb.Row{ Keys: r.Keys, - Attrs: s.encodeAttrs(r.Attrs), Index: r.Index, Field: r.Field, } @@ -1729,7 +1627,6 @@ func (s Serializer) encodeRowIdentifiers(r pilosa.RowIdentifiers) *pb.RowIdentif return &pb.RowIdentifiers{ Rows: r.Rows, Keys: r.Keys, - //Attrs: s.encodeAttrs(r.Attrs), } } @@ -1911,43 +1808,6 @@ func (s Serializer) encodeDecimal(p *pql.Decimal) *pb.Decimal { } } -func (s Serializer) encodeAttrs(m map[string]interface{}) []*pb.Attr { - keys := make([]string, 0, len(m)) - for k := range m { - keys = append(keys, k) - } - sort.Strings(keys) - - a := make([]*pb.Attr, len(keys)) - for i := range keys { - a[i] = s.encodeAttr(keys[i], m[keys[i]]) - } - return a -} - -// s.encodeAttr converts a key/value pair into an Attr pb.representation. -func (s Serializer) encodeAttr(key string, value interface{}) *pb.Attr { - pb := &pb.Attr{Key: key} - switch value := value.(type) { - case string: - pb.Type = attrTypeString - pb.StringValue = value - case float64: - pb.Type = attrTypeFloat - pb.FloatValue = value - case uint64: - pb.Type = attrTypeInt - pb.IntValue = int64(value) - case int64: - pb.Type = attrTypeInt - pb.IntValue = value - case bool: - pb.Type = attrTypeBool - pb.BoolValue = value - } - return pb -} - func (s Serializer) encodeResizeNodeMessage(m *pilosa.ResizeNodeMessage) *pb.ResizeNodeMessage { return &pb.ResizeNodeMessage{ NodeID: m.NodeID, diff --git a/executor.go b/executor.go index f37c23172..6f963e94f 100644 --- a/executor.go +++ b/executor.go @@ -221,44 +221,6 @@ func (e *executor) Execute(ctx context.Context, index string, q *pql.Query, shar } resp.Results = results - // Fill column attributes if requested. - if opt.ColumnAttrs { - // Consolidate all column ids across all calls. - var columnIDs []uint64 - for _, result := range results { - bm, ok := result.(*Row) - if !ok { - continue - } - columnIDs = uint64Slice(columnIDs).merge(bm.Columns()) - } - - // Retrieve column attributes across all calls. - columnAttrSets, err := e.readColumnAttrSets(e.Holder.Index(index), columnIDs) - if err != nil { - return resp, errors.Wrap(err, "reading column attrs") - } - - // Translate column attributes, if necessary. - if idx.Keys() { - idSet := make(map[uint64]struct{}) - for _, col := range columnAttrSets { - idSet[col.ID] = struct{}{} - } - - idMap, err := e.Cluster.translateIndexIDSet(ctx, index, idSet) - if err != nil { - return resp, errors.Wrap(err, "translating id set") - } - - for _, col := range columnAttrSets { - col.Key, col.ID = idMap[col.ID], 0 - } - } - - resp.ColumnAttrSets = columnAttrSets - } - // Translate response objects from ids to keys, if necessary. // No need to translate a remote call. if !opt.Remote { @@ -293,10 +255,8 @@ func (e *executor) Execute(ctx context.Context, index string, q *pql.Query, shar // to avoid anything coming from the mmap-ed Tx storage. func (e *executor) safeCopy(resp QueryResponse) (out QueryResponse) { out = QueryResponse{ - // not transactional, from attribute storage so no need to clone these: - ColumnAttrSets: resp.ColumnAttrSets, // []*ColumnAttrSet - Err: resp.Err, // error - Profile: resp.Profile, // *tracing.Profile + Err: resp.Err, // error + Profile: resp.Profile, // *tracing.Profile } // Results can contain *roaring.Bitmap, so need to copy from Tx mmap-ed memory. for _, v := range resp.Results { @@ -355,29 +315,6 @@ func (e *executor) safeCopy(resp QueryResponse) (out QueryResponse) { return } -// readColumnAttrSets returns a list of column attribute objects by id. -func (e *executor) readColumnAttrSets(index *Index, ids []uint64) ([]*ColumnAttrSet, error) { - if index == nil { - return nil, nil - } - - ax := make([]*ColumnAttrSet, 0, len(ids)) - for _, id := range ids { - // Read attributes for column. Skip column if empty. - attrs, err := index.ColumnAttrStore().Attrs(id) - if err != nil { - return nil, errors.Wrap(err, "getting attrs") - } else if len(attrs) == 0 { - continue - } - - // Append column with attributes. - ax = append(ax, &ColumnAttrSet{ID: id, Attrs: attrs}) - } - - return ax, nil -} - // handlePreCalls traverses the call tree looking for calls that need // precomputed values (e.g. Distinct, UnionRows, ConstRow...). func (e *executor) handlePreCalls(ctx context.Context, qcx *Qcx, index string, c *pql.Call, shards []uint64, opt *execOptions) error { @@ -538,11 +475,6 @@ func (e *executor) execute(ctx context.Context, qcx *Qcx, index string, q *pql.Q } } - // Optimize handling for bulk attribute insertion. - if hasOnlySetRowAttrs(q.Calls) { - return e.executeBulkSetRowAttrs(ctx, qcx, index, q.Calls, opt, colTranslations, rowTranslations) - } - // Execute each call serially. results := make([]interface{}, 0, len(q.Calls)) for i, call := range q.Calls { @@ -784,12 +716,6 @@ func (e *executor) executeCall(ctx context.Context, qcx *Qcx, index string, c *p statFn() res, err := e.executeSet(ctx, qcx, index, c, opt) return res, errors.Wrapf(err, "executeSet %v", shardSlice(shards)) - case "SetRowAttrs": - statFn() - return nil, errors.Wrap(e.executeSetRowAttrs(ctx, qcx, index, c, opt), "executeSetRowAttrs") - case "SetColumnAttrs": - statFn() - return nil, errors.Wrap(e.executeSetColumnAttrs(ctx, qcx, index, c, opt), "executeSetColumnAttrs") case "TopK": statFn() res, err := e.executeTopK(ctx, qcx, index, c, shards, opt) @@ -876,27 +802,6 @@ func (e *executor) executeOptionsCall(ctx context.Context, qcx *Qcx, index strin optCopy := &execOptions{} *optCopy = *opt - if arg, ok := c.Args["columnAttrs"]; ok { - if value, ok := arg.(bool); ok { - opt.ColumnAttrs = value - } else { - return nil, errors.New("Query(): columnAttrs must be a bool") - } - } - if arg, ok := c.Args["excludeRowAttrs"]; ok { - if value, ok := arg.(bool); ok { - optCopy.ExcludeRowAttrs = value - } else { - return nil, errors.New("Query(): excludeRowAttrs must be a bool") - } - } - if arg, ok := c.Args["excludeColumns"]; ok { - if value, ok := arg.(bool); ok { - optCopy.ExcludeColumns = value - } else { - return nil, errors.New("Query(): excludeColumns must be a bool") - } - } if arg, ok := c.Args["shards"]; ok { if optShards, ok := arg.([]interface{}); ok { shards = []uint64{} @@ -1560,46 +1465,7 @@ func (e *executor) executeBitmapCall(ctx context.Context, qcx *Qcx, index string return nil, errors.Wrap(err, "map reduce") } - // Attach attributes for non-BSI Row() calls. - // If the column label is used then return column attributes. - // If the row label is used then return bitmap attributes. row, _ := other.(*Row) - if c.Name == "Row" && !c.HasConditionArg() { - if opt.ExcludeRowAttrs { - row.Attrs = map[string]interface{}{} - } else { - idx := e.Holder.Index(index) - if idx != nil { - if columnID, ok, err := c.UintArg("_" + columnLabel); ok && err == nil { - attrs, err := idx.ColumnAttrStore().Attrs(columnID) - if err != nil { - return nil, errors.Wrap(err, "getting column attrs") - } - row.Attrs = attrs - } else if err != nil { - return nil, err - } else { - // field, _ := c.Args["field"].(string) - fieldName, _ := c.FieldArg() - if fr := idx.Field(fieldName); fr != nil { - rowID, _, err := c.UintArg(fieldName) - if err != nil { - return nil, errors.Wrap(err, "getting row") - } - attrs, err := fr.RowAttrStore().Attrs(rowID) - if err != nil { - return nil, errors.Wrap(err, "getting row attrs") - } - row.Attrs = attrs - } - } - } - } - } - - if opt.ExcludeColumns { - row.segments = []rowSegment{} - } return row, nil } @@ -2630,7 +2496,6 @@ func (e *executor) executeTopNShard(ctx context.Context, qcx *Qcx, index string, return nil, fmt.Errorf("cannot compute TopN() on integer, decimal, or timestamp field: %q", fieldName) } - attrName, _ := c.Args["attrName"].(string) rowIDs, _, err := c.UintSliceArg("ids") if err != nil { return nil, fmt.Errorf("executeTopNShard: %v", err) @@ -2639,7 +2504,6 @@ func (e *executor) executeTopNShard(ctx context.Context, qcx *Qcx, index string, if err != nil { return nil, fmt.Errorf("executeTopNShard: %v", err) } - attrValues, _ := c.Args["attrValues"].([]interface{}) tanimotoThreshold, _, err := c.UintArg("tanimotoThreshold") if err != nil { return nil, fmt.Errorf("executeTopNShard: %v", err) @@ -2688,8 +2552,6 @@ func (e *executor) executeTopNShard(ctx context.Context, qcx *Qcx, index string, N: int(n), Src: src, RowIDs: rowIDs, - FilterName: attrName, - FilterValues: attrValues, MinThreshold: minThreshold, TanimotoThreshold: tanimotoThreshold, }) @@ -5650,229 +5512,6 @@ func (e *executor) executeClearValueField(ctx context.Context, qcx *Qcx, index s return ret, nil } -// executeSetRowAttrs executes a SetRowAttrs() call. -func (e *executor) executeSetRowAttrs(ctx context.Context, qcx *Qcx, index string, c *pql.Call, opt *execOptions) error { - span, ctx := tracing.StartSpanFromContext(ctx, "Executor.executeSetRowAttrs") - defer span.Finish() - - fieldName, ok := c.Args["_field"].(string) - if !ok { - return errors.New("SetRowAttrs() field required") - } - - // Retrieve field. - field := e.Holder.Field(index, fieldName) - if field == nil { - return newNotFoundError(ErrFieldNotFound, fieldName) - } - - // Parse labels. - rowID, ok, err := c.UintArg("_" + rowLabel) - if err != nil { - return fmt.Errorf("reading SetRowAttrs() row: %v", err) - } else if !ok { - return fmt.Errorf("SetRowAttrs() row field '%v' required", rowLabel) - } - - // Copy args and remove reserved fields. - attrs := pql.CopyArgsDecimalToFloat(c.Args) - delete(attrs, "_field") - delete(attrs, "_"+rowLabel) - - // Set attributes. - if err := field.RowAttrStore().SetAttrs(rowID, attrs); err != nil { - return err - } - - // Do not forward call if this is already being forwarded. - if opt.Remote { - return nil - } - - // Execute on remote nodes in parallel. - nodes := topology.Nodes(e.Cluster.noder.Nodes()).FilterID(e.Node.ID) - resp := make(chan error, len(nodes)) - for _, node := range nodes { - go func(node *topology.Node) { - _, err := e.remoteExec(ctx, node, index, &pql.Query{Calls: []*pql.Call{c}}, nil, nil) - resp <- err - }(node) - } - - // Return first error. - for range nodes { - if err := <-resp; err != nil { - return err - } - } - - return nil -} - -// executeBulkSetRowAttrs executes a set of SetRowAttrs() calls. -func (e *executor) executeBulkSetRowAttrs(ctx context.Context, qcx *Qcx, index string, calls []*pql.Call, opt *execOptions, colTranslations map[string]map[string]uint64, rowTranslations map[string]map[string]map[string]uint64) ([]interface{}, error) { - span, ctx := tracing.StartSpanFromContext(ctx, "Executor.executeBulkSetRowAttrs") - defer span.Finish() - - // Collect attributes by field/id. - m := make(map[string]map[uint64]map[string]interface{}) - for i, c := range calls { - if i%10 == 0 { - if err := validateQueryContext(ctx); err != nil { - return nil, err - } - } - - // Apply call translation. - if !opt.Remote { - translated, err := e.translateCall(c, index, colTranslations, rowTranslations) - if err != nil { - return nil, errors.Wrap(err, "translating call") - } - if translated == nil { - continue - } - - c = translated - } - - field, ok := c.Args["_field"].(string) - if !ok { - return nil, errors.New("SetRowAttrs() field required") - } - - // Retrieve field. - f := e.Holder.Field(index, field) - if f == nil { - return nil, newNotFoundError(ErrFieldNotFound, field) - } - - rowID, ok, err := c.UintArg("_" + rowLabel) - if err != nil { - return nil, errors.Wrap(err, "reading SetRowAttrs() row") - } else if !ok { - return nil, fmt.Errorf("SetRowAttrs row field '%v' required", rowLabel) - } - - // Copy args and remove reserved fields. - attrs := pql.CopyArgsDecimalToFloat(c.Args) - delete(attrs, "_field") - delete(attrs, "_"+rowLabel) - - // Create field group, if not exists. - fieldMap := m[field] - if fieldMap == nil { - fieldMap = make(map[uint64]map[string]interface{}) - m[field] = fieldMap - } - - // Set or merge attributes. - attr := fieldMap[rowID] - if attr == nil { - fieldMap[rowID] = cloneAttrs(attrs) - } else { - for k, v := range attrs { - attr[k] = v - } - } - } - - // Bulk insert attributes by field. - for name, fieldMap := range m { - // Retrieve field. - field := e.Holder.Field(index, name) - if field == nil { - return nil, newNotFoundError(ErrFieldNotFound, name) - } - - // Set attributes. - if err := field.RowAttrStore().SetBulkAttrs(fieldMap); err != nil { - return nil, err - } - } - - if !opt.Remote { - tags := []string{"index:" + index, "bulk:true"} - e.Holder.Stats.CountWithCustomTags(MetricSetRowAttrs, int64(len(m)), 1.0, tags) - } - - // Do not forward call if this is already being forwarded. - if opt.Remote { - return make([]interface{}, len(calls)), nil - } - - // Execute on remote nodes in parallel. - nodes := topology.Nodes(e.Cluster.noder.Nodes()).FilterID(e.Node.ID) - resp := make(chan error, len(nodes)) - for _, node := range nodes { - go func(node *topology.Node) { - _, err := e.remoteExec(ctx, node, index, &pql.Query{Calls: calls}, nil, nil) - resp <- err - }(node) - } - - // Return first error. - for range nodes { - if err := <-resp; err != nil { - return nil, err - } - } - - // Return a set of nil responses to match the non-optimized return. - return make([]interface{}, len(calls)), nil -} - -// executeSetColumnAttrs executes a SetColumnAttrs() call. -func (e *executor) executeSetColumnAttrs(ctx context.Context, qcx *Qcx, index string, c *pql.Call, opt *execOptions) error { - span, ctx := tracing.StartSpanFromContext(ctx, "Executor.executeSetColumnAttrs") - defer span.Finish() - - // Retrieve index. - idx := e.Holder.Index(index) - if idx == nil { - return newNotFoundError(ErrIndexNotFound, index) - } - - col, okCol, errCol := c.UintArg("_" + columnLabel) - if errCol != nil || !okCol { - return fmt.Errorf("reading SetColumnAttrs() col errs: %v found %v", errCol, okCol) - } - - // Copy args and remove reserved fields. - attrs := pql.CopyArgsDecimalToFloat(c.Args) - delete(attrs, "_"+columnLabel) - delete(attrs, "field") - - // Set attributes. - - if err := idx.ColumnAttrStore().SetAttrs(col, attrs); err != nil { - return err - } - // Do not forward call if this is already being forwarded. - if opt.Remote { - return nil - } - - // Execute on remote nodes in parallel. - nodes := topology.Nodes(e.Cluster.noder.Nodes()).FilterID(e.Node.ID) - resp := make(chan error, len(nodes)) - for _, node := range nodes { - go func(node *topology.Node) { - _, err := e.remoteExec(ctx, node, index, &pql.Query{Calls: []*pql.Call{c}}, nil, nil) - resp <- err - }(node) - } - - // Return first error. - for range nodes { - if err := <-resp; err != nil { - return err - } - } - - return nil -} - // remoteExec executes a PQL query remotely for a set of shards on a node. func (e *executor) remoteExec(ctx context.Context, node *topology.Node, index string, q *pql.Query, shards []uint64, embed []*Row) (results []interface{}, err error) { // nolint: interfacer span, ctx := tracing.StartSpanFromContext(ctx, "Executor.executeExec") @@ -6367,7 +6006,7 @@ func (e *executor) collectCallKeys(dst *keyCollector, c *pql.Call, index string) // Handle _col. if col, ok := c.Args["_col"].(string); ok { switch c.Name { - case "Set", "SetColumnAttrs": + case "Set": dst.CreateColumns(index, col) default: dst.FindColumns(index, col) @@ -6385,12 +6024,7 @@ func (e *executor) collectCallKeys(dst *keyCollector, c *pql.Call, index string) return errors.Wrap(ErrFieldNotFound, "finding field for _row argument") } - switch c.Name { - case "SetRowAttrs": - dst.CreateRows(index, field, row) - default: - dst.FindRows(index, field, row) - } + dst.FindRows(index, field, row) } // Handle queries that need a "column" argument. @@ -6700,7 +6334,7 @@ func (e *executor) translateCall(c *pql.Call, index string, columnKeys map[strin c.Args["_col"] = id } else { switch c.Name { - case "Set", "SetColumnAttrs": + case "Set": return nil, errors.Wrapf(ErrTranslatingKeyNotFound, "destination key not found %q in index %q", col, index) default: return e.callZero(c), nil @@ -6736,12 +6370,7 @@ func (e *executor) translateCall(c *pql.Call, index string, columnKeys map[strin if translation, ok := indexRows[field][row]; ok { c.Args["_row"] = translation } else { - switch c.Name { - case "SetRowAttrs": - return nil, errors.Errorf("row key missing in %q", c.String()) - default: - return e.callZero(c), nil - } + return e.callZero(c), nil } } } @@ -7023,7 +6652,7 @@ func (e *executor) translateResult(ctx context.Context, index string, idx *Index } switch strategy { case byCurrentIndex: - other := &Row{Attrs: result.Attrs} + other := &Row{} for _, segment := range result.Segments() { for _, col := range segment.Columns() { other.Keys = append(other.Keys, idSet[col]) @@ -7081,7 +6710,7 @@ func (e *executor) translateResult(ctx context.Context, index string, idx *Index if rslt == nil { return &SignedRow{Pos: &Row{}}, nil } - other := &Row{Attrs: rslt.Attrs} + other := &Row{} for _, segment := range rslt.Segments() { keys, err := e.Cluster.translateIndexIDs(context.Background(), field.ForeignIndex(), segment.Columns()) if err != nil { @@ -7514,27 +7143,10 @@ type mapResponse struct { // execOptions represents an execution context for a single Execute() call. type execOptions struct { - Remote bool - Profile bool - ExcludeRowAttrs bool - ExcludeColumns bool - ColumnAttrs bool - PreTranslated bool - EmbeddedData []*Row -} - -// hasOnlySetRowAttrs returns true if calls only contains SetRowAttrs() calls. -func hasOnlySetRowAttrs(calls []*pql.Call) bool { - if len(calls) == 0 { - return false - } - - for _, call := range calls { - if call.Name != "SetRowAttrs" { - return false - } - } - return true + Remote bool + Profile bool + PreTranslated bool + EmbeddedData []*Row } func needsShards(calls []*pql.Call) bool { @@ -7543,7 +7155,7 @@ func needsShards(calls []*pql.Call) bool { } for _, call := range calls { switch call.Name { - case "Clear", "Set", "SetRowAttrs", "SetColumnAttrs": + case "Clear", "Set": continue case "Count", "TopN", "Rows": return true diff --git a/executor_test.go b/executor_test.go index a823108c3..329bafcc8 100644 --- a/executor_test.go +++ b/executor_test.go @@ -82,33 +82,11 @@ func TestExecutor(t *testing.T) { fmt.Sprintf("Set(%d, f=%d)\n", 3, 10) + fmt.Sprintf("Set(%d, f=%d)\n", ShardWidth+1, 10) + fmt.Sprintf("Set(%d, f=%d)\n", ShardWidth+1, 20) + - `SetRowAttrs(f, 10, foo="bar", baz=123)` + - `Set(1000, f=100)` + - `SetColumnAttrs(1000, foo="bar", baz=123)` - readQueries := []string{ - `Row(f=10)`, - `Options(Row(f=10), excludeColumns=true)`, - `Options(Row(f=10), excludeRowAttrs=true)`, - } + `Set(1000, f=100)` + readQueries := []string{`Row(f=10)`} responses := runCallTest(c, t, writeQuery, readQueries, nil) if bits := responses[0].Results[0].(*pilosa.Row).Columns(); !reflect.DeepEqual(bits, []uint64{3, ShardWidth + 1}) { t.Fatalf("unexpected columns: %+v", bits) - } else if attrs := responses[0].Results[0].(*pilosa.Row).Attrs; !reflect.DeepEqual(attrs, map[string]interface{}{"foo": "bar", "baz": int64(123)}) { - t.Fatalf("unexpected attrs: %s", spew.Sdump(attrs)) - } - - // Inhibit column attributes. - if columns := responses[1].Results[0].(*pilosa.Row).Columns(); !reflect.DeepEqual(columns, []uint64{}) { - t.Fatalf("unexpected columns: %+v", columns) - } else if attrs := responses[1].Results[0].(*pilosa.Row).Attrs; !reflect.DeepEqual(attrs, map[string]interface{}{"foo": "bar", "baz": int64(123)}) { - t.Fatalf("unexpected attrs: %s", spew.Sdump(attrs)) - } - - // Inhibit row attributes. - if columns := responses[2].Results[0].(*pilosa.Row).Columns(); !reflect.DeepEqual(columns, []uint64{3, ShardWidth + 1}) { - t.Fatalf("unexpected columns: %+v", columns) - } else if attrs := responses[2].Results[0].(*pilosa.Row).Attrs; !reflect.DeepEqual(attrs, map[string]interface{}{}) { - t.Fatalf("unexpected attrs: %s", spew.Sdump(attrs)) } }) @@ -147,7 +125,7 @@ func TestExecutor(t *testing.T) { &pilosa.IndexOptions{Keys: true}, pilosa.OptFieldKeys()) if diff := cmp.Diff(responses[0].Results, []interface{}{ - &pilosa.Row{Keys: []string{"bat", "foo"}, Attrs: map[string]interface{}{}}, + &pilosa.Row{Keys: []string{"bat", "foo"}}, }, cmpopts.IgnoreUnexported(pilosa.Row{})); diff != "" { t.Fatal(diff) } @@ -844,92 +822,6 @@ func TestExecutor(t *testing.T) { }) t.Run("Options", func(t *testing.T) { - t.Run("excludeRowAttrs", func(t *testing.T) { - writeQuery := ` - Set(100, f=10) - SetRowAttrs(f, 10, foo="bar")` - readQueries := []string{`Options(Row(f=10), excludeRowAttrs=true)`} - responses := runCallTest(c, t, writeQuery, readQueries, nil) - if bits := responses[0].Results[0].(*pilosa.Row).Columns(); !reflect.DeepEqual(bits, []uint64{100}) { - t.Fatalf("unexpected columns: %+v", bits) - } else if attrs := responses[0].Results[0].(*pilosa.Row).Attrs; !reflect.DeepEqual(attrs, map[string]interface{}{}) { - t.Fatalf("unexpected attrs: %s", spew.Sdump(attrs)) - } - }) - - t.Run("excludeColumns", func(t *testing.T) { - writeQuery := ` - Set(100, f=10) - SetRowAttrs(f, 10, foo="bar")` - readQueries := []string{`Options(Row(f=10), excludeColumns=true)`} - responses := runCallTest(c, t, writeQuery, readQueries, nil) - if bits := responses[0].Results[0].(*pilosa.Row).Columns(); !reflect.DeepEqual(bits, []uint64{}) { - t.Fatalf("unexpected columns: %+v", bits) - } else if attrs := responses[0].Results[0].(*pilosa.Row).Attrs; !reflect.DeepEqual(attrs, map[string]interface{}{"foo": "bar"}) { - t.Fatalf("unexpected attrs: %s", spew.Sdump(attrs)) - } - }) - - t.Run("columnAttrs", func(t *testing.T) { - writeQuery := ` - Set(0, f=10) - SetColumnAttrs(0, foo="baz") - Set(100, f=10) - SetColumnAttrs(100, foo="bar")` - readQueries := []string{`Options(Row(f=10), columnAttrs=true)`} - responses := runCallTest(c, t, writeQuery, readQueries, nil) - targetColAttrSets := []*pilosa.ColumnAttrSet{ - {ID: 0, Attrs: map[string]interface{}{"foo": "baz"}}, - {ID: 100, Attrs: map[string]interface{}{"foo": "bar"}}, - } - - targetJSON := `[{"id":0,"attrs":{"foo":"baz"}},{"id":100,"attrs":{"foo":"bar"}}]` - - if bits := responses[0].Results[0].(*pilosa.Row).Columns(); !reflect.DeepEqual(bits, []uint64{0, 100}) { - t.Fatalf("unexpected columns: %+v", bits) - } else if attrs := responses[0].ColumnAttrSets; !reflect.DeepEqual(attrs, targetColAttrSets) { - t.Fatalf("unexpected attrs: %s", spew.Sdump(attrs)) - } else { - // Ensure the JSON is marshaled correctly. - jres, err := json.Marshal(attrs) - if err != nil { - t.Fatal(err) - } else if string(jres) != targetJSON { - t.Fatalf("json marshal expected: %s, but got: %s", targetJSON, jres) - } - } - }) - - t.Run("columnAttrsWithKeys", func(t *testing.T) { - writeQuery := ` - Set("one-hundred", f="ten") - SetColumnAttrs("one-hundred", foo="bar")` - readQueries := []string{`Options(Row(f="ten"), columnAttrs=true)`} - responses := runCallTest(c, t, writeQuery, readQueries, - &pilosa.IndexOptions{Keys: true}, - pilosa.OptFieldKeys()) - - targetColAttrSets := []*pilosa.ColumnAttrSet{ - {Key: "one-hundred", Attrs: map[string]interface{}{"foo": "bar"}}, - } - - targetJSON := `[{"key":"one-hundred","attrs":{"foo":"bar"}}]` - - if keys := responses[0].Results[0].(*pilosa.Row).Keys; !reflect.DeepEqual(keys, []string{"one-hundred"}) { - t.Fatalf("unexpected keys: %+v", keys) - } else if attrs := responses[0].ColumnAttrSets; !reflect.DeepEqual(attrs, targetColAttrSets) { - t.Fatalf("unexpected attrs: %s", spew.Sdump(attrs)) - } else { - // Ensure the JSON is marshaled correctly. - jres, err := json.Marshal(attrs) - if err != nil { - t.Fatal(err) - } else if string(jres) != targetJSON { - t.Fatalf("json marshal expected: %s, but got: %s", targetJSON, jres) - } - } - }) - t.Run("shards", func(t *testing.T) { writeQuery := fmt.Sprintf(` Set(100, f=10) @@ -941,26 +833,6 @@ func TestExecutor(t *testing.T) { t.Fatalf("unexpected columns: %+v", bits) } }) - - t.Run("multipleOpt", func(t *testing.T) { - writeQuery := ` - Set(100, f=10) - SetRowAttrs(f, 10, foo="bar")` - readQueries := []string{ - `Options(Row(f=10), excludeColumns=true) - Options(Row(f=10), excludeRowAttrs=true)`, - } - responses := runCallTest(c, t, writeQuery, readQueries, nil) - if bits := responses[0].Results[0].(*pilosa.Row).Columns(); !reflect.DeepEqual(bits, []uint64{}) { - t.Fatalf("unexpected columns: %+v", bits) - } else if attrs := responses[0].Results[0].(*pilosa.Row).Attrs; !reflect.DeepEqual(attrs, map[string]interface{}{"foo": "bar"}) { - t.Fatalf("unexpected attrs: %s", spew.Sdump(attrs)) - } else if bits := responses[0].Results[1].(*pilosa.Row).Columns(); !reflect.DeepEqual(bits, []uint64{100}) { - t.Fatalf("unexpected columns: %+v", bits) - } else if attrs := responses[0].Results[1].(*pilosa.Row).Attrs; !reflect.DeepEqual(attrs, map[string]interface{}{}) { - t.Fatalf("unexpected attrs: %s", spew.Sdump(attrs)) - } - }) }) t.Run("Not", func(t *testing.T) { @@ -1816,66 +1688,6 @@ func TestExecutor_Execute_SetValue(t *testing.T) { } -// Ensure a SetRowAttrs() query can be executed. -func TestExecutor_Execute_SetRowAttrs(t *testing.T) { - c := test.MustRunCluster(t, 1) - defer c.Close() - hldr := c.GetHolder(0) - - // Create fields. - index := hldr.MustCreateIndexIfNotExists("i", pilosa.IndexOptions{}) - if _, err := index.CreateFieldIfNotExists("f", pilosa.OptFieldTypeDefault()); err != nil { - t.Fatal(err) - } else if _, err := index.CreateFieldIfNotExists("xxx", pilosa.OptFieldTypeDefault()); err != nil { - t.Fatal(err) - } else if _, err := index.CreateFieldIfNotExists("kf", pilosa.OptFieldTypeDefault(), pilosa.OptFieldKeys()); err != nil { - t.Fatal(err) - } - t.Run("rowID", func(t *testing.T) { - // Set two attrs on f/10. - // Also set attrs on other rows and fields to test isolation. - if _, err := c.GetNode(0).API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `SetRowAttrs(f, 10, foo="bar")`}); err != nil { - t.Fatal(err) - } - if _, err := c.GetNode(0).API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `SetRowAttrs(f, 200, YYY=1)`}); err != nil { - t.Fatal(err) - } - if _, err := c.GetNode(0).API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `SetRowAttrs(xxx, 10, YYY=1)`}); err != nil { - t.Fatal(err) - } - if _, err := c.GetNode(0).API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `SetRowAttrs(f, 10, baz=123, bat=true)`}); err != nil { - t.Fatal(err) - } - - f := hldr.Field("i", "f") - if m, err := f.RowAttrStore().Attrs(10); err != nil { - t.Fatal(err) - } else if !reflect.DeepEqual(m, map[string]interface{}{"foo": "bar", "baz": int64(123), "bat": true}) { - t.Fatalf("unexpected row attr: %#v", m) - } - }) - - t.Run("rowKey", func(t *testing.T) { - // Set two attrs on f/10. - // Also set attrs on other rows and fields to test isolation. - if _, err := c.GetNode(0).API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `SetRowAttrs(kf, "row10", foo="bar")`}); err != nil { - t.Fatal(err) - } - if _, err := c.GetNode(0).API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `SetRowAttrs(kf, "row200", YYY=1)`}); err != nil { - t.Fatal(err) - } - if _, err := c.GetNode(0).API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `SetRowAttrs(kf, "row10", baz=123, bat=true)`}); err != nil { - t.Fatal(err) - } - - if result, err := c.GetNode(0).API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Row(kf="row10")`}); err != nil { - t.Fatal(err) - } else if attrs := result.Results[0].(*pilosa.Row).Attrs; !reflect.DeepEqual(attrs, map[string]interface{}{"foo": "bar", "baz": int64(123), "bat": true}) { - t.Fatalf("unexpected attrs: %+v", attrs) - } - }) -} - func TestExecutor_Execute_TopK_Set(t *testing.T) { c := test.MustRunCluster(t, 3) defer c.Close() @@ -2282,56 +2094,6 @@ func TestExecutor_Execute_TopN_Src(t *testing.T) { } } -//Ensure TopN handles Attribute filters -func TestExecutor_Execute_TopN_Attr(t *testing.T) { - c := test.MustRunCluster(t, 1) - defer c.Close() - hldr := c.GetHolder(0) - hldr.SetBit("i", "f", 0, 0) - hldr.SetBit("i", "f", 0, 1) - hldr.SetBit("i", "f", 10, ShardWidth) - - if err := hldr.Field("i", "f").RowAttrStore().SetAttrs(10, map[string]interface{}{"category": int64(123)}); err != nil { - t.Fatal(err) - } - if result, err := c.GetNode(0).API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `TopN(f, n=1, attrName="category", attrValues=[123])`}); err != nil { - t.Fatal(err) - } else if !reflect.DeepEqual(result.Results, []interface{}{&pilosa.PairsField{ - Pairs: []pilosa.Pair{ - {ID: 10, Count: 1}, - }, - Field: "f", - }}) { - t.Fatalf("unexpected result: %s", spew.Sdump(result)) - } - -} - -//Ensure TopN handles Attribute filters with source row -func TestExecutor_Execute_TopN_Attr_Src(t *testing.T) { - c := test.MustRunCluster(t, 1) - defer c.Close() - hldr := c.GetHolder(0) - - hldr.SetBit("i", "f", 0, 0) - hldr.SetBit("i", "f", 0, 1) - hldr.SetBit("i", "f", 10, ShardWidth) - - if err := hldr.Field("i", "f").RowAttrStore().SetAttrs(10, map[string]interface{}{"category": uint64(123)}); err != nil { - t.Fatal(err) - } - if result, err := c.GetNode(0).API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `TopN(f, Row(f=10), n=1, attrName="category", attrValues=[123])`}); err != nil { - t.Fatal(err) - } else if !reflect.DeepEqual(result.Results, []interface{}{&pilosa.PairsField{ - Pairs: []pilosa.Pair{ - {ID: 10, Count: 1}, - }, - Field: "f", - }}) { - t.Fatalf("unexpected result: %s", spew.Sdump(result)) - } -} - // Ensure Min() and Max() queries can be executed. func TestExecutor_Execute_MinMax(t *testing.T) { t.Run("WithOffset", func(t *testing.T) { @@ -3695,17 +3457,6 @@ func TestExecutor_Execute_Remote_Row(t *testing.T) { } }) - t.Run("remote setrowattrs", func(t *testing.T) { - if _, err := c.GetNode(1).API.Query(context.Background(), &pilosa.QueryRequest{ - Index: "i", - Query: `SetRowAttrs(_field="f", _row=10, bat=true, baz=123)`, - }); err != nil { - t.Fatalf("setrowattrs querying: %v", err) - } else if attrst, err := hldr0.RowAttrStore("i", "f").Attrs(10); err != nil || !attrst["bat"].(bool) || attrst["baz"].(int64) != 123 { - t.Fatalf("wrong attrs: %v", attrst) - } - }) - t.Run("remote groupBy", func(t *testing.T) { if res, err := c.GetNode(0).API.Query(context.Background(), &pilosa.QueryRequest{ Index: "i", @@ -3927,57 +3678,6 @@ func TestExecutor_Execute_ErrMaxWritesPerRequest(t *testing.T) { } } -// Ensure SetColumnAttrs doesn't save `field` as an attribute -func TestExecutor_SetColumnAttrs_ExcludeField(t *testing.T) { - c := test.MustRunCluster(t, 1) - defer c.Close() - hldr := c.GetHolder(0) - - index := hldr.MustCreateIndexIfNotExists("i", pilosa.IndexOptions{}) - _, err := index.CreateField("f", pilosa.OptFieldTypeDefault()) - if err != nil { - t.Fatalf("creating field: %v", err) - } - targetAttrs := map[string]interface{}{ - "foo": "bar", - } - - // SetColumnAttrs call should exclude the field attribute - _, err = c.GetNode(0).API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: "Set(10, f=1)"}) - if err != nil { - t.Fatal(err) - } - _, err = c.GetNode(0).API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: "SetColumnAttrs(10, foo='bar')"}) - if err != nil { - t.Fatal(err) - } - attrs, err := index.ColumnAttrStore().Attrs(10) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(attrs, targetAttrs) { - t.Fatalf("%#v != %#v", targetAttrs, attrs) - } - - // SetColumnAttrs call should not break if field is not specified - _, err = c.GetNode(0).API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: "Set(20, f=10)"}) - if err != nil { - t.Fatal(err) - } - _, err = c.GetNode(0).API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: "SetColumnAttrs(20, foo='bar')"}) - if err != nil { - t.Fatal(err) - } - attrs, err = index.ColumnAttrStore().Attrs(20) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(attrs, targetAttrs) { - t.Fatalf("%#v != %#v", targetAttrs, attrs) - } - -} - func TestExecutor_Time_Clear_Quantums(t *testing.T) { c := test.MustRunCluster(t, 1) defer c.Close() diff --git a/field.go b/field.go index ab3aad658..2eafcd4fa 100644 --- a/field.go +++ b/field.go @@ -95,9 +95,6 @@ type Field struct { viewMap map[string]*view - // Row attribute storage and cache - rowAttrStore AttrStore - broadcaster broadcaster Stats stats.StatsClient schemator disco.Schemator @@ -377,8 +374,6 @@ func newField(holder *Holder, path, index, name string, opts FieldOption) (*Fiel viewMap: make(map[string]*view), - rowAttrStore: nopStore, - broadcaster: NopBroadcaster, Stats: stats.NopStatsClient, schemator: disco.NopSchemator, @@ -423,9 +418,6 @@ func (f *Field) TranslateStore() TranslateStore { return f.translateStore } -// RowAttrStore returns the attribute storage. -func (f *Field) RowAttrStore() AttrStore { return f.rowAttrStore } - // AvailableShards returns a bitmap of shards that contain data. func (f *Field) AvailableShards(localOnly bool) *roaring.Bitmap { f.mu.RLock() @@ -568,11 +560,6 @@ func (f *Field) Open() error { return errors.Wrap(err, "opening views") } - f.holder.Logger.Debugf("open row attribute store for index/field: %s/%s", f.index, f.name) - if err := f.rowAttrStore.Open(); err != nil { - return errors.Wrap(err, "opening attrstore") - } - // Apply the field-specific translateStore. if err := f.applyTranslateStore(); err != nil { return errors.Wrap(err, "applying translate store") @@ -753,7 +740,6 @@ func (f *Field) openViews() error { return fmt.Errorf("opening view: view=%s, err=%s", view.name, err) } - view.rowAttrStore = f.rowAttrStore f.holder.Logger.Debugf("add index/field/view to field.viewMap: %s/%s/%s", f.index, f.name, view.name) f.viewMap[view.name] = view } @@ -865,10 +851,6 @@ func (f *Field) Close() error { f.wg.Wait() f.availableShardChan = nil } - // Close the attribute store. - if f.rowAttrStore != nil { - _ = f.rowAttrStore.Close() - } // Close field translation store. if f.translateStore != nil { @@ -1053,7 +1035,6 @@ func (f *Field) createViewIfNotExistsBase(cvm *CreateViewMessage) (*view, bool, if err := view.openEmpty(); err != nil { return nil, false, errors.Wrap(err, "opening view") } - view.rowAttrStore = f.rowAttrStore f.viewMap[view.name] = view return view, true, nil @@ -1062,7 +1043,6 @@ func (f *Field) createViewIfNotExistsBase(cvm *CreateViewMessage) (*view, bool, func (f *Field) newView(path, name string) *view { view := newView(f.holder, path, f.index, f.name, name, f.options) view.idx = f.idx - view.rowAttrStore = f.rowAttrStore view.stats = f.Stats view.broadcaster = f.broadcaster return view diff --git a/fragment.go b/fragment.go index f8f928581..d81caa460 100644 --- a/fragment.go +++ b/fragment.go @@ -192,10 +192,6 @@ type fragment struct { // Logger used for out-of-band log entries. Logger logger.Logger - // Row attribute storage. - // This is set by the parent field unless overridden for testing. - RowAttrStore AttrStore - // mutexVector is used for mutex field types. It's checked for an // existing value (to clear) prior to setting a new value. mutexVector vector @@ -1830,7 +1826,6 @@ func (f *fragment) forEachBit(tx Tx, fn func(rowID, columnID uint64) error) erro // top returns the top rows from the fragment. // If opt.Src is specified then only rows which intersect src are returned. -// If opt.FilterValues exist then the row attribute specified by field is matched. func (f *fragment) top(tx Tx, opt topOptions) ([]Pair, error) { // Retrieve pairs. If no row ids specified then return from cache. pairs, err := f.topBitmapPairs(tx, opt.RowIDs) @@ -1843,15 +1838,6 @@ func (f *fragment) top(tx Tx, opt topOptions) ([]Pair, error) { opt.N = 0 } - // Create a fast lookup of filter values. - var filters map[interface{}]struct{} - if opt.FilterName != "" && len(opt.FilterValues) > 0 { - filters = make(map[interface{}]struct{}) - for _, v := range opt.FilterValues { - filters[v] = struct{}{} - } - } - // Use `tanimotoThreshold > 0` to indicate whether or not we are considering Tanimoto. var tanimotoThreshold uint64 var minTanimoto, maxTanimoto float64 @@ -1886,20 +1872,6 @@ func (f *fragment) top(tx Tx, opt topOptions) ([]Pair, error) { } } - // Apply filter, if set. - if filters != nil { - attr, err := f.RowAttrStore.Attrs(rowID) - if err != nil { - return nil, errors.Wrap(err, "getting attrs") - } else if attr == nil { - continue - } else if attrValue := attr[opt.FilterName]; attrValue == nil { - continue - } else if _, ok := filters[attrValue]; !ok { - continue - } - } - // The initial n pairs should simply be added to the results. if opt.N == 0 || results.Len() < opt.N { // Calculate count and append. @@ -2030,9 +2002,6 @@ type topOptions struct { RowIDs []uint64 MinThreshold uint64 - // Filter field name & values. - FilterName string - FilterValues []interface{} TanimotoThreshold uint64 } diff --git a/fragment_internal_test.go b/fragment_internal_test.go index 54e3bb863..a3336487e 100644 --- a/fragment_internal_test.go +++ b/fragment_internal_test.go @@ -1289,46 +1289,6 @@ func TestFragment_Top(t *testing.T) { } } -// Ensure a fragment can filter rows when retrieving the top n rows. -func TestFragment_Top_Filter(t *testing.T) { - f, idx, tx := mustOpenFragment(t, "i", "f", viewStandard, 0, CacheTypeRanked) - defer f.Clean(t) - - // Set bits on the rows 100, 101, & 102. - f.mustSetBits(tx, 100, 1, 3, 200) - f.mustSetBits(tx, 101, 1) - f.mustSetBits(tx, 102, 1, 2) - f.RecalculateCache() - // Assign attributes. - err := f.RowAttrStore.SetAttrs(101, map[string]interface{}{"x": int64(10)}) - if err != nil { - t.Fatalf("setAttrs: %v", err) - } - err = f.RowAttrStore.SetAttrs(102, map[string]interface{}{"x": int64(20)}) - if err != nil { - t.Fatalf("setAttrs: %v", err) - } - - PanicOn(tx.Commit()) - tx = idx.holder.txf.NewTx(Txo{Write: !writable, Index: idx, Fragment: f, Shard: f.shard}) - defer tx.Rollback() - - // Retrieve top rows. - if pairs, err := f.top(tx, topOptions{ - N: 2, - FilterName: "x", - FilterValues: []interface{}{int64(10), int64(15), int64(20)}, - }); err != nil { - t.Fatal(err) - } else if len(pairs) != 2 { - t.Fatalf("unexpected count: %d", len(pairs)) - } else if pairs[0] != (Pair{ID: 102, Count: 2}) { - t.Fatalf("unexpected pair(0): %v", pairs[0]) - } else if pairs[1] != (Pair{ID: 101, Count: 1}) { - t.Fatalf("unexpected pair(1): %v", pairs[1]) - } -} - // Ensure a fragment can return top rows that intersect with an input row. func TestFragment_TopN_Intersect(t *testing.T) { f, idx, tx := mustOpenFragment(t, "i", "f", viewStandard, 0, CacheTypeRanked) @@ -3637,9 +3597,6 @@ func mustOpenFragmentFlags(tb testing.TB, index, field, view string, shard uint6 }) f.CacheType = cacheType - f.RowAttrStore = &memAttrStore{ - store: make(map[uint64]map[string]interface{}), - } if err := f.Open(); err != nil { PanicOn(err) diff --git a/handler.go b/handler.go index 8f9f2dbef..6276ac535 100644 --- a/handler.go +++ b/handler.go @@ -37,15 +37,6 @@ type QueryRequest struct { // If empty, all shards are included. Shards []uint64 - // Return column attributes, if true. - ColumnAttrs bool - - // Do not return row attributes, if true. - ExcludeRowAttrs bool - - // Do not return columns, if true. - ExcludeColumns bool - // If true, indicates that query is part of a larger distributed query. // If false, this request is on the originating node. Remote bool @@ -70,9 +61,6 @@ type QueryResponse struct { // ValCount, Pair, Pairs, bool, uint64. Results []interface{} - // Set of column attribute objects matching IDs returned in Result. - ColumnAttrSets []*ColumnAttrSet - // Error during parsing or execution. Err error @@ -89,13 +77,11 @@ func (resp *QueryResponse) MarshalJSON() ([]byte, error) { } return json.Marshal(struct { - Results []interface{} `json:"results"` - ColumnAttrSets []*ColumnAttrSet `json:"columnAttrs,omitempty"` - Profile *tracing.Profile `json:"profile,omitempty"` + Results []interface{} `json:"results"` + Profile *tracing.Profile `json:"profile,omitempty"` }{ - Results: resp.Results, - ColumnAttrSets: resp.ColumnAttrSets, - Profile: resp.Profile, + Results: resp.Results, + Profile: resp.Profile, }) } @@ -204,17 +190,6 @@ func (ivr *ImportValueRequest) ValidateWithTimestamp(indexCreatedAt, fieldCreate return nil } -// ImportColumnAttrsRequest describes the import request structure -// for a ColumnAttr import. -type ImportColumnAttrsRequest struct { - AttrKey string - ColumnIDs []uint64 - AttrVals []string - Shard int64 - Index string - IndexCreatedAt int64 -} - // ImportRequest describes the import request structure // for an import. BSIs use the ImportValueRequest instead. type ImportRequest struct { diff --git a/holder.go b/holder.go index 3595fe10e..341120b26 100644 --- a/holder.go +++ b/holder.go @@ -36,7 +36,6 @@ import ( "github.com/pilosa/pilosa/v2/storage" "github.com/pilosa/pilosa/v2/testhook" "github.com/pilosa/pilosa/v2/topology" - "github.com/pilosa/pilosa/v2/tracing" . "github.com/pilosa/pilosa/v2/vprint" // nolint:staticcheck "github.com/pkg/errors" "golang.org/x/sync/errgroup" @@ -57,12 +56,6 @@ const ( // FieldsDir is the default fields directory used by each index. FieldsDir = "fields" - - // ColumnAttrsFileName is the name of the file used for the column attributes store. - ColumnAttrsFileName = "column-attributes" - - // RowAttrsFileName is the name of the file used for the row attributes store. - RowAttrsFileName = "row-attributes" ) func init() { @@ -92,8 +85,6 @@ type Holder struct { sharder disco.Sharder serializer Serializer - NewAttrStore func(string) AttrStore - // Close management wg sync.WaitGroup closing chan struct{} @@ -234,7 +225,6 @@ type HolderConfig struct { Sharder disco.Sharder CacheFlushInterval time.Duration StatsClient stats.StatsClient - NewAttrStore func(string) AttrStore Logger logger.Logger RowcacheOn bool @@ -258,7 +248,6 @@ func DefaultHolderConfig() *HolderConfig { Sharder: disco.InMemSharder, CacheFlushInterval: defaultCacheFlushInterval, StatsClient: stats.NopStatsClient, - NewAttrStore: newNopAttrStore, Logger: logger.NopLogger, StorageConfig: storage.NewDefaultConfig(), RBFConfig: rbfcfg.NewDefaultConfig(), @@ -287,7 +276,6 @@ func NewHolder(path string, cfg *HolderConfig) *Holder { partitionN: cfg.PartitionN, Stats: cfg.StatsClient, - NewAttrStore: cfg.NewAttrStore, cacheFlushInterval: cfg.CacheFlushInterval, OpenTranslateStore: cfg.OpenTranslateStore, OpenTranslateReader: cfg.OpenTranslateReader, @@ -1318,8 +1306,6 @@ func (h *Holder) newIndex(path, name string) (*Index, error) { index.broadcaster = h.broadcaster index.serializer = h.serializer index.Schemator = h.schemator - index.newAttrStore = h.NewAttrStore - index.columnAttrs = h.NewAttrStore(filepath.Join(index.path, ColumnAttrsFileName)) index.OpenTranslateStore = h.OpenTranslateStore index.translationSyncer = h.translationSyncer return index, nil @@ -1526,11 +1512,6 @@ func (s *holderSyncer) SyncHolder() error { return nil } - // Sync index column attributes. - if err := s.syncIndex(di.Name); err != nil { - return fmt.Errorf("index sync error: index=%s, err=%s", di.Name, err) - } - tf := time.Now() for _, fi := range di.Fields { // Verify syncer has not closed. @@ -1538,11 +1519,6 @@ func (s *holderSyncer) SyncHolder() error { return nil } - // Sync field row attributes. - if err := s.syncField(di.Name, fi.Name); err != nil { - return fmt.Errorf("field sync error: index=%s, field=%s, err=%s", di.Name, fi.Name, err) - } - for _, vi := range fi.Views { // Verify syncer has not closed. if s.IsClosing() { @@ -1578,101 +1554,6 @@ func (s *holderSyncer) SyncHolder() error { return nil } -// syncIndex synchronizes index attributes with the rest of the cluster. -func (s *holderSyncer) syncIndex(index string) error { - span, ctx := tracing.StartSpanFromContext(context.Background(), "HolderSyncer.syncIndex") - defer span.Finish() - - // Retrieve index reference. - idx := s.Holder.Index(index) - if idx == nil { - return nil - } - indexTag := fmt.Sprintf("index:%s", index) - - // Read block checksums. - blks, err := idx.ColumnAttrStore().Blocks() - if err != nil { - return errors.Wrap(err, "getting blocks") - } - s.Stats.CountWithCustomTags(MetricColumnAttrStoreBlocks, int64(len(blks)), 1.0, []string{indexTag}) - - // Sync with every other host. - for _, node := range topology.Nodes(s.Cluster.noder.Nodes()).FilterID(s.Node.ID) { - // Retrieve attributes from differing blocks. - // Skip update and recomputation if no attributes have changed. - m, err := s.Cluster.InternalClient.ColumnAttrDiff(ctx, &node.URI, index, blks) - if err != nil { - return errors.Wrap(err, "getting differing blocks") - } else if len(m) == 0 { - continue - } - s.Stats.CountWithCustomTags(MetricColumnAttrDiff, int64(len(m)), 1.0, []string{indexTag, node.ID}) - - // Update local copy. - if err := idx.ColumnAttrStore().SetBulkAttrs(m); err != nil { - return errors.Wrap(err, "setting attrs") - } - - // Recompute blocks. - blks, err = idx.ColumnAttrStore().Blocks() - if err != nil { - return errors.Wrap(err, "recomputing blocks") - } - } - - return nil -} - -// syncField synchronizes field attributes with the rest of the cluster. -func (s *holderSyncer) syncField(index, name string) error { - span, ctx := tracing.StartSpanFromContext(context.Background(), "HolderSyncer.syncField") - defer span.Finish() - - // Retrieve field reference. - f := s.Holder.Field(index, name) - if f == nil { - return nil - } - indexTag := fmt.Sprintf("index:%s", index) - fieldTag := fmt.Sprintf("field:%s", name) - - // Read block checksums. - blks, err := f.RowAttrStore().Blocks() - if err != nil { - return errors.Wrap(err, "getting blocks") - } - s.Stats.CountWithCustomTags(MetricRowAttrStoreBlocks, int64(len(blks)), 1.0, []string{indexTag, fieldTag}) - - // Sync with every other host. - for _, node := range topology.Nodes(s.Cluster.noder.Nodes()).FilterID(s.Node.ID) { - // Retrieve attributes from differing blocks. - // Skip update and recomputation if no attributes have changed. - m, err := s.Cluster.InternalClient.RowAttrDiff(ctx, &node.URI, index, name, blks) - if errors.Cause(err) == ErrFieldNotFound { - continue // field not created remotely yet, skip - } else if err != nil { - return errors.Wrap(err, "getting differing blocks") - } else if len(m) == 0 { - continue - } - s.Stats.CountWithCustomTags(MetricRowAttrDiff, int64(len(m)), 1.0, []string{indexTag, fieldTag, node.ID}) - - // Update local copy. - if err := f.RowAttrStore().SetBulkAttrs(m); err != nil { - return errors.Wrap(err, "setting attrs") - } - - // Recompute blocks. - blks, err = f.RowAttrStore().Blocks() - if err != nil { - return errors.Wrap(err, "recomputing blocks") - } - } - - return nil -} - // syncFragment synchronizes a fragment with the rest of the cluster. func (s *holderSyncer) syncFragment(index, field, view string, shard uint64) error { // Retrieve local field. diff --git a/holder_test.go b/holder_test.go index 1700bfa67..cece22830 100644 --- a/holder_test.go +++ b/holder_test.go @@ -53,22 +53,6 @@ func TestHolder_Open(t *testing.T) { t.Fatalf("unexpected error: %v", err) } }) - t.Run("ErrIndexAttrStoreCorrupt", func(t *testing.T) { - h := test.MustOpenHolder(t) - defer h.Close() - - if _, err := h.CreateIndex("test", pilosa.IndexOptions{}); err != nil { - t.Fatal(err) - } else if err := h.Close(); err != nil { - t.Fatal(err) - } else if err := os.Truncate(filepath.Join(h.IndexPath("test"), pilosa.ColumnAttrsFileName), 2); err != nil { - t.Fatal(err) - } - - if err := h.Reopen(); err == nil || !strings.Contains(err.Error(), "open index: name=test, err=opening attrstore: opening storage: invalid database") { - t.Fatalf("unexpected error: %s", err) - } - }) t.Run("ErrFragmentStoragePermission", func(t *testing.T) { roaringOnlyTest(t) diff --git a/http/client.go b/http/client.go index fdf2cf7d7..c10f038bf 100644 --- a/http/client.go +++ b/http/client.go @@ -784,57 +784,6 @@ func (c *InternalClient) ImportRoaring(ctx context.Context, uri *pnet.URI, index return nil } -// ImportColumnAttrs does bulk import of column attrs -func (c *InternalClient) ImportColumnAttrs(ctx context.Context, uri *pnet.URI, index string, req *pilosa.ImportColumnAttrsRequest) error { - span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.ImportRoaring") - defer span.Finish() - - if index == "" { - return pilosa.ErrIndexRequired - } - if uri == nil { - uri = c.defaultURI - } - - url := fmt.Sprintf("%s/index/%s/import-column-attrs", uri, index) - - // Marshal data to protobuf. - data, err := c.serializer.Marshal(req) - if err != nil { - return errors.Wrap(err, "marshal import-column-attrs request") - } - - // Generate HTTP request. - httpReq, err := http.NewRequest("POST", url, bytes.NewBuffer(data)) - if err != nil { - return errors.Wrap(err, "creating request") - } - httpReq.Header.Set("Content-Type", "application/x-protobuf") - httpReq.Header.Set("Accept", "application/x-protobuf") - httpReq.Header.Set("X-Pilosa-Row", "roaring") - httpReq.Header.Set("User-Agent", "pilosa/"+pilosa.Version) - - // Execute request against the host. - resp, err := c.executeRequest(httpReq.WithContext(ctx)) - if err != nil { - return err - } - defer resp.Body.Close() - - dec := json.NewDecoder(resp.Body) - rbody := &pilosa.ImportResponse{} - err = dec.Decode(rbody) - // Decode can return EOF when no error occurred. helpful! - if err != nil && err != io.EOF { - return errors.Wrap(err, "decoding response body") - } - if rbody.Err != "" { - return errors.Wrap(errors.New(rbody.Err), "importing roaring") - } - - return nil -} - // ExportCSV bulk exports data for a single shard from a host to CSV format. func (c *InternalClient) ExportCSV(ctx context.Context, index, field string, shard uint64, w io.Writer) error { span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.ExportCSV") @@ -1126,89 +1075,6 @@ func (c *InternalClient) BlockData(ctx context.Context, uri *pnet.URI, index, fi return rsp.RowIDs, rsp.ColumnIDs, nil } -// ColumnAttrDiff returns data from differing blocks on a remote host. -func (c *InternalClient) ColumnAttrDiff(ctx context.Context, uri *pnet.URI, index string, blks []pilosa.AttrBlock) (map[uint64]map[string]interface{}, error) { - span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.ColumnAttrDiff") - defer span.Finish() - - if uri == nil { - uri = c.defaultURI - } - u := uriPathToURL(uri, fmt.Sprintf("/internal/index/%s/attr/diff", index)) - - // Encode request. - buf, err := json.Marshal(postIndexAttrDiffRequest{Blocks: blks}) - if err != nil { - return nil, errors.Wrap(err, "marshaling") - } - - // Build request. - req, err := http.NewRequest("POST", u.String(), bytes.NewReader(buf)) - if err != nil { - return nil, errors.Wrap(err, "creating request") - } - req.Header.Set("Content-Type", "application/json") - req.Header.Set("User-Agent", "pilosa/"+pilosa.Version) - req.Header.Set("Accept", "application/json") - - // Execute request. - resp, err := c.executeRequest(req.WithContext(ctx)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - // Decode response object. - var rsp postIndexAttrDiffResponse - if err := json.NewDecoder(resp.Body).Decode(&rsp); err != nil { - return nil, errors.Wrap(err, "decoding") - } - return rsp.Attrs, nil -} - -// RowAttrDiff returns data from differing blocks on a remote host. -func (c *InternalClient) RowAttrDiff(ctx context.Context, uri *pnet.URI, index, field string, blks []pilosa.AttrBlock) (map[uint64]map[string]interface{}, error) { - span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.RowAttrDiff") - defer span.Finish() - - if uri == nil { - uri = c.defaultURI - } - u := uriPathToURL(uri, fmt.Sprintf("/internal/index/%s/field/%s/attr/diff", index, field)) - - // Encode request. - buf, err := json.Marshal(postFieldAttrDiffRequest{Blocks: blks}) - if err != nil { - return nil, errors.Wrap(err, "marshaling") - } - - // Build request. - req, err := http.NewRequest("POST", u.String(), bytes.NewReader(buf)) - if err != nil { - return nil, errors.Wrap(err, "creating request") - } - req.Header.Set("Content-Type", "application/json") - req.Header.Set("User-Agent", "pilosa/"+pilosa.Version) - req.Header.Set("Accept", "application/json") - - // Execute request. - resp, err := c.executeRequest(req.WithContext(ctx)) - if err != nil { - if resp != nil && resp.StatusCode == http.StatusNotFound { - return nil, errors.Wrap(pilosa.ErrFieldNotFound, field) - } - return nil, err - } - defer resp.Body.Close() - - // Decode response object. - var rsp postFieldAttrDiffResponse - if err := json.NewDecoder(resp.Body).Decode(&rsp); err != nil { - return nil, errors.Wrap(err, "decoding") - } - return rsp.Attrs, nil -} - // SendMessage posts a message synchronously. func (c *InternalClient) SendMessage(ctx context.Context, uri *pnet.URI, msg []byte) error { span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.SendMessage") @@ -2187,29 +2053,6 @@ func (c *InternalClient) IndexTranslateDataReader(ctx context.Context, index str return resp.Body, nil } -// IndexAttrDataReader returns a reader that provides a snapshot of column attributes data. -func (c *InternalClient) IndexAttrDataReader(ctx context.Context, index string) (io.ReadCloser, error) { - span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.IndexAttrDataReader") - defer span.Finish() - - // Build request. - u := fmt.Sprintf("%s/internal/index/%s/attr/data", c.defaultURI.String(), url.QueryEscape(index)) - req, err := http.NewRequest("GET", u, nil) - if err != nil { - return nil, errors.Wrap(err, "creating request") - } - - req.Header.Set("User-Agent", "pilosa/"+pilosa.Version) - req.Header.Set("Accept", "application/octet-stream") - - // Execute request. - resp, err := c.executeRequest(req.WithContext(ctx)) - if err != nil { - return nil, err - } - return resp.Body, nil -} - // FieldTranslateDataReader returns a reader that provides a snapshot of // translation data for a field. func (c *InternalClient) FieldTranslateDataReader(ctx context.Context, index, field string) (io.ReadCloser, error) { @@ -2239,29 +2082,6 @@ func (c *InternalClient) FieldTranslateDataReader(ctx context.Context, index, fi return resp.Body, nil } -// FieldAttrDataReader returns a reader that provides a snapshot of row attributes data. -func (c *InternalClient) FieldAttrDataReader(ctx context.Context, index, field string) (io.ReadCloser, error) { - span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.FieldAttrDataReader") - defer span.Finish() - - // Build request. - u := fmt.Sprintf("%s/internal/index/%s/field/%s/attr/data", c.defaultURI.String(), url.QueryEscape(index), url.QueryEscape(field)) - req, err := http.NewRequest("GET", u, nil) - if err != nil { - return nil, errors.Wrap(err, "creating request") - } - - req.Header.Set("User-Agent", "pilosa/"+pilosa.Version) - req.Header.Set("Accept", "application/octet-stream") - - // Execute request. - resp, err := c.executeRequest(req.WithContext(ctx)) - if err != nil { - return nil, err - } - return resp.Body, nil -} - // Status function is just a public function for this particular implementation of InternalClient. // It's not require by pilosa.InternalClient interface. // The function returns pilosa cluster state as a string ("NORMAL", "DEGRADED", "DOWN", "RESIZING", ...) diff --git a/http/client_test.go b/http/client_test.go index 33a016a88..f9004821a 100644 --- a/http/client_test.go +++ b/http/client_test.go @@ -22,7 +22,6 @@ import ( "fmt" gohttp "net/http" "reflect" - "strconv" "strings" "testing" "time" @@ -414,60 +413,6 @@ func TestClient_Import(t *testing.T) { } } -// Ensure client can bulk import column attrs. -func TestClient_ImportColumnAttrs(t *testing.T) { - cluster := test.MustNewCluster(t, 2) - for _, c := range cluster.Nodes { - c.Config.Cluster.ReplicaN = 2 - } - err := cluster.Start() - if err != nil { - t.Fatalf("starting cluster: %v", err) - } - defer cluster.Close() - - ctx := context.Background() - _, err = cluster.GetNode(0).API.CreateIndex(ctx, "i", pilosa.IndexOptions{}) - if err != nil { - t.Fatalf("creating index: %v", err) - } - _, err = cluster.GetNode(0).API.CreateField(ctx, "i", "f", pilosa.OptFieldTypeSet(pilosa.CacheTypeRanked, 100)) - if err != nil { - t.Fatalf("creating field: %v", err) - } - _, err = cluster.GetNode(0).API.Query(ctx, &pilosa.QueryRequest{Index: "i", Query: "Set(0, f=0) Set(1, f=0) Set(2, f=0) Set(3, f=0) Set(4, f=0)"}) - if err != nil { - t.Fatalf("querying: %v", err) - } - - attrKey := "k" - // Send import request. - host := cluster.GetNode(0).URL() - c := MustNewClient(host, http.GetHTTPClient(nil)) - colAttrsReq := makeImportColumnAttrsRequest("i", 0, attrKey) - if err := c.ImportColumnAttrs(ctx, &cluster.GetNode(1).API.Node().URI, "i", colAttrsReq); err != nil { - t.Fatal(err) - } - - // Verify data. - pql := "Options(Row(f=0), columnAttrs=true)" - res, err := cluster.GetNode(1).API.Query(ctx, &pilosa.QueryRequest{Index: "i", Query: pql}) - if err != nil { - t.Fatal(err) - } - if len(res.ColumnAttrSets) != 5 { - t.Fatal("incorrect number of column attrs set") - } - - for _, v := range res.ColumnAttrSets { - attrVal := attrFun(v.ID) - if attrVal != v.Attrs[attrKey] { - t.Fatal(err) - } - } - -} - // Ensure client can bulk import data. func TestClient_ImportRoaring(t *testing.T) { cluster := test.MustRunCluster(t, 3, @@ -1408,26 +1353,6 @@ func makeImportRoaringRequest(clear bool, viewData string) *pilosa.ImportRoaring } } -func attrFun(id uint64) string { - return strconv.FormatInt(int64(id), 10) -} - -func makeImportColumnAttrsRequest(index string, shard int64, attrKey string) *pilosa.ImportColumnAttrsRequest { - colIDs := make([]uint64, 0, 5) - attrVals := make([]string, 0, 5) - for n := uint64(0); n < 5; n++ { - colIDs = append(colIDs, n) - attrVals = append(attrVals, attrFun(n)) - } - return &pilosa.ImportColumnAttrsRequest{ - Index: index, - Shard: shard, - AttrKey: attrKey, - ColumnIDs: colIDs, - AttrVals: attrVals, - } -} - // verify that serverInfo has Backend func TestClient_ServerInfoHasBackend(t *testing.T) { //srcs := []string{"roaring", "rbf", "lmdb"} diff --git a/http/handler.go b/http/handler.go index ad795efb4..d5d14b1d6 100644 --- a/http/handler.go +++ b/http/handler.go @@ -237,7 +237,7 @@ func (h *Handler) populateValidators() { h.validators["PostImport"] = queryValidationSpecRequired().Optional("clear", "ignoreKeyCheck") h.validators["PostImportAtomicRecord"] = queryValidationSpecRequired().Optional("simPowerLossAfter") h.validators["PostImportRoaring"] = queryValidationSpecRequired().Optional("remote", "clear") - h.validators["PostQuery"] = queryValidationSpecRequired().Optional("shards", "columnAttrs", "excludeRowAttrs", "excludeColumns", "profile") + h.validators["PostQuery"] = queryValidationSpecRequired().Optional("shards", "excludeColumns", "profile") h.validators["GetInfo"] = queryValidationSpecRequired() h.validators["RecalculateCaches"] = queryValidationSpecRequired() h.validators["GetSchema"] = queryValidationSpecRequired().Optional("views") @@ -249,10 +249,6 @@ func (h *Handler) populateValidators() { h.validators["GetFragmentBlocks"] = queryValidationSpecRequired("index", "field", "view", "shard") h.validators["GetFragmentData"] = queryValidationSpecRequired("index", "field", "view", "shard") h.validators["GetFragmentNodes"] = queryValidationSpecRequired("shard", "index") - h.validators["PostIndexAttrDiff"] = queryValidationSpecRequired() - h.validators["GetIndexAttrData"] = queryValidationSpecRequired() - h.validators["PostFieldAttrDiff"] = queryValidationSpecRequired() - h.validators["GetFieldAttrData"] = queryValidationSpecRequired() h.validators["GetNodes"] = queryValidationSpecRequired() h.validators["GetShardMax"] = queryValidationSpecRequired() h.validators["GetTransactionList"] = queryValidationSpecRequired() @@ -387,7 +383,6 @@ func newRouter(handler *Handler) http.Handler { router.HandleFunc("/index/{index}", handler.handlePostIndex).Methods("POST").Name("PostIndex") router.HandleFunc("/index/{index}", handler.handleDeleteIndex).Methods("DELETE").Name("DeleteIndex") //router.HandleFunc("/index/{index}/field", handler.handleGetFields).Methods("GET") // Not implemented. - router.HandleFunc("/index/{index}/import-column-attrs", handler.handlePostImportColumnAttrs).Methods("POST").Name("PostImportColumnAttrs") router.HandleFunc("/index/{index}/field", handler.handlePostField).Methods("POST").Name("PostField") router.HandleFunc("/index/{index}/field/", handler.handlePostField).Methods("POST").Name("PostField") router.HandleFunc("/index/{index}/field/{field}", handler.handlePostField).Methods("POST").Name("PostField") @@ -424,15 +419,11 @@ func newRouter(handler *Handler) http.Handler { router.HandleFunc("/internal/fragment/blocks", handler.handleGetFragmentBlocks).Methods("GET").Name("GetFragmentBlocks") router.HandleFunc("/internal/fragment/data", handler.handleGetFragmentData).Methods("GET").Name("GetFragmentData") router.HandleFunc("/internal/fragment/nodes", handler.handleGetFragmentNodes).Methods("GET").Name("GetFragmentNodes") - router.HandleFunc("/internal/index/{index}/attr/diff", handler.handlePostIndexAttrDiff).Methods("POST").Name("PostIndexAttrDiff") - router.HandleFunc("/internal/index/{index}/attr/data", handler.handleGetIndexAttrData).Methods("GET").Name("GetIndexAttrData") router.HandleFunc("/internal/translate/data", handler.handleGetTranslateData).Methods("GET").Name("GetTranslateData") router.HandleFunc("/internal/translate/data", handler.handlePostTranslateData).Methods("POST").Name("PostTranslateData") router.HandleFunc("/internal/translate/keys", handler.handlePostTranslateKeys).Methods("POST").Name("PostTranslateKeys") router.HandleFunc("/internal/translate/ids", handler.handlePostTranslateIDs).Methods("POST").Name("PostTranslateIDs") - router.HandleFunc("/internal/index/{index}/field/{field}/attr/diff", handler.handlePostFieldAttrDiff).Methods("POST").Name("PostFieldAttrDiff") router.HandleFunc("/internal/index/{index}/field/{field}/remote-available-shards/{shardID}", handler.handleDeleteRemoteAvailableShard).Methods("DELETE") - router.HandleFunc("/internal/index/{index}/field/{field}/attr/data", handler.handleGetFieldAttrData).Methods("GET").Name("GetFieldAttrData") router.HandleFunc("/internal/index/{index}/shard/{shard}/snapshot", handler.handleGetIndexShardSnapshot).Methods("GET").Name("GetIndexShardSnapshot") router.HandleFunc("/internal/index/{index}/shards", handler.handleGetIndexAvailableShards).Methods("GET").Name("GetIndexAvailableShards") router.HandleFunc("/internal/nodes", handler.handleGetNodes).Methods("GET").Name("GetNodes") @@ -1155,48 +1146,6 @@ func (h *Handler) handlePostIndex(w http.ResponseWriter, r *http.Request) { resp.write(w, err) } -// handlePostIndexAttrDiff handles POST /internal/index/attr/diff requests. -func (h *Handler) handlePostIndexAttrDiff(w http.ResponseWriter, r *http.Request) { - if !validHeaderAcceptJSON(r.Header) { - http.Error(w, "JSON only acceptable response", http.StatusNotAcceptable) - return - } - indexName := mux.Vars(r)["index"] - - // Decode request. - var req postIndexAttrDiffRequest - if err := json.NewDecoder(r.Body).Decode(&req); err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - return - } - - attrs, err := h.api.IndexAttrDiff(r.Context(), indexName, req.Blocks) - if err != nil { - if errors.Cause(err) == pilosa.ErrIndexNotFound { - http.Error(w, err.Error(), http.StatusNotFound) - } else { - http.Error(w, err.Error(), http.StatusInternalServerError) - } - return - } - - // Encode response. - w.Header().Set("Content-Type", "application/json") - if err := json.NewEncoder(w).Encode(postIndexAttrDiffResponse{ - Attrs: attrs, - }); err != nil { - h.logger.Errorf("response encoding error: %s", err) - } -} - -// handleGetIndexAttrData handles GET /internal/index/{index}/attr/data requests. -func (h *Handler) handleGetIndexAttrData(w http.ResponseWriter, r *http.Request) { - if err := h.api.WriteColumnAttrDataTo(r.Context(), w, mux.Vars(r)["index"]); err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } -} - func (h *Handler) handleGetActiveQueries(w http.ResponseWriter, r *http.Request) { var rtype string switch { @@ -1264,14 +1213,6 @@ func (h *Handler) handleGetPastQueries(w http.ResponseWriter, r *http.Request) { } -type postIndexAttrDiffRequest struct { - Blocks []pilosa.AttrBlock `json:"blocks"` -} - -type postIndexAttrDiffResponse struct { - Attrs map[uint64]map[string]interface{} `json:"attrs"` -} - // handlePostField handles POST /field request. func (h *Handler) handlePostField(w http.ResponseWriter, r *http.Request) { if !validHeaderAcceptJSON(r.Header) { @@ -1677,58 +1618,6 @@ func (h *Handler) handleDeleteRemoteAvailableShard(w http.ResponseWriter, r *htt resp.write(w, err) } -// handlePostFieldAttrDiff handles POST /internal/field/attr/diff requests. -func (h *Handler) handlePostFieldAttrDiff(w http.ResponseWriter, r *http.Request) { - if !validHeaderAcceptJSON(r.Header) { - http.Error(w, "JSON only acceptable response", http.StatusNotAcceptable) - return - } - indexName := mux.Vars(r)["index"] - fieldName := mux.Vars(r)["field"] - - // Decode request. - var req postFieldAttrDiffRequest - if err := json.NewDecoder(r.Body).Decode(&req); err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - return - } - - attrs, err := h.api.FieldAttrDiff(r.Context(), indexName, fieldName, req.Blocks) - if err != nil { - switch errors.Cause(err) { - case pilosa.ErrFragmentNotFound: - http.Error(w, err.Error(), http.StatusNotFound) - default: - http.Error(w, err.Error(), http.StatusInternalServerError) - } - return - } - - // Encode response. - w.Header().Set("Content-Type", "application/json") - if err := json.NewEncoder(w).Encode(postFieldAttrDiffResponse{ - Attrs: attrs, - }); err != nil { - h.logger.Errorf("response encoding error: %s", err) - } -} - -type postFieldAttrDiffRequest struct { - Blocks []pilosa.AttrBlock `json:"blocks"` -} - -type postFieldAttrDiffResponse struct { - Attrs map[uint64]map[string]interface{} `json:"attrs"` -} - -// handleGetFieldAttrData handles GET /internal/index/{index}/field/{field}/attr/data requests. -func (h *Handler) handleGetFieldAttrData(w http.ResponseWriter, r *http.Request) { - if err := h.api.WriteRowAttrDataTo(r.Context(), w, mux.Vars(r)["index"], mux.Vars(r)["field"]); err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } -} - // handleGetIndexShardSnapshot handles GET /internal/index/{index}/shard/{shard}/snapshot requests. func (h *Handler) handleGetIndexShardSnapshot(w http.ResponseWriter, r *http.Request) { indexName := mux.Vars(r)["index"] @@ -1821,12 +1710,9 @@ func (h *Handler) readURLQueryRequest(r *http.Request) (*pilosa.QueryRequest, er } return &pilosa.QueryRequest{ - Query: query, - Shards: shards, - Profile: profile, - ColumnAttrs: q.Get("columnAttrs") == "true", - ExcludeRowAttrs: q.Get("excludeRowAttrs") == "true", - ExcludeColumns: q.Get("excludeColumns") == "true", + Query: query, + Shards: shards, + Profile: profile, }, nil } @@ -2534,48 +2420,6 @@ func (h *Handler) handlePostImport(w http.ResponseWriter, r *http.Request) { } } -// handlePostImportColumnAttrs -func (h *Handler) handlePostImportColumnAttrs(w http.ResponseWriter, r *http.Request) { - // Verify that request is only communicating over protobufs. - if r.Header.Get("Content-Type") != "application/x-protobuf" { - http.Error(w, "Unsupported media type", http.StatusUnsupportedMediaType) - return - } else if r.Header.Get("Accept") != "application/x-protobuf" { - http.Error(w, "Not acceptable", http.StatusNotAcceptable) - return - } - - opts := []pilosa.ImportOption{} - - body, err := readBody(r) - if err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - return - } - - req := &pilosa.ImportColumnAttrsRequest{} - if err := proto.DefaultSerializer.Unmarshal(body, req); err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - return - } - - if err := h.api.ImportColumnAttrs(r.Context(), req, opts...); err != nil { - switch errors.Cause(err) { - case pilosa.ErrClusterDoesNotOwnShard, pilosa.ErrPreconditionFailed: - http.Error(w, err.Error(), http.StatusPreconditionFailed) - default: - http.Error(w, err.Error(), http.StatusInternalServerError) - } - return - } - - // Write response. - _, err = w.Write(importOk) - if err != nil { - h.logger.Errorf("writing import-column-attrs response: %v", err) - } -} - // handlePostImportRoaring func (h *Handler) handlePostImportRoaring(w http.ResponseWriter, r *http.Request) { // Verify that request is only communicating over protobufs. diff --git a/index.go b/index.go index 32510efcb..460ef5434 100644 --- a/index.go +++ b/index.go @@ -49,11 +49,6 @@ type Index struct { // Fields by name. fields map[string]*Field - newAttrStore func(string) AttrStore - - // Column attribute storage and cache. - columnAttrs AttrStore - broadcaster broadcaster Schemator disco.Schemator serializer Serializer @@ -92,9 +87,6 @@ func NewIndex(holder *Holder, path, name string) (*Index, error) { name: name, fields: make(map[string]*Field), - newAttrStore: newNopAttrStore, - columnAttrs: nopStore, - broadcaster: NopBroadcaster, Stats: stats.NopStatsClient, holder: holder, @@ -161,9 +153,6 @@ func (i *Index) TranslateStore(partitionID int) TranslateStore { // Keys returns true if the index uses string keys. func (i *Index) Keys() bool { return i.keys } -// ColumnAttrStore returns the storage for column attributes. -func (i *Index) ColumnAttrStore() AttrStore { return i.columnAttrs } - // Options returns all options for this index. func (i *Index) Options() IndexOptions { i.mu.RLock() @@ -252,10 +241,6 @@ func (i *Index) open(idx *disco.Index) (err error) { } } - if err := i.columnAttrs.Open(); err != nil { - return errors.Wrap(err, "opening attrstore") - } - if i.keys { i.holder.Logger.Debugf("open translate store for index: %s", i.name) @@ -459,9 +444,6 @@ func (i *Index) Close() error { return errors.Wrap(err, "closing index") } - // Close the attribute store. - i.columnAttrs.Close() - // Close partitioned translation stores. for _, store := range i.translateStores { if err := store.Close(); err != nil { @@ -792,7 +774,6 @@ func (i *Index) newField(path, name string) (*Field, error) { f.broadcaster = i.broadcaster f.schemator = i.Schemator f.serializer = i.serializer - f.rowAttrStore = i.newAttrStore(filepath.Join(f.path, RowAttrsFileName)) f.OpenTranslateStore = i.OpenTranslateStore return f, nil } diff --git a/metrics.go b/metrics.go index 1758fd479..95da4c7e7 100644 --- a/metrics.go +++ b/metrics.go @@ -28,8 +28,6 @@ const ( MetricCacheThresholdReached = "cache_threshold_reached_total" MetricRow = "query_row_total" MetricRowBSI = "query_row_bsi_total" - MetricSetRowAttrs = "query_setrowattrs_total" - MetricSetColumnAttrs = "query_setcolumnattrs_total" MetricSetBit = "set_bit_total" MetricClearBit = "clear_bit_total" MetricImportingN = "importing_total" @@ -40,10 +38,6 @@ const ( MetricBlockRepair = "block_repair_total" MetricSyncFieldDurationSeconds = "sync_field_duration_seconds" MetricSyncIndexDurationSeconds = "sync_index_duration_seconds" - MetricColumnAttrStoreBlocks = "column_attr_store_blocks_total" - MetricColumnAttrDiff = "column_attr_diff_total" - MetricRowAttrStoreBlocks = "row_attr_store_blocks_total" - MetricRowAttrDiff = "row_attr_diff_total" MetricHTTPRequest = "http_request_duration_seconds" MetricGRPCUnaryQueryDurationSeconds = "grpc_request_pql_unary_query_duration_seconds" MetricGRPCUnaryFormatDurationSeconds = "grpc_request_pql_unary_format_duration_seconds" diff --git a/pb/private.pb.go b/pb/private.pb.go index d857ed458..54366c2cb 100644 --- a/pb/private.pb.go +++ b/pb/private.pb.go @@ -1,17 +1,3 @@ -// Copyright 2017 Pilosa Corp. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: private.proto diff --git a/pb/public.pb.go b/pb/public.pb.go index 6ae80e41c..866040770 100644 --- a/pb/public.pb.go +++ b/pb/public.pb.go @@ -1,20 +1,3 @@ -// Copyright 2017 Pilosa Corp. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// package ctl contains all pilosa subcommands other than 'server'. These are -// generally administration, testing, and debugging tools. - // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: public.proto @@ -43,7 +26,6 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type Row struct { Columns []uint64 `protobuf:"varint,1,rep,packed,name=Columns,proto3" json:"Columns,omitempty"` Keys []string `protobuf:"bytes,3,rep,name=Keys,proto3" json:"Keys,omitempty"` - Attrs []*Attr `protobuf:"bytes,2,rep,name=Attrs,proto3" json:"Attrs,omitempty"` Roaring []byte `protobuf:"bytes,4,opt,name=Roaring,proto3" json:"Roaring,omitempty"` Index string `protobuf:"bytes,5,opt,name=Index,proto3" json:"Index,omitempty"` Field string `protobuf:"bytes,6,opt,name=Field,proto3" json:"Field,omitempty"` @@ -99,13 +81,6 @@ func (m *Row) GetKeys() []string { return nil } -func (m *Row) GetAttrs() []*Attr { - if m != nil { - return m.Attrs - } - return nil -} - func (m *Row) GetRoaring() []byte { if m != nil { return m.Roaring @@ -1314,210 +1289,10 @@ func (m *Decimal) GetScale() int64 { return 0 } -type ColumnAttrSet struct { - ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - Key string `protobuf:"bytes,3,opt,name=Key,proto3" json:"Key,omitempty"` - Attrs []*Attr `protobuf:"bytes,2,rep,name=Attrs,proto3" json:"Attrs,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ColumnAttrSet) Reset() { *m = ColumnAttrSet{} } -func (m *ColumnAttrSet) String() string { return proto.CompactTextString(m) } -func (*ColumnAttrSet) ProtoMessage() {} -func (*ColumnAttrSet) Descriptor() ([]byte, []int) { - return fileDescriptor_413a91106d7bcce8, []int{20} -} -func (m *ColumnAttrSet) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ColumnAttrSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ColumnAttrSet.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ColumnAttrSet) XXX_Merge(src proto.Message) { - xxx_messageInfo_ColumnAttrSet.Merge(m, src) -} -func (m *ColumnAttrSet) XXX_Size() int { - return m.Size() -} -func (m *ColumnAttrSet) XXX_DiscardUnknown() { - xxx_messageInfo_ColumnAttrSet.DiscardUnknown(m) -} - -var xxx_messageInfo_ColumnAttrSet proto.InternalMessageInfo - -func (m *ColumnAttrSet) GetID() uint64 { - if m != nil { - return m.ID - } - return 0 -} - -func (m *ColumnAttrSet) GetKey() string { - if m != nil { - return m.Key - } - return "" -} - -func (m *ColumnAttrSet) GetAttrs() []*Attr { - if m != nil { - return m.Attrs - } - return nil -} - -type Attr struct { - Key string `protobuf:"bytes,1,opt,name=Key,proto3" json:"Key,omitempty"` - Type uint64 `protobuf:"varint,2,opt,name=Type,proto3" json:"Type,omitempty"` - StringValue string `protobuf:"bytes,3,opt,name=StringValue,proto3" json:"StringValue,omitempty"` - IntValue int64 `protobuf:"varint,4,opt,name=IntValue,proto3" json:"IntValue,omitempty"` - BoolValue bool `protobuf:"varint,5,opt,name=BoolValue,proto3" json:"BoolValue,omitempty"` - FloatValue float64 `protobuf:"fixed64,6,opt,name=FloatValue,proto3" json:"FloatValue,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Attr) Reset() { *m = Attr{} } -func (m *Attr) String() string { return proto.CompactTextString(m) } -func (*Attr) ProtoMessage() {} -func (*Attr) Descriptor() ([]byte, []int) { - return fileDescriptor_413a91106d7bcce8, []int{21} -} -func (m *Attr) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Attr) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Attr.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Attr) XXX_Merge(src proto.Message) { - xxx_messageInfo_Attr.Merge(m, src) -} -func (m *Attr) XXX_Size() int { - return m.Size() -} -func (m *Attr) XXX_DiscardUnknown() { - xxx_messageInfo_Attr.DiscardUnknown(m) -} - -var xxx_messageInfo_Attr proto.InternalMessageInfo - -func (m *Attr) GetKey() string { - if m != nil { - return m.Key - } - return "" -} - -func (m *Attr) GetType() uint64 { - if m != nil { - return m.Type - } - return 0 -} - -func (m *Attr) GetStringValue() string { - if m != nil { - return m.StringValue - } - return "" -} - -func (m *Attr) GetIntValue() int64 { - if m != nil { - return m.IntValue - } - return 0 -} - -func (m *Attr) GetBoolValue() bool { - if m != nil { - return m.BoolValue - } - return false -} - -func (m *Attr) GetFloatValue() float64 { - if m != nil { - return m.FloatValue - } - return 0 -} - -type AttrMap struct { - Attrs []*Attr `protobuf:"bytes,1,rep,name=Attrs,proto3" json:"Attrs,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AttrMap) Reset() { *m = AttrMap{} } -func (m *AttrMap) String() string { return proto.CompactTextString(m) } -func (*AttrMap) ProtoMessage() {} -func (*AttrMap) Descriptor() ([]byte, []int) { - return fileDescriptor_413a91106d7bcce8, []int{22} -} -func (m *AttrMap) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AttrMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AttrMap.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AttrMap) XXX_Merge(src proto.Message) { - xxx_messageInfo_AttrMap.Merge(m, src) -} -func (m *AttrMap) XXX_Size() int { - return m.Size() -} -func (m *AttrMap) XXX_DiscardUnknown() { - xxx_messageInfo_AttrMap.DiscardUnknown(m) -} - -var xxx_messageInfo_AttrMap proto.InternalMessageInfo - -func (m *AttrMap) GetAttrs() []*Attr { - if m != nil { - return m.Attrs - } - return nil -} - type QueryRequest struct { Query string `protobuf:"bytes,1,opt,name=Query,proto3" json:"Query,omitempty"` Shards []uint64 `protobuf:"varint,2,rep,packed,name=Shards,proto3" json:"Shards,omitempty"` - ColumnAttrs bool `protobuf:"varint,3,opt,name=ColumnAttrs,proto3" json:"ColumnAttrs,omitempty"` Remote bool `protobuf:"varint,5,opt,name=Remote,proto3" json:"Remote,omitempty"` - ExcludeRowAttrs bool `protobuf:"varint,6,opt,name=ExcludeRowAttrs,proto3" json:"ExcludeRowAttrs,omitempty"` - ExcludeColumns bool `protobuf:"varint,7,opt,name=ExcludeColumns,proto3" json:"ExcludeColumns,omitempty"` EmbeddedData []*Row `protobuf:"bytes,8,rep,name=EmbeddedData,proto3" json:"EmbeddedData,omitempty"` PreTranslated bool `protobuf:"varint,9,opt,name=PreTranslated,proto3" json:"PreTranslated,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -1529,7 +1304,7 @@ func (m *QueryRequest) Reset() { *m = QueryRequest{} } func (m *QueryRequest) String() string { return proto.CompactTextString(m) } func (*QueryRequest) ProtoMessage() {} func (*QueryRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_413a91106d7bcce8, []int{23} + return fileDescriptor_413a91106d7bcce8, []int{20} } func (m *QueryRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1572,13 +1347,6 @@ func (m *QueryRequest) GetShards() []uint64 { return nil } -func (m *QueryRequest) GetColumnAttrs() bool { - if m != nil { - return m.ColumnAttrs - } - return false -} - func (m *QueryRequest) GetRemote() bool { if m != nil { return m.Remote @@ -1586,20 +1354,6 @@ func (m *QueryRequest) GetRemote() bool { return false } -func (m *QueryRequest) GetExcludeRowAttrs() bool { - if m != nil { - return m.ExcludeRowAttrs - } - return false -} - -func (m *QueryRequest) GetExcludeColumns() bool { - if m != nil { - return m.ExcludeColumns - } - return false -} - func (m *QueryRequest) GetEmbeddedData() []*Row { if m != nil { return m.EmbeddedData @@ -1615,19 +1369,18 @@ func (m *QueryRequest) GetPreTranslated() bool { } type QueryResponse struct { - Err string `protobuf:"bytes,1,opt,name=Err,proto3" json:"Err,omitempty"` - Results []*QueryResult `protobuf:"bytes,2,rep,name=Results,proto3" json:"Results,omitempty"` - ColumnAttrSets []*ColumnAttrSet `protobuf:"bytes,3,rep,name=ColumnAttrSets,proto3" json:"ColumnAttrSets,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Err string `protobuf:"bytes,1,opt,name=Err,proto3" json:"Err,omitempty"` + Results []*QueryResult `protobuf:"bytes,2,rep,name=Results,proto3" json:"Results,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *QueryResponse) Reset() { *m = QueryResponse{} } func (m *QueryResponse) String() string { return proto.CompactTextString(m) } func (*QueryResponse) ProtoMessage() {} func (*QueryResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_413a91106d7bcce8, []int{24} + return fileDescriptor_413a91106d7bcce8, []int{21} } func (m *QueryResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1670,13 +1423,6 @@ func (m *QueryResponse) GetResults() []*QueryResult { return nil } -func (m *QueryResponse) GetColumnAttrSets() []*ColumnAttrSet { - if m != nil { - return m.ColumnAttrSets - } - return nil -} - type QueryResult struct { Type uint32 `protobuf:"varint,6,opt,name=Type,proto3" json:"Type,omitempty"` Row *Row `protobuf:"bytes,1,opt,name=Row,proto3" json:"Row,omitempty"` @@ -1709,7 +1455,7 @@ func (m *QueryResult) Reset() { *m = QueryResult{} } func (m *QueryResult) String() string { return proto.CompactTextString(m) } func (*QueryResult) ProtoMessage() {} func (*QueryResult) Descriptor() ([]byte, []int) { - return fileDescriptor_413a91106d7bcce8, []int{25} + return fileDescriptor_413a91106d7bcce8, []int{22} } func (m *QueryResult) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1871,7 +1617,7 @@ func (m *ImportRequest) Reset() { *m = ImportRequest{} } func (m *ImportRequest) String() string { return proto.CompactTextString(m) } func (*ImportRequest) ProtoMessage() {} func (*ImportRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_413a91106d7bcce8, []int{26} + return fileDescriptor_413a91106d7bcce8, []int{23} } func (m *ImportRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1998,7 +1744,7 @@ func (m *ImportValueRequest) Reset() { *m = ImportValueRequest{} } func (m *ImportValueRequest) String() string { return proto.CompactTextString(m) } func (*ImportValueRequest) ProtoMessage() {} func (*ImportValueRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_413a91106d7bcce8, []int{27} + return fileDescriptor_413a91106d7bcce8, []int{24} } func (m *ImportValueRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2118,7 +1864,7 @@ func (m *AtomicRecord) Reset() { *m = AtomicRecord{} } func (m *AtomicRecord) String() string { return proto.CompactTextString(m) } func (*AtomicRecord) ProtoMessage() {} func (*AtomicRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_413a91106d7bcce8, []int{28} + return fileDescriptor_413a91106d7bcce8, []int{25} } func (m *AtomicRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2186,7 +1932,7 @@ func (m *AtomicImportResponse) Reset() { *m = AtomicImportResponse{} } func (m *AtomicImportResponse) String() string { return proto.CompactTextString(m) } func (*AtomicImportResponse) ProtoMessage() {} func (*AtomicImportResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_413a91106d7bcce8, []int{29} + return fileDescriptor_413a91106d7bcce8, []int{26} } func (m *AtomicImportResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2236,7 +1982,7 @@ func (m *TranslateKeysRequest) Reset() { *m = TranslateKeysRequest{} } func (m *TranslateKeysRequest) String() string { return proto.CompactTextString(m) } func (*TranslateKeysRequest) ProtoMessage() {} func (*TranslateKeysRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_413a91106d7bcce8, []int{30} + return fileDescriptor_413a91106d7bcce8, []int{27} } func (m *TranslateKeysRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2304,7 +2050,7 @@ func (m *TranslateKeysResponse) Reset() { *m = TranslateKeysResponse{} } func (m *TranslateKeysResponse) String() string { return proto.CompactTextString(m) } func (*TranslateKeysResponse) ProtoMessage() {} func (*TranslateKeysResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_413a91106d7bcce8, []int{31} + return fileDescriptor_413a91106d7bcce8, []int{28} } func (m *TranslateKeysResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2353,7 +2099,7 @@ func (m *TranslateIDsRequest) Reset() { *m = TranslateIDsRequest{} } func (m *TranslateIDsRequest) String() string { return proto.CompactTextString(m) } func (*TranslateIDsRequest) ProtoMessage() {} func (*TranslateIDsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_413a91106d7bcce8, []int{32} + return fileDescriptor_413a91106d7bcce8, []int{29} } func (m *TranslateIDsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2414,7 +2160,7 @@ func (m *TranslateIDsResponse) Reset() { *m = TranslateIDsResponse{} } func (m *TranslateIDsResponse) String() string { return proto.CompactTextString(m) } func (*TranslateIDsResponse) ProtoMessage() {} func (*TranslateIDsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_413a91106d7bcce8, []int{33} + return fileDescriptor_413a91106d7bcce8, []int{30} } func (m *TranslateIDsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2462,7 +2208,7 @@ func (m *ImportRoaringRequestView) Reset() { *m = ImportRoaringRequestVi func (m *ImportRoaringRequestView) String() string { return proto.CompactTextString(m) } func (*ImportRoaringRequestView) ProtoMessage() {} func (*ImportRoaringRequestView) Descriptor() ([]byte, []int) { - return fileDescriptor_413a91106d7bcce8, []int{34} + return fileDescriptor_413a91106d7bcce8, []int{31} } func (m *ImportRoaringRequestView) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2522,7 +2268,7 @@ func (m *ImportRoaringRequest) Reset() { *m = ImportRoaringRequest{} } func (m *ImportRoaringRequest) String() string { return proto.CompactTextString(m) } func (*ImportRoaringRequest) ProtoMessage() {} func (*ImportRoaringRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_413a91106d7bcce8, []int{35} + return fileDescriptor_413a91106d7bcce8, []int{32} } func (m *ImportRoaringRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2600,93 +2346,6 @@ func (m *ImportRoaringRequest) GetUpdateExistence() bool { return false } -type ImportColumnAttrsRequest struct { - Index string `protobuf:"bytes,1,opt,name=Index,proto3" json:"Index,omitempty"` - Shard int64 `protobuf:"varint,2,opt,name=Shard,proto3" json:"Shard,omitempty"` - AttrKey string `protobuf:"bytes,3,opt,name=AttrKey,proto3" json:"AttrKey,omitempty"` - AttrVals []string `protobuf:"bytes,4,rep,name=AttrVals,proto3" json:"AttrVals,omitempty"` - ColumnIDs []uint64 `protobuf:"varint,5,rep,packed,name=ColumnIDs,proto3" json:"ColumnIDs,omitempty"` - IndexCreatedAt int64 `protobuf:"varint,6,opt,name=IndexCreatedAt,proto3" json:"IndexCreatedAt,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ImportColumnAttrsRequest) Reset() { *m = ImportColumnAttrsRequest{} } -func (m *ImportColumnAttrsRequest) String() string { return proto.CompactTextString(m) } -func (*ImportColumnAttrsRequest) ProtoMessage() {} -func (*ImportColumnAttrsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_413a91106d7bcce8, []int{36} -} -func (m *ImportColumnAttrsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ImportColumnAttrsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ImportColumnAttrsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ImportColumnAttrsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ImportColumnAttrsRequest.Merge(m, src) -} -func (m *ImportColumnAttrsRequest) XXX_Size() int { - return m.Size() -} -func (m *ImportColumnAttrsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ImportColumnAttrsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ImportColumnAttrsRequest proto.InternalMessageInfo - -func (m *ImportColumnAttrsRequest) GetIndex() string { - if m != nil { - return m.Index - } - return "" -} - -func (m *ImportColumnAttrsRequest) GetShard() int64 { - if m != nil { - return m.Shard - } - return 0 -} - -func (m *ImportColumnAttrsRequest) GetAttrKey() string { - if m != nil { - return m.AttrKey - } - return "" -} - -func (m *ImportColumnAttrsRequest) GetAttrVals() []string { - if m != nil { - return m.AttrVals - } - return nil -} - -func (m *ImportColumnAttrsRequest) GetColumnIDs() []uint64 { - if m != nil { - return m.ColumnIDs - } - return nil -} - -func (m *ImportColumnAttrsRequest) GetIndexCreatedAt() int64 { - if m != nil { - return m.IndexCreatedAt - } - return 0 -} - type GroupCounts struct { Aggregate string `protobuf:"bytes,1,opt,name=Aggregate,proto3" json:"Aggregate,omitempty"` Groups []*GroupCount `protobuf:"bytes,2,rep,name=Groups,proto3" json:"Groups,omitempty"` @@ -2699,7 +2358,7 @@ func (m *GroupCounts) Reset() { *m = GroupCounts{} } func (m *GroupCounts) String() string { return proto.CompactTextString(m) } func (*GroupCounts) ProtoMessage() {} func (*GroupCounts) Descriptor() ([]byte, []int) { - return fileDescriptor_413a91106d7bcce8, []int{37} + return fileDescriptor_413a91106d7bcce8, []int{33} } func (m *GroupCounts) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2763,9 +2422,6 @@ func init() { proto.RegisterType((*GroupCount)(nil), "pb.GroupCount") proto.RegisterType((*ValCount)(nil), "pb.ValCount") proto.RegisterType((*Decimal)(nil), "pb.Decimal") - proto.RegisterType((*ColumnAttrSet)(nil), "pb.ColumnAttrSet") - proto.RegisterType((*Attr)(nil), "pb.Attr") - proto.RegisterType((*AttrMap)(nil), "pb.AttrMap") proto.RegisterType((*QueryRequest)(nil), "pb.QueryRequest") proto.RegisterType((*QueryResponse)(nil), "pb.QueryResponse") proto.RegisterType((*QueryResult)(nil), "pb.QueryResult") @@ -2779,124 +2435,110 @@ func init() { proto.RegisterType((*TranslateIDsResponse)(nil), "pb.TranslateIDsResponse") proto.RegisterType((*ImportRoaringRequestView)(nil), "pb.ImportRoaringRequestView") proto.RegisterType((*ImportRoaringRequest)(nil), "pb.ImportRoaringRequest") - proto.RegisterType((*ImportColumnAttrsRequest)(nil), "pb.ImportColumnAttrsRequest") proto.RegisterType((*GroupCounts)(nil), "pb.GroupCounts") } func init() { proto.RegisterFile("public.proto", fileDescriptor_413a91106d7bcce8) } var fileDescriptor_413a91106d7bcce8 = []byte{ - // 1754 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0x5f, 0x6f, 0x23, 0x49, - 0x11, 0xcf, 0xfc, 0xf1, 0xbf, 0xb2, 0xe3, 0xe4, 0xfa, 0x72, 0xcb, 0xdc, 0x92, 0x33, 0xbe, 0x11, - 0x3a, 0x79, 0x09, 0xca, 0x89, 0x00, 0x27, 0x38, 0x09, 0x50, 0x1c, 0xe7, 0xc8, 0x68, 0xd9, 0xdc, - 0x5e, 0x3b, 0x04, 0x1e, 0x78, 0x99, 0xd8, 0x8d, 0x6f, 0xc4, 0xd8, 0x63, 0xc6, 0xe3, 0x73, 0x22, - 0x3e, 0xc0, 0xf1, 0x11, 0x40, 0x3c, 0x23, 0xf1, 0x39, 0x78, 0x81, 0x37, 0x78, 0xe4, 0x11, 0x2d, - 0x5f, 0x04, 0x55, 0x75, 0xf7, 0x4c, 0xcf, 0xd8, 0x7b, 0xbb, 0x5a, 0xdd, 0x5b, 0xd7, 0x9f, 0xae, - 0xee, 0xfa, 0x55, 0x75, 0x55, 0xcd, 0x40, 0x67, 0xb9, 0xbe, 0x8b, 0xa3, 0xc9, 0xe9, 0x32, 0x4d, - 0xb2, 0x84, 0xd9, 0xcb, 0x3b, 0xff, 0xcf, 0x16, 0x38, 0x3c, 0xd9, 0x30, 0x0f, 0x1a, 0x17, 0x49, - 0xbc, 0x9e, 0x2f, 0x56, 0x9e, 0xd5, 0x77, 0x06, 0x2e, 0xd7, 0x24, 0x63, 0xe0, 0x3e, 0x15, 0x0f, - 0x2b, 0xcf, 0xe9, 0x3b, 0x83, 0x16, 0xa7, 0x35, 0xeb, 0x41, 0xed, 0x3c, 0xcb, 0xd2, 0x95, 0x67, - 0xf7, 0x9d, 0x41, 0xfb, 0xac, 0x79, 0xba, 0xbc, 0x3b, 0x45, 0x06, 0x97, 0x6c, 0xb4, 0xc6, 0x93, - 0x30, 0x8d, 0x16, 0x33, 0xcf, 0xed, 0x5b, 0x83, 0x0e, 0xd7, 0x24, 0x3b, 0x82, 0x5a, 0xb0, 0x98, - 0x8a, 0x7b, 0xaf, 0xd6, 0xb7, 0x06, 0x2d, 0x2e, 0x09, 0xe4, 0x7e, 0x12, 0x89, 0x78, 0xea, 0xd5, - 0x25, 0x97, 0x08, 0x7f, 0x00, 0x2d, 0x9e, 0x6c, 0x9e, 0x85, 0x59, 0x1a, 0xdd, 0xb3, 0x6f, 0x82, - 0xcb, 0x93, 0x8d, 0xbc, 0x5d, 0xfb, 0xac, 0x81, 0x27, 0xf2, 0x64, 0xc3, 0x89, 0xe9, 0x9f, 0x43, - 0x6b, 0x1c, 0xcd, 0x16, 0x62, 0x8a, 0xae, 0xbc, 0x0b, 0xce, 0xf3, 0x04, 0x15, 0x2d, 0x53, 0x11, - 0x79, 0x28, 0xba, 0x16, 0x33, 0xcf, 0xae, 0x88, 0xae, 0xc5, 0xcc, 0xff, 0x11, 0x74, 0x79, 0xb2, - 0x09, 0xa6, 0x62, 0x91, 0x45, 0xbf, 0x8d, 0x44, 0x4a, 0x8e, 0xe7, 0x27, 0xba, 0xf2, 0xa0, 0x1c, - 0x0c, 0xbb, 0x00, 0xc3, 0x7f, 0x0c, 0xf5, 0x60, 0xf4, 0x8b, 0x68, 0x95, 0xb1, 0x43, 0x70, 0x82, - 0x91, 0xde, 0x80, 0x4b, 0xff, 0x02, 0xde, 0xba, 0xbc, 0xcf, 0xd2, 0x70, 0x92, 0x89, 0x69, 0x30, - 0x92, 0x90, 0xb2, 0x2e, 0xd8, 0xc1, 0x88, 0xee, 0xe7, 0x72, 0x3b, 0x18, 0xb1, 0x1e, 0xb8, 0xb7, - 0x61, 0xac, 0xc1, 0x04, 0xbc, 0x96, 0x34, 0xc8, 0x89, 0xef, 0xff, 0xa6, 0x64, 0x44, 0xe1, 0xf1, - 0x08, 0xea, 0x84, 0x92, 0x3c, 0xae, 0xc5, 0x15, 0xc5, 0x3e, 0x2c, 0x02, 0x29, 0xed, 0xbd, 0x83, - 0xf6, 0xb6, 0x2e, 0x91, 0xc7, 0xd7, 0x7f, 0x0f, 0x1a, 0x4f, 0xc5, 0x03, 0xdd, 0x5f, 0x7b, 0x67, - 0x19, 0xde, 0xfd, 0xcb, 0x82, 0xb7, 0xf3, 0xdd, 0x37, 0xe1, 0x5d, 0x2c, 0x6e, 0xc3, 0x78, 0x2d, - 0x58, 0x4f, 0xfb, 0x6a, 0x95, 0xef, 0x7c, 0xb5, 0x47, 0x9e, 0xb3, 0xf7, 0x73, 0xa4, 0x50, 0xa1, - 0x8d, 0x0a, 0xea, 0x98, 0xab, 0x3d, 0x95, 0x45, 0xc7, 0xd0, 0x1c, 0x8e, 0x03, 0x32, 0xe7, 0x39, - 0x7d, 0x6b, 0xe0, 0x5c, 0xed, 0xf1, 0x9c, 0xc3, 0x1e, 0x43, 0xe3, 0xd9, 0x3a, 0x13, 0xf7, 0xc1, - 0x88, 0x72, 0xc8, 0xbd, 0xda, 0xe3, 0x9a, 0x81, 0x3b, 0x69, 0xf9, 0x54, 0x3c, 0xc8, 0x44, 0xc2, - 0x9d, 0x9a, 0xc3, 0x8e, 0xc0, 0x1d, 0x26, 0x49, 0x4c, 0xc9, 0xd4, 0xc4, 0xd3, 0x90, 0x1a, 0x36, - 0xa0, 0x46, 0x86, 0xfd, 0x7b, 0x38, 0x2a, 0x3b, 0xa4, 0xc2, 0xc2, 0xc0, 0x41, 0x7b, 0x96, 0xb2, - 0x87, 0x04, 0x3b, 0xa4, 0x50, 0xd9, 0xea, 0x7c, 0x0c, 0xd6, 0x87, 0x50, 0x27, 0x33, 0xf2, 0x41, - 0xb4, 0xcf, 0xbe, 0x51, 0x82, 0xb7, 0x00, 0x88, 0x2b, 0xb5, 0x61, 0x8b, 0xf0, 0xfd, 0x34, 0x0d, - 0x46, 0xfe, 0x4f, 0xaa, 0x50, 0x52, 0xcc, 0x10, 0xf6, 0xeb, 0x70, 0x2e, 0xe4, 0xc9, 0x9c, 0xd6, - 0xc8, 0xbb, 0x79, 0x58, 0x0a, 0x3a, 0xba, 0xc5, 0x69, 0xed, 0xaf, 0xa1, 0x5b, 0xde, 0x8e, 0x97, - 0x31, 0x92, 0x60, 0xe7, 0x65, 0x48, 0x9e, 0x67, 0xc7, 0x59, 0x35, 0x3b, 0xbc, 0xed, 0x1d, 0xd5, - 0x04, 0xf9, 0x29, 0xb8, 0xcf, 0xc3, 0x28, 0xdd, 0x4a, 0xdb, 0x43, 0x89, 0x97, 0x43, 0x37, 0x74, - 0x24, 0xf0, 0xb5, 0x8b, 0x64, 0xbd, 0xc8, 0x24, 0x60, 0x5c, 0x12, 0xfe, 0xcf, 0xa0, 0x85, 0xfb, - 0xa5, 0xaf, 0xc7, 0xd2, 0x98, 0xca, 0x1b, 0x2a, 0x1c, 0x48, 0x73, 0x79, 0x44, 0x5e, 0x07, 0x6c, - 0xb3, 0x0e, 0x0c, 0x01, 0x50, 0xba, 0x92, 0x16, 0x7a, 0x50, 0x23, 0x4a, 0xb9, 0x5c, 0x98, 0x90, - 0xec, 0x97, 0xd8, 0x78, 0x0f, 0xeb, 0x4e, 0xf6, 0xd1, 0x0f, 0x50, 0x2c, 0x33, 0x0e, 0x6f, 0xe0, - 0x70, 0x95, 0x13, 0x09, 0x34, 0x25, 0x50, 0xc9, 0xa6, 0x30, 0x60, 0x19, 0x06, 0x90, 0x8b, 0xf5, - 0x61, 0xa4, 0x7d, 0x23, 0x02, 0x5f, 0x21, 0x4f, 0x36, 0x05, 0x0c, 0x8a, 0x62, 0xdf, 0xd2, 0xa7, - 0xb8, 0xe4, 0x67, 0x8b, 0xde, 0x07, 0x9e, 0xaf, 0x0f, 0xfc, 0x35, 0xc0, 0xcf, 0xd3, 0x64, 0xbd, - 0x24, 0x88, 0x98, 0x0f, 0x35, 0xa2, 0x94, 0x4f, 0x1d, 0x54, 0xd7, 0xf7, 0xe1, 0x52, 0xb4, 0x1b, - 0x5c, 0x0c, 0xc2, 0xf9, 0x6c, 0x26, 0x9f, 0x0f, 0xc7, 0xa5, 0xff, 0x07, 0x68, 0xde, 0x86, 0x71, - 0x2e, 0xbd, 0x0d, 0x63, 0xe5, 0x2a, 0x2e, 0xcb, 0x56, 0x1c, 0x6d, 0xe5, 0x31, 0x34, 0x3f, 0x89, - 0x93, 0x30, 0x43, 0x65, 0x34, 0x65, 0xf1, 0x9c, 0x66, 0x27, 0x00, 0x23, 0x31, 0x89, 0xe6, 0x61, - 0x8c, 0x52, 0xb7, 0x78, 0xce, 0x8a, 0xcb, 0x0d, 0xb1, 0xff, 0x43, 0x68, 0x28, 0x6a, 0x37, 0xd0, - 0xc8, 0x1d, 0x4f, 0xc2, 0x58, 0xe8, 0xf3, 0x89, 0xf0, 0x3f, 0x83, 0x7d, 0x99, 0x6d, 0xd8, 0x3e, - 0xc6, 0x22, 0x7b, 0x8d, 0x5c, 0x7b, 0x45, 0x0b, 0xf2, 0xff, 0x66, 0x81, 0x8b, 0x2b, 0xbd, 0xd5, - 0x2a, 0xb6, 0x9a, 0x6f, 0xcb, 0x95, 0x6f, 0x8b, 0xf5, 0xa1, 0x3d, 0xce, 0xb0, 0x43, 0x15, 0xe5, - 0xa8, 0xc5, 0x4d, 0x16, 0x62, 0x14, 0x2c, 0xb2, 0x22, 0xaa, 0x0e, 0xcf, 0x69, 0x76, 0x0c, 0x2d, - 0xac, 0x31, 0x52, 0x88, 0x05, 0xa9, 0xc9, 0x0b, 0x06, 0xeb, 0x01, 0x68, 0x34, 0xd7, 0x82, 0xaa, - 0x92, 0xc5, 0x0d, 0x8e, 0xff, 0x04, 0x1a, 0x78, 0xd3, 0x67, 0xe1, 0xb2, 0xf0, 0xca, 0xda, 0xed, - 0xd5, 0x5f, 0x6c, 0xe8, 0x7c, 0xb6, 0x16, 0xe9, 0x03, 0x17, 0xbf, 0x5f, 0x8b, 0x55, 0x86, 0x78, - 0x12, 0xad, 0x93, 0x95, 0x08, 0x4c, 0xcb, 0xf1, 0xe7, 0x61, 0x3a, 0x95, 0xe8, 0xb8, 0x5c, 0x51, - 0xe8, 0x65, 0x81, 0xf3, 0x8a, 0xbc, 0x6c, 0x72, 0x93, 0x45, 0x09, 0x2d, 0xe6, 0x49, 0xa6, 0xdd, - 0x50, 0x14, 0x1b, 0xc0, 0xc1, 0xe5, 0xfd, 0x24, 0x5e, 0x4f, 0x05, 0x4f, 0x36, 0x72, 0x37, 0x95, - 0x57, 0x5e, 0x65, 0xb3, 0x0f, 0xb0, 0x4a, 0x11, 0x4b, 0x57, 0x9a, 0x06, 0x29, 0x56, 0xb8, 0xec, - 0x04, 0x3a, 0x97, 0xf3, 0x3b, 0x31, 0x9d, 0x8a, 0xe9, 0x28, 0xcc, 0x42, 0xaf, 0x59, 0x6e, 0xec, - 0x25, 0x21, 0xfb, 0x36, 0xec, 0x3f, 0x4f, 0xc5, 0x4d, 0x1a, 0x2e, 0x56, 0x71, 0x98, 0x89, 0xa9, - 0xd7, 0x22, 0x9b, 0x65, 0xa6, 0xff, 0xa5, 0x05, 0xfb, 0x0a, 0x9d, 0xd5, 0x32, 0x59, 0xac, 0x04, - 0x06, 0xff, 0x32, 0x4d, 0x75, 0xf0, 0x2f, 0xd3, 0x94, 0x3d, 0x81, 0x06, 0x17, 0xab, 0x75, 0x9c, - 0xe9, 0xcc, 0x39, 0xc0, 0x13, 0xf5, 0xae, 0x75, 0x9c, 0x71, 0x2d, 0x67, 0x3f, 0x86, 0x6e, 0x29, - 0x2b, 0x75, 0xc9, 0x7f, 0x0b, 0x77, 0x94, 0x24, 0xbc, 0xa2, 0xe8, 0xff, 0xb5, 0x06, 0x6d, 0xc3, - 0x66, 0x9e, 0x72, 0x88, 0xd9, 0xbe, 0x4a, 0xb9, 0x77, 0x69, 0xf2, 0xda, 0x9a, 0x53, 0xb0, 0x04, - 0x75, 0xc0, 0xba, 0x56, 0xe9, 0x69, 0x5d, 0x17, 0x15, 0xcf, 0xd9, 0x5d, 0xf1, 0x70, 0x76, 0xfb, - 0x3c, 0x5c, 0xcc, 0xc4, 0x94, 0x12, 0xb3, 0xc9, 0x35, 0xc9, 0x06, 0x45, 0x2d, 0xa0, 0x78, 0xaa, - 0xd2, 0xa2, 0x79, 0xbc, 0xa8, 0x14, 0xb2, 0x90, 0x61, 0x47, 0x6f, 0xc8, 0x8c, 0x91, 0x14, 0xfb, - 0x08, 0xba, 0x9f, 0xc6, 0xd3, 0xa2, 0x54, 0xad, 0x54, 0x9c, 0xba, 0x68, 0xa7, 0x60, 0xf3, 0x8a, - 0x16, 0xfb, 0xb8, 0x3a, 0x4e, 0x51, 0xc4, 0xda, 0x67, 0x4c, 0xf9, 0x69, 0x48, 0x78, 0x75, 0xf0, - 0x3a, 0x31, 0xa6, 0x39, 0x0f, 0x68, 0xdb, 0x3e, 0x6e, 0xcb, 0x99, 0xdc, 0x98, 0xf6, 0x4e, 0xcd, - 0xe6, 0xe0, 0xb5, 0x49, 0xbb, 0xab, 0x11, 0x92, 0x5c, 0x6e, 0xb6, 0x8f, 0x13, 0xa3, 0x1b, 0x79, - 0x9d, 0xc2, 0x78, 0xce, 0xe4, 0x46, 0xb7, 0xba, 0xd8, 0x31, 0x79, 0x79, 0xfb, 0xb4, 0xa9, 0x3a, - 0x56, 0x49, 0x21, 0xdf, 0x31, 0xa9, 0x7d, 0x5c, 0x6d, 0xdb, 0x5e, 0xb7, 0x80, 0xa2, 0x2c, 0xe1, - 0xd5, 0x06, 0x7f, 0x62, 0x8c, 0xc0, 0xde, 0x41, 0x71, 0xdb, 0x9c, 0xc9, 0x8d, 0x11, 0xf9, 0x7b, - 0xd0, 0x36, 0x03, 0x75, 0x48, 0xea, 0x07, 0xe5, 0x40, 0xad, 0xb8, 0xa9, 0xe3, 0xff, 0xc3, 0x86, - 0xfd, 0x60, 0xbe, 0x4c, 0xd2, 0xcc, 0x28, 0x28, 0x72, 0x40, 0xb7, 0x76, 0x0e, 0xe8, 0x76, 0xa5, - 0x27, 0x52, 0x61, 0xa1, 0x42, 0xe2, 0x72, 0x49, 0x18, 0xa9, 0xe4, 0x96, 0x52, 0xe9, 0x18, 0x5a, - 0xf2, 0x95, 0xa0, 0xa8, 0x46, 0xa2, 0x82, 0x21, 0x3f, 0x19, 0x36, 0x34, 0x32, 0x36, 0x68, 0xfc, - 0xd4, 0x24, 0x96, 0x4f, 0xa9, 0x46, 0xc2, 0x26, 0x09, 0x0d, 0x0e, 0xca, 0x6f, 0xa2, 0xb9, 0x58, - 0x65, 0xe1, 0x7c, 0x89, 0x55, 0xc9, 0x19, 0x38, 0xdc, 0xe0, 0x60, 0x41, 0x22, 0x27, 0x2e, 0x52, - 0x81, 0x55, 0xe2, 0x3c, 0xa3, 0x54, 0x74, 0x78, 0x85, 0x8b, 0x7a, 0xe4, 0x56, 0xa1, 0x07, 0x52, - 0xaf, 0xcc, 0xa5, 0x16, 0x1a, 0x8b, 0x30, 0xa5, 0x64, 0x6b, 0x72, 0x49, 0xf8, 0xff, 0xb1, 0x81, - 0x49, 0x24, 0xe5, 0xf8, 0xf7, 0xb5, 0xc1, 0xf9, 0xd5, 0xb0, 0x95, 0xc1, 0x69, 0x6c, 0x81, 0xf3, - 0x28, 0x1f, 0x57, 0x25, 0x30, 0x8a, 0xc2, 0x4e, 0x50, 0x74, 0x20, 0x89, 0xaa, 0xc5, 0x4d, 0x16, - 0xf3, 0xa1, 0x63, 0xb4, 0x3f, 0x7c, 0xbf, 0x68, 0xbb, 0xc4, 0xdb, 0x01, 0x2d, 0xbc, 0x26, 0xb4, - 0xed, 0xaf, 0x86, 0xb6, 0x63, 0x42, 0xfb, 0xa5, 0x05, 0x9d, 0xf3, 0x2c, 0x99, 0x47, 0x13, 0x2e, - 0x26, 0x49, 0x3a, 0x7d, 0x39, 0xa8, 0x12, 0x3e, 0xdb, 0x84, 0x6f, 0x00, 0x4e, 0xf0, 0x45, 0xaa, - 0x4a, 0xe7, 0x23, 0x9a, 0xc3, 0xb6, 0xa2, 0xc4, 0x51, 0x85, 0xbd, 0x0f, 0x76, 0x90, 0x52, 0xce, - 0xaa, 0x12, 0x5f, 0x7a, 0x18, 0xdc, 0x0e, 0x52, 0xff, 0xbb, 0x70, 0x24, 0x2f, 0xa2, 0x45, 0xaa, - 0xcd, 0x1c, 0x41, 0xed, 0x32, 0x4d, 0x13, 0xdd, 0x68, 0x24, 0x81, 0x1f, 0x1a, 0x79, 0x73, 0xc2, - 0x60, 0xbc, 0x49, 0x4e, 0xec, 0xfa, 0xfa, 0xee, 0x43, 0xfb, 0x3a, 0xc9, 0x7e, 0x95, 0x46, 0x19, - 0x55, 0x13, 0x59, 0xf3, 0x4d, 0x96, 0xff, 0x04, 0xde, 0xa9, 0x9c, 0x5c, 0xf4, 0x43, 0x4c, 0x23, - 0xa7, 0xf8, 0x42, 0x1d, 0xc3, 0xdb, 0xb9, 0x6a, 0x30, 0x7a, 0xa3, 0x3b, 0x6e, 0x1b, 0xfd, 0x8e, - 0xe1, 0x39, 0x19, 0x55, 0xc7, 0xef, 0xf0, 0xc6, 0x1f, 0x82, 0xa7, 0xd0, 0x94, 0xbf, 0x08, 0xd4, - 0x0d, 0x6e, 0x23, 0xb1, 0x79, 0xd9, 0x97, 0x11, 0xcd, 0x0b, 0x36, 0xfd, 0x58, 0xa0, 0xb5, 0xff, - 0x47, 0x1b, 0x8e, 0x76, 0x19, 0x29, 0x12, 0xca, 0x32, 0x12, 0x8a, 0x9d, 0x41, 0xed, 0x8b, 0x48, - 0x6c, 0xf4, 0x04, 0x70, 0x6c, 0x04, 0x7b, 0xeb, 0x0e, 0x5c, 0xaa, 0xe2, 0x43, 0x3a, 0x9f, 0x64, - 0x51, 0xb2, 0xd0, 0x93, 0xbe, 0xa4, 0xf0, 0x84, 0x61, 0x9c, 0x4c, 0x7e, 0x27, 0x3f, 0x52, 0xb9, - 0x24, 0x76, 0x3c, 0x8c, 0xda, 0x6b, 0x3e, 0x8c, 0xfa, 0xce, 0x87, 0x31, 0x80, 0x83, 0x5f, 0x2e, - 0xa7, 0x61, 0x26, 0x2e, 0xef, 0xa3, 0x55, 0x26, 0x16, 0x13, 0xa1, 0xa6, 0xaa, 0x2a, 0xdb, 0xff, - 0xbb, 0xa5, 0xf1, 0x34, 0xc6, 0xba, 0x57, 0x46, 0xb5, 0x78, 0x38, 0x8e, 0x7e, 0x38, 0x9e, 0x9c, - 0x4a, 0x8b, 0xb1, 0x5b, 0x93, 0x38, 0x09, 0xe3, 0x92, 0xfe, 0x59, 0xb8, 0x14, 0xc9, 0x9c, 0x7e, - 0x45, 0xb5, 0xda, 0x86, 0xa5, 0xbe, 0x0b, 0x16, 0x7f, 0x5c, 0xea, 0x64, 0x68, 0xf4, 0x7c, 0x36, - 0x4b, 0xc5, 0x2c, 0xcc, 0x74, 0x2e, 0x14, 0x0c, 0xf6, 0x01, 0xd4, 0x49, 0x59, 0x87, 0xb3, 0x3a, - 0x9a, 0x28, 0xe9, 0xf0, 0xf0, 0x9f, 0x2f, 0x7a, 0xd6, 0xbf, 0x5f, 0xf4, 0xac, 0xff, 0xbe, 0xe8, - 0x59, 0x7f, 0xfa, 0x5f, 0x6f, 0xef, 0xae, 0x4e, 0xff, 0xc1, 0xbe, 0xff, 0xff, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x7b, 0x22, 0x9e, 0xfd, 0x17, 0x13, 0x00, 0x00, + // 1551 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xdd, 0x6e, 0x1b, 0xc5, + 0x17, 0xcf, 0x7a, 0xd7, 0x5f, 0xc7, 0x8e, 0x93, 0x4e, 0xd3, 0xfe, 0xf7, 0x5f, 0x52, 0xe3, 0xae, + 0x50, 0xe5, 0x12, 0x94, 0x8a, 0x00, 0x15, 0xaa, 0x04, 0x28, 0x8e, 0x53, 0xb2, 0x6a, 0x9b, 0x96, + 0x49, 0x08, 0x5c, 0x70, 0xb3, 0xb1, 0x07, 0x77, 0xc5, 0xda, 0x6b, 0xd6, 0xeb, 0x3a, 0x11, 0x0f, + 0x00, 0x8f, 0xc0, 0x0b, 0x20, 0x1e, 0x05, 0xee, 0xe0, 0x92, 0x4b, 0x54, 0x5e, 0x04, 0x9d, 0x33, + 0xb3, 0xbb, 0xb3, 0x6b, 0xb7, 0xaa, 0x2a, 0xee, 0xf6, 0x7c, 0xcc, 0xf9, 0xf8, 0xcd, 0xf9, 0x18, + 0x1b, 0x9a, 0xd3, 0xf9, 0x79, 0xe0, 0x0f, 0x76, 0xa7, 0x51, 0x18, 0x87, 0xac, 0x34, 0x3d, 0x77, + 0x2e, 0xc1, 0xe4, 0xe1, 0x82, 0xd9, 0x50, 0x3d, 0x08, 0x83, 0xf9, 0x78, 0x32, 0xb3, 0x8d, 0x8e, + 0xd9, 0xb5, 0x78, 0x42, 0x32, 0x06, 0xd6, 0x43, 0x71, 0x39, 0xb3, 0xcd, 0x8e, 0xd9, 0xad, 0x73, + 0xfa, 0x46, 0x6d, 0x1e, 0x7a, 0x91, 0x3f, 0x19, 0xd9, 0x56, 0xc7, 0xe8, 0x36, 0x79, 0x42, 0xb2, + 0x2d, 0x28, 0xbb, 0x93, 0xa1, 0xb8, 0xb0, 0xcb, 0x1d, 0xa3, 0x5b, 0xe7, 0x92, 0x40, 0xee, 0x03, + 0x5f, 0x04, 0x43, 0xbb, 0x22, 0xb9, 0x44, 0x38, 0x5d, 0xa8, 0xf3, 0x70, 0xf1, 0xd8, 0x8b, 0x23, + 0xff, 0x82, 0xbd, 0x05, 0x16, 0x0f, 0x17, 0xd2, 0x7b, 0x63, 0xaf, 0xba, 0x3b, 0x3d, 0xdf, 0xe5, + 0xe1, 0x82, 0x13, 0xd3, 0xd9, 0x87, 0xfa, 0x89, 0x3f, 0x9a, 0x88, 0x21, 0x86, 0xfa, 0x7f, 0x30, + 0x9f, 0x86, 0xa8, 0x68, 0xe8, 0x8a, 0xc8, 0x43, 0xd1, 0xb1, 0x18, 0xd9, 0xa5, 0x82, 0xe8, 0x58, + 0x8c, 0x9c, 0x8f, 0xa1, 0xc5, 0xc3, 0x85, 0x3b, 0x14, 0x93, 0xd8, 0xff, 0xd6, 0x17, 0x11, 0x25, + 0x96, 0x7a, 0xb4, 0xa4, 0xa3, 0x34, 0xd9, 0x52, 0x96, 0xac, 0x73, 0x03, 0x2a, 0x6e, 0xff, 0x91, + 0x3f, 0x8b, 0xd9, 0x26, 0x98, 0x6e, 0x3f, 0x39, 0x80, 0x9f, 0xce, 0x01, 0x5c, 0x39, 0xbc, 0x88, + 0x23, 0x6f, 0x10, 0x8b, 0xa1, 0xdb, 0x97, 0x90, 0xb1, 0x16, 0x94, 0xdc, 0x3e, 0xc5, 0x67, 0xf1, + 0x92, 0xdb, 0x67, 0x6d, 0xb0, 0xce, 0xbc, 0x40, 0x1a, 0x6d, 0xec, 0x01, 0x86, 0x25, 0x0d, 0x72, + 0xe2, 0x3b, 0xdf, 0xe4, 0x8c, 0x28, 0x3c, 0xae, 0x43, 0x85, 0x50, 0x92, 0xee, 0xea, 0x5c, 0x51, + 0xec, 0x6e, 0x76, 0x51, 0xd2, 0xde, 0x35, 0xb4, 0xb7, 0x14, 0x44, 0x7a, 0x7f, 0xce, 0x4d, 0xa8, + 0x3e, 0x14, 0x97, 0x14, 0x7f, 0x92, 0x9d, 0xa1, 0x65, 0xf7, 0x87, 0x01, 0x57, 0xd3, 0xd3, 0xa7, + 0xde, 0x79, 0x20, 0xce, 0xbc, 0x60, 0x2e, 0x58, 0x3b, 0xc9, 0xd5, 0xc8, 0xc7, 0x7c, 0xb4, 0x46, + 0x99, 0xb3, 0x5b, 0x29, 0x52, 0xa8, 0xd0, 0x40, 0x05, 0xe5, 0xe6, 0x68, 0x4d, 0x55, 0xc9, 0x36, + 0xd4, 0x7a, 0x27, 0x2e, 0x99, 0xb3, 0xcd, 0x8e, 0xd1, 0x35, 0x8f, 0xd6, 0x78, 0xca, 0x61, 0x37, + 0xa0, 0xfa, 0x78, 0x1e, 0x8b, 0x0b, 0xb7, 0x4f, 0x35, 0x64, 0x1d, 0xad, 0xf1, 0x84, 0x81, 0x27, + 0xe9, 0xf3, 0xa1, 0xb8, 0x94, 0x85, 0x84, 0x27, 0x13, 0x0e, 0xdb, 0x02, 0xab, 0x17, 0x86, 0x01, + 0x15, 0x53, 0x0d, 0xbd, 0x21, 0xd5, 0xab, 0x42, 0x99, 0x0c, 0x3b, 0x17, 0xb0, 0x95, 0x4f, 0x48, + 0x5d, 0x0b, 0x03, 0x13, 0xed, 0x19, 0xca, 0x1e, 0x12, 0x6c, 0x93, 0xae, 0xaa, 0xa4, 0xfc, 0xe3, + 0x65, 0xdd, 0x85, 0x0a, 0x99, 0x91, 0x05, 0xdf, 0xd8, 0xfb, 0x5f, 0x0e, 0xde, 0x0c, 0x20, 0xae, + 0xd4, 0x7a, 0x75, 0xc2, 0xf7, 0x49, 0xe4, 0xf6, 0x9d, 0x4f, 0x8a, 0x50, 0xd2, 0x9d, 0x21, 0xec, + 0xc7, 0xde, 0x58, 0x48, 0xcf, 0x9c, 0xbe, 0x91, 0x77, 0x7a, 0x39, 0x15, 0xe4, 0xba, 0xce, 0xe9, + 0xdb, 0x99, 0x43, 0x2b, 0x7f, 0x1c, 0x83, 0xd1, 0x8a, 0x60, 0x65, 0x30, 0x24, 0x4f, 0xab, 0x63, + 0xaf, 0x58, 0x1d, 0xf6, 0xf2, 0x89, 0x62, 0x81, 0x7c, 0x0a, 0xd6, 0x53, 0xcf, 0x8f, 0x96, 0xca, + 0x76, 0x53, 0xe2, 0x65, 0x52, 0x84, 0xa6, 0x04, 0xbe, 0x7c, 0x10, 0xce, 0x27, 0xb1, 0x04, 0x8c, + 0x4b, 0xc2, 0xf9, 0x0c, 0xea, 0x78, 0x5e, 0xe6, 0xba, 0x2d, 0x8d, 0xa9, 0xba, 0xa9, 0xa1, 0x77, + 0xa4, 0xb9, 0x74, 0x91, 0xce, 0x81, 0x92, 0x3e, 0x07, 0x7a, 0x00, 0x28, 0x9d, 0x49, 0x0b, 0x6d, + 0x28, 0x13, 0xa5, 0x52, 0xce, 0x4c, 0x48, 0xf6, 0x4b, 0x6c, 0xdc, 0xc4, 0xb9, 0x13, 0xdf, 0xfb, + 0x10, 0xc5, 0xb2, 0xe2, 0x30, 0x02, 0x93, 0xab, 0x9a, 0x08, 0xa1, 0x26, 0x81, 0x0a, 0x17, 0x99, + 0x01, 0x43, 0x33, 0x80, 0x5c, 0x9c, 0x0f, 0xfd, 0x24, 0x37, 0x22, 0xb0, 0x0b, 0x79, 0xb8, 0xc8, + 0x60, 0x50, 0x14, 0x7b, 0x3b, 0xf1, 0x62, 0x51, 0x9e, 0x75, 0xea, 0x0f, 0xf4, 0x9f, 0x38, 0xfc, + 0x1a, 0xe0, 0xf3, 0x28, 0x9c, 0x4f, 0x09, 0x22, 0xe6, 0x40, 0x99, 0x28, 0x95, 0x53, 0x13, 0xd5, + 0x93, 0x78, 0xb8, 0x14, 0xad, 0x06, 0x17, 0x2f, 0x61, 0x7f, 0x34, 0x92, 0xed, 0xc3, 0xf1, 0xd3, + 0xf9, 0x01, 0x6a, 0x67, 0x5e, 0x90, 0x4a, 0xcf, 0xbc, 0x40, 0xa5, 0x8a, 0x9f, 0x79, 0x2b, 0x66, + 0x62, 0xe5, 0x06, 0xd4, 0x1e, 0x04, 0xa1, 0x17, 0xa3, 0x32, 0x9a, 0x32, 0x78, 0x4a, 0xb3, 0x1d, + 0x80, 0xbe, 0x18, 0xf8, 0x63, 0x2f, 0x40, 0xa9, 0x95, 0xb5, 0xb3, 0xe2, 0x72, 0x4d, 0xec, 0x7c, + 0x04, 0x55, 0x45, 0xad, 0x06, 0x1a, 0xb9, 0x27, 0x03, 0x2f, 0x10, 0x89, 0x7f, 0x22, 0x9c, 0x5f, + 0x0d, 0x68, 0x7e, 0x31, 0x17, 0xd1, 0x25, 0x17, 0xdf, 0xcf, 0xc5, 0x2c, 0x46, 0x35, 0xa2, 0x93, + 0x3b, 0x20, 0x02, 0xd1, 0x3e, 0x79, 0xe6, 0x45, 0x43, 0x59, 0xbc, 0x16, 0x57, 0x14, 0xdd, 0x82, + 0x18, 0x87, 0xb1, 0xa0, 0x61, 0x50, 0xe3, 0x8a, 0x62, 0x3b, 0xd0, 0x3c, 0x1c, 0x9f, 0x8b, 0xe1, + 0x50, 0x0c, 0xfb, 0x5e, 0xec, 0xd9, 0xb5, 0xfc, 0xee, 0xc8, 0x09, 0xd9, 0x3b, 0xb0, 0xfe, 0x34, + 0x12, 0xa7, 0x91, 0x37, 0x99, 0x05, 0x5e, 0x2c, 0x86, 0x76, 0x9d, 0x6c, 0xe5, 0x99, 0xce, 0x23, + 0x58, 0x57, 0x81, 0xce, 0xa6, 0xe1, 0x64, 0x26, 0x10, 0xe2, 0xc3, 0x28, 0x52, 0x71, 0xe2, 0x27, + 0xbb, 0x03, 0x55, 0x2e, 0x66, 0xf3, 0x20, 0x4e, 0x7a, 0x6c, 0x03, 0x1d, 0x26, 0xa7, 0xe6, 0x41, + 0xcc, 0x13, 0xb9, 0xf3, 0x4b, 0x19, 0x1a, 0x9a, 0x20, 0xed, 0x7a, 0x9c, 0x5c, 0xeb, 0xb2, 0xeb, + 0x71, 0x67, 0xf1, 0x70, 0xb1, 0xb4, 0xce, 0xb0, 0x52, 0x9b, 0x60, 0x1c, 0xab, 0x72, 0x30, 0x8e, + 0xb3, 0xc6, 0x30, 0x57, 0x37, 0x06, 0xae, 0xf0, 0x67, 0xde, 0x64, 0x24, 0x86, 0x74, 0x8b, 0x35, + 0x9e, 0x90, 0xac, 0x9b, 0x95, 0x0c, 0x21, 0xa8, 0x2a, 0x30, 0xe1, 0xf1, 0xac, 0xa0, 0x64, 0xbd, + 0xe3, 0xe0, 0xaf, 0xca, 0x1b, 0x90, 0x14, 0xbb, 0x07, 0xad, 0x27, 0xc1, 0x30, 0xab, 0xe8, 0x99, + 0xc2, 0xba, 0x85, 0x76, 0x32, 0x36, 0x2f, 0x68, 0xb1, 0xfb, 0xc5, 0xad, 0x4b, 0xa8, 0x37, 0xf6, + 0x98, 0xca, 0x53, 0x93, 0xf0, 0xe2, 0x7e, 0xde, 0xd1, 0x96, 0xbe, 0x0d, 0x74, 0x6c, 0x1d, 0x8f, + 0xa5, 0x4c, 0xae, 0x3d, 0x0a, 0x76, 0xf5, 0x19, 0x62, 0x37, 0x48, 0xbb, 0x95, 0x20, 0x24, 0xb9, + 0x5c, 0x9f, 0x32, 0x3b, 0xda, 0xd0, 0xb2, 0x9b, 0x99, 0xf1, 0x94, 0xc9, 0xb5, 0xa1, 0x76, 0xb0, + 0x62, 0x41, 0xdb, 0xeb, 0x74, 0xa8, 0xb8, 0x7d, 0xa5, 0x90, 0xaf, 0x58, 0xe8, 0xf7, 0x8b, 0xd3, + 0xdd, 0x6e, 0x65, 0x50, 0xe4, 0x25, 0xbc, 0xb8, 0x07, 0x76, 0xb4, 0x97, 0x92, 0xbd, 0x91, 0x45, + 0x9b, 0x32, 0xb9, 0xf6, 0x92, 0x7a, 0x1f, 0x1a, 0xfa, 0x45, 0x6d, 0x92, 0xfa, 0x46, 0xfe, 0xa2, + 0x66, 0x5c, 0xd7, 0x71, 0x7e, 0x2b, 0xc1, 0xba, 0x3b, 0x9e, 0x86, 0x51, 0xac, 0x35, 0xa8, 0x7c, + 0xc7, 0x19, 0x2b, 0xdf, 0x71, 0xa5, 0xc2, 0xe8, 0xa4, 0x46, 0xa5, 0xd1, 0x62, 0x71, 0x49, 0x68, + 0xa5, 0x64, 0xe5, 0x4a, 0x69, 0x1b, 0xea, 0x72, 0xf3, 0xa0, 0xa8, 0x4c, 0xa2, 0x8c, 0x21, 0x5f, + 0x96, 0x0b, 0x7a, 0x59, 0x54, 0xe9, 0x95, 0x92, 0x90, 0xac, 0x0d, 0x20, 0xd5, 0x48, 0x58, 0x23, + 0xa1, 0xc6, 0x41, 0xf9, 0xa9, 0x3f, 0x16, 0xb3, 0xd8, 0x1b, 0x4f, 0x67, 0x76, 0xa5, 0x63, 0x76, + 0x4d, 0xae, 0x71, 0xd8, 0x6d, 0x68, 0x51, 0x12, 0x07, 0x91, 0xc0, 0x4e, 0xdf, 0x8f, 0xa9, 0x14, + 0x4d, 0x5e, 0xe0, 0xa2, 0x1e, 0xa5, 0x95, 0xe9, 0x81, 0xd4, 0xcb, 0x73, 0x69, 0xd2, 0x06, 0xc2, + 0x8b, 0xa8, 0xd8, 0x6a, 0x5c, 0x12, 0xce, 0x5f, 0x25, 0x60, 0x12, 0x49, 0xf9, 0x4a, 0xf8, 0xcf, + 0xe0, 0x7c, 0x35, 0x6c, 0x79, 0x70, 0xaa, 0x4b, 0xe0, 0x5c, 0x4f, 0x5f, 0x35, 0x12, 0x18, 0x45, + 0xb1, 0x0e, 0x34, 0x92, 0x45, 0x80, 0x42, 0x44, 0xd5, 0xe0, 0x3a, 0x8b, 0x39, 0xd0, 0x3c, 0x89, + 0xf1, 0x69, 0xaf, 0x54, 0xea, 0x64, 0x3b, 0xc7, 0x5b, 0x01, 0x2d, 0xbc, 0x26, 0xb4, 0x8d, 0x57, + 0x43, 0xdb, 0xd4, 0xa1, 0xfd, 0xd1, 0x80, 0xe6, 0x7e, 0x1c, 0x8e, 0xfd, 0x01, 0x17, 0x83, 0x30, + 0x1a, 0xbe, 0x1c, 0x54, 0x09, 0x5f, 0x49, 0x87, 0xaf, 0x0b, 0xa6, 0xfb, 0x3c, 0x52, 0xa3, 0xf3, + 0x3a, 0xad, 0xeb, 0xa5, 0x5b, 0xe2, 0xa8, 0xc2, 0x6e, 0x41, 0xc9, 0x8d, 0xa8, 0x66, 0x1b, 0x7b, + 0x57, 0x32, 0xc5, 0x44, 0xa7, 0xe4, 0x46, 0xce, 0x7b, 0xb0, 0x25, 0x03, 0x49, 0x44, 0x6a, 0x57, + 0x6c, 0x41, 0xf9, 0x30, 0x8a, 0xc2, 0x64, 0x5b, 0x48, 0x02, 0xdf, 0xa3, 0xe9, 0x82, 0xc1, 0xcb, + 0x78, 0x93, 0x9a, 0x58, 0xf5, 0x23, 0xac, 0x03, 0x8d, 0xe3, 0x30, 0xfe, 0x2a, 0xf2, 0x63, 0x9a, + 0x26, 0x72, 0xe6, 0xeb, 0x2c, 0xe7, 0x0e, 0x5c, 0x2b, 0x78, 0xce, 0x96, 0x1a, 0x96, 0x91, 0x99, + 0xfd, 0x90, 0x39, 0x81, 0xab, 0xa9, 0xaa, 0xdb, 0x7f, 0xa3, 0x18, 0x97, 0x8d, 0xbe, 0xab, 0x65, + 0x4e, 0x46, 0x95, 0xfb, 0x15, 0xd9, 0x38, 0x3d, 0xb0, 0x15, 0x9a, 0xf2, 0x97, 0xa4, 0x8a, 0xe0, + 0xcc, 0x17, 0x8b, 0x97, 0x3d, 0xa0, 0x69, 0xe7, 0x97, 0xe8, 0xf7, 0x27, 0x7d, 0x3b, 0x3f, 0x95, + 0x60, 0x6b, 0x95, 0x91, 0xac, 0xa0, 0x0c, 0xad, 0xa0, 0xd8, 0x1e, 0x94, 0x9f, 0xfb, 0x62, 0x91, + 0xac, 0xf1, 0x6d, 0xed, 0xb2, 0x97, 0x62, 0xe0, 0x52, 0x15, 0x1b, 0x69, 0x7f, 0x10, 0xfb, 0xe1, + 0x24, 0x79, 0x10, 0x4a, 0x0a, 0x3d, 0xf4, 0x82, 0x70, 0xf0, 0x9d, 0xfc, 0x2d, 0xc3, 0x25, 0xb1, + 0xa2, 0x31, 0xca, 0xaf, 0xd9, 0x18, 0x95, 0x95, 0x8d, 0xd1, 0x85, 0x8d, 0x2f, 0xa7, 0x43, 0x2f, + 0x16, 0x87, 0x17, 0xfe, 0x2c, 0x16, 0x93, 0x81, 0xb0, 0xab, 0x94, 0x51, 0x91, 0xed, 0x9c, 0xe4, + 0x96, 0x00, 0x4e, 0x8f, 0xfd, 0xd1, 0x28, 0x12, 0x23, 0x2f, 0x4e, 0x60, 0xcc, 0x18, 0xec, 0x36, + 0x54, 0x48, 0x39, 0x41, 0xa2, 0xb8, 0xd5, 0x95, 0xb4, 0xb7, 0xf9, 0xfb, 0x8b, 0xb6, 0xf1, 0xe7, + 0x8b, 0xb6, 0xf1, 0xf7, 0x8b, 0xb6, 0xf1, 0xf3, 0x3f, 0xed, 0xb5, 0xf3, 0x0a, 0xfd, 0x91, 0xf0, + 0xc1, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3f, 0xf7, 0x85, 0x80, 0x58, 0x10, 0x00, 0x00, } func (m *Row) Marshal() (dAtA []byte, err error) { @@ -2953,20 +2595,6 @@ func (m *Row) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x1a } } - if len(m.Attrs) > 0 { - for iNdEx := len(m.Attrs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Attrs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintPublic(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } if len(m.Columns) > 0 { dAtA2 := make([]byte, len(m.Columns)*10) var j1 int @@ -3987,167 +3615,6 @@ func (m *Decimal) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ColumnAttrSet) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ColumnAttrSet) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ColumnAttrSet) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintPublic(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0x1a - } - if len(m.Attrs) > 0 { - for iNdEx := len(m.Attrs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Attrs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintPublic(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.ID != 0 { - i = encodeVarintPublic(dAtA, i, uint64(m.ID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Attr) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Attr) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Attr) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.FloatValue != 0 { - i -= 8 - encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.FloatValue)))) - i-- - dAtA[i] = 0x31 - } - if m.BoolValue { - i-- - if m.BoolValue { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } - if m.IntValue != 0 { - i = encodeVarintPublic(dAtA, i, uint64(m.IntValue)) - i-- - dAtA[i] = 0x20 - } - if len(m.StringValue) > 0 { - i -= len(m.StringValue) - copy(dAtA[i:], m.StringValue) - i = encodeVarintPublic(dAtA, i, uint64(len(m.StringValue))) - i-- - dAtA[i] = 0x1a - } - if m.Type != 0 { - i = encodeVarintPublic(dAtA, i, uint64(m.Type)) - i-- - dAtA[i] = 0x10 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintPublic(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AttrMap) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AttrMap) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AttrMap) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Attrs) > 0 { - for iNdEx := len(m.Attrs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Attrs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintPublic(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - func (m *QueryRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -4196,26 +3663,6 @@ func (m *QueryRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x42 } } - if m.ExcludeColumns { - i-- - if m.ExcludeColumns { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x38 - } - if m.ExcludeRowAttrs { - i-- - if m.ExcludeRowAttrs { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x30 - } if m.Remote { i-- if m.Remote { @@ -4226,16 +3673,6 @@ func (m *QueryRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x28 } - if m.ColumnAttrs { - i-- - if m.ColumnAttrs { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } if len(m.Shards) > 0 { dAtA15 := make([]byte, len(m.Shards)*10) var j14 int @@ -4288,20 +3725,6 @@ func (m *QueryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.ColumnAttrSets) > 0 { - for iNdEx := len(m.ColumnAttrSets) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ColumnAttrSets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintPublic(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } if len(m.Results) > 0 { for iNdEx := len(m.Results) - 1; iNdEx >= 0; iNdEx-- { { @@ -5236,84 +4659,6 @@ func (m *ImportRoaringRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ImportColumnAttrsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ImportColumnAttrsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ImportColumnAttrsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.IndexCreatedAt != 0 { - i = encodeVarintPublic(dAtA, i, uint64(m.IndexCreatedAt)) - i-- - dAtA[i] = 0x30 - } - if len(m.ColumnIDs) > 0 { - dAtA44 := make([]byte, len(m.ColumnIDs)*10) - var j43 int - for _, num := range m.ColumnIDs { - for num >= 1<<7 { - dAtA44[j43] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j43++ - } - dAtA44[j43] = uint8(num) - j43++ - } - i -= j43 - copy(dAtA[i:], dAtA44[:j43]) - i = encodeVarintPublic(dAtA, i, uint64(j43)) - i-- - dAtA[i] = 0x2a - } - if len(m.AttrVals) > 0 { - for iNdEx := len(m.AttrVals) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.AttrVals[iNdEx]) - copy(dAtA[i:], m.AttrVals[iNdEx]) - i = encodeVarintPublic(dAtA, i, uint64(len(m.AttrVals[iNdEx]))) - i-- - dAtA[i] = 0x22 - } - } - if len(m.AttrKey) > 0 { - i -= len(m.AttrKey) - copy(dAtA[i:], m.AttrKey) - i = encodeVarintPublic(dAtA, i, uint64(len(m.AttrKey))) - i-- - dAtA[i] = 0x1a - } - if m.Shard != 0 { - i = encodeVarintPublic(dAtA, i, uint64(m.Shard)) - i-- - dAtA[i] = 0x10 - } - if len(m.Index) > 0 { - i -= len(m.Index) - copy(dAtA[i:], m.Index) - i = encodeVarintPublic(dAtA, i, uint64(len(m.Index))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *GroupCounts) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -5386,12 +4731,6 @@ func (m *Row) Size() (n int) { } n += 1 + sovPublic(uint64(l)) + l } - if len(m.Attrs) > 0 { - for _, e := range m.Attrs { - l = e.Size() - n += 1 + l + sovPublic(uint64(l)) - } - } if len(m.Keys) > 0 { for _, s := range m.Keys { l = len(s) @@ -5894,81 +5233,6 @@ func (m *Decimal) Size() (n int) { return n } -func (m *ColumnAttrSet) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ID != 0 { - n += 1 + sovPublic(uint64(m.ID)) - } - if len(m.Attrs) > 0 { - for _, e := range m.Attrs { - l = e.Size() - n += 1 + l + sovPublic(uint64(l)) - } - } - l = len(m.Key) - if l > 0 { - n += 1 + l + sovPublic(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Attr) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovPublic(uint64(l)) - } - if m.Type != 0 { - n += 1 + sovPublic(uint64(m.Type)) - } - l = len(m.StringValue) - if l > 0 { - n += 1 + l + sovPublic(uint64(l)) - } - if m.IntValue != 0 { - n += 1 + sovPublic(uint64(m.IntValue)) - } - if m.BoolValue { - n += 2 - } - if m.FloatValue != 0 { - n += 9 - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AttrMap) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Attrs) > 0 { - for _, e := range m.Attrs { - l = e.Size() - n += 1 + l + sovPublic(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - func (m *QueryRequest) Size() (n int) { if m == nil { return 0 @@ -5986,18 +5250,9 @@ func (m *QueryRequest) Size() (n int) { } n += 1 + sovPublic(uint64(l)) + l } - if m.ColumnAttrs { - n += 2 - } if m.Remote { n += 2 } - if m.ExcludeRowAttrs { - n += 2 - } - if m.ExcludeColumns { - n += 2 - } if len(m.EmbeddedData) > 0 { for _, e := range m.EmbeddedData { l = e.Size() @@ -6029,12 +5284,6 @@ func (m *QueryResponse) Size() (n int) { n += 1 + l + sovPublic(uint64(l)) } } - if len(m.ColumnAttrSets) > 0 { - for _, e := range m.ColumnAttrSets { - l = e.Size() - n += 1 + l + sovPublic(uint64(l)) - } - } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -6444,45 +5693,6 @@ func (m *ImportRoaringRequest) Size() (n int) { return n } -func (m *ImportColumnAttrsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Index) - if l > 0 { - n += 1 + l + sovPublic(uint64(l)) - } - if m.Shard != 0 { - n += 1 + sovPublic(uint64(m.Shard)) - } - l = len(m.AttrKey) - if l > 0 { - n += 1 + l + sovPublic(uint64(l)) - } - if len(m.AttrVals) > 0 { - for _, s := range m.AttrVals { - l = len(s) - n += 1 + l + sovPublic(uint64(l)) - } - } - if len(m.ColumnIDs) > 0 { - l = 0 - for _, e := range m.ColumnIDs { - l += sovPublic(uint64(e)) - } - n += 1 + sovPublic(uint64(l)) + l - } - if m.IndexCreatedAt != 0 { - n += 1 + sovPublic(uint64(m.IndexCreatedAt)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - func (m *GroupCounts) Size() (n int) { if m == nil { return 0 @@ -6616,40 +5826,6 @@ func (m *Row) Unmarshal(dAtA []byte) error { } else { return fmt.Errorf("proto: wrong wireType = %d for field Columns", wireType) } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Attrs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPublic - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthPublic - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Attrs = append(m.Attrs, &Attr{}) - if err := m.Attrs[len(m.Attrs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Keys", wireType) @@ -9190,420 +8366,6 @@ func (m *Decimal) Unmarshal(dAtA []byte) error { } return nil } -func (m *ColumnAttrSet) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ColumnAttrSet: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ColumnAttrSet: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - m.ID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Attrs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPublic - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthPublic - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Attrs = append(m.Attrs, &Attr{}) - if err := m.Attrs[len(m.Attrs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPublic - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPublic - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPublic(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthPublic - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthPublic - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Attr) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Attr: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Attr: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPublic - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPublic - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StringValue", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPublic - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPublic - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StringValue = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IntValue", wireType) - } - m.IntValue = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.IntValue |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BoolValue", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.BoolValue = bool(v != 0) - case 6: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field FloatValue", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.FloatValue = float64(math.Float64frombits(v)) - default: - iNdEx = preIndex - skippy, err := skipPublic(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthPublic - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthPublic - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AttrMap) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AttrMap: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AttrMap: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Attrs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPublic - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthPublic - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Attrs = append(m.Attrs, &Attr{}) - if err := m.Attrs[len(m.Attrs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPublic(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthPublic - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthPublic - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *QueryRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -9741,26 +8503,6 @@ func (m *QueryRequest) Unmarshal(dAtA []byte) error { } else { return fmt.Errorf("proto: wrong wireType = %d for field Shards", wireType) } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ColumnAttrs", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ColumnAttrs = bool(v != 0) case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Remote", wireType) @@ -9781,46 +8523,6 @@ func (m *QueryRequest) Unmarshal(dAtA []byte) error { } } m.Remote = bool(v != 0) - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExcludeRowAttrs", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ExcludeRowAttrs = bool(v != 0) - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExcludeColumns", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ExcludeColumns = bool(v != 0) case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field EmbeddedData", wireType) @@ -9995,40 +8697,6 @@ func (m *QueryResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ColumnAttrSets", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPublic - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthPublic - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ColumnAttrSets = append(m.ColumnAttrSets, &ColumnAttrSet{}) - if err := m.ColumnAttrSets[len(m.ColumnAttrSets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPublic(dAtA[iNdEx:]) @@ -12798,270 +11466,6 @@ func (m *ImportRoaringRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *ImportColumnAttrsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ImportColumnAttrsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ImportColumnAttrsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPublic - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPublic - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Index = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Shard", wireType) - } - m.Shard = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Shard |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AttrKey", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPublic - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPublic - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AttrKey = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AttrVals", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPublic - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPublic - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AttrVals = append(m.AttrVals, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 5: - if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ColumnIDs = append(m.ColumnIDs, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthPublic - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthPublic - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.ColumnIDs) == 0 { - m.ColumnIDs = make([]uint64, 0, elementCount) - } - for iNdEx < postIndex { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ColumnIDs = append(m.ColumnIDs, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field ColumnIDs", wireType) - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IndexCreatedAt", wireType) - } - m.IndexCreatedAt = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.IndexCreatedAt |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipPublic(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthPublic - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthPublic - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *GroupCounts) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/pb/public.proto b/pb/public.proto index 770273aa0..1ecc2fabb 100644 --- a/pb/public.proto +++ b/pb/public.proto @@ -5,7 +5,6 @@ package pb; message Row { repeated uint64 Columns = 1; repeated string Keys = 3; - repeated Attr Attrs = 2; bytes Roaring = 4; string Index = 5; string Field = 6; @@ -117,32 +116,10 @@ message Decimal { int64 Scale = 2; } -message ColumnAttrSet { - uint64 ID = 1; - string Key = 3; - repeated Attr Attrs = 2; -} - -message Attr { - string Key = 1; - uint64 Type = 2; - string StringValue = 3; - int64 IntValue = 4; - bool BoolValue = 5; - double FloatValue = 6; -} - -message AttrMap { - repeated Attr Attrs = 1; -} - message QueryRequest { string Query = 1; repeated uint64 Shards = 2; - bool ColumnAttrs = 3; bool Remote = 5; - bool ExcludeRowAttrs = 6; - bool ExcludeColumns = 7; repeated Row EmbeddedData = 8; bool PreTranslated = 9; } @@ -150,7 +127,6 @@ message QueryRequest { message QueryResponse { string Err = 1; repeated QueryResult Results = 2; - repeated ColumnAttrSet ColumnAttrSets = 3; } message QueryResult { @@ -254,15 +230,6 @@ message ImportRoaringRequest { bool UpdateExistence = 7; } -message ImportColumnAttrsRequest { - string Index = 1; - int64 Shard = 2; - string AttrKey = 3; - repeated string AttrVals = 4; - repeated uint64 ColumnIDs = 5; - int64 IndexCreatedAt = 6; -} - message GroupCounts{ string Aggregate = 1; repeated GroupCount Groups = 2; diff --git a/pilosa.go b/pilosa.go index 01bd0b425..de309a21f 100644 --- a/pilosa.go +++ b/pilosa.go @@ -15,7 +15,6 @@ package pilosa import ( - "encoding/json" "os" "regexp" "time" @@ -148,35 +147,6 @@ func newPreconditionFailedError(err error) PreconditionFailedError { // Regular expression to validate index and field names. var nameRegexp = regexp.MustCompile(`^[a-z][a-z0-9_-]{0,229}$`) -// ColumnAttrSet represents a set of attributes for a vertical column in an index. -// Can have a set of attributes attached to it. -type ColumnAttrSet struct { - ID uint64 `json:"id"` - Key string `json:"key,omitempty"` - Attrs map[string]interface{} `json:"attrs,omitempty"` -} - -// MarshalJSON marshals the ColumnAttrSet to JSON such that -// either a Key or an ID is included. -func (cas ColumnAttrSet) MarshalJSON() ([]byte, error) { - if cas.Key != "" { - return json.Marshal(struct { - Key string `json:"key,omitempty"` - Attrs map[string]interface{} `json:"attrs,omitempty"` - }{ - Key: cas.Key, - Attrs: cas.Attrs, - }) - } - return json.Marshal(struct { - ID uint64 `json:"id"` - Attrs map[string]interface{} `json:"attrs,omitempty"` - }{ - ID: cas.ID, - Attrs: cas.Attrs, - }) -} - // TimeFormat is the go-style time format used to parse string dates. const TimeFormat = "2006-01-02T15:04" diff --git a/pilosa_internal_test.go b/pilosa_internal_test.go index 3de8cfbbf..c1e1b90e0 100644 --- a/pilosa_internal_test.go +++ b/pilosa_internal_test.go @@ -16,7 +16,6 @@ package pilosa import ( "bytes" - "io" "reflect" "testing" @@ -48,34 +47,6 @@ func TestValidateNameInvalid(t *testing.T) { } } -// memAttrStore represents an in-memory implementation of the AttrStore interface. -type memAttrStore struct { - store map[uint64]map[string]interface{} -} - -func (s *memAttrStore) Path() string { return "" } -func (s *memAttrStore) Open() error { return nil } -func (s *memAttrStore) Close() error { return nil } -func (s *memAttrStore) Attrs(id uint64) (m map[string]interface{}, err error) { - return s.store[id], nil -} -func (s *memAttrStore) SetAttrs(id uint64, m map[string]interface{}) error { - s.store[id] = m - return nil -} -func (s *memAttrStore) SetBulkAttrs(m map[uint64]map[string]interface{}) error { - for id, v := range m { - s.store[id] = v - } - return nil -} -func (s *memAttrStore) Blocks() ([]AttrBlock, error) { return nil, nil } -func (s *memAttrStore) BlockData(i uint64) (map[uint64]map[string]interface{}, error) { - return nil, nil -} - -func (s *memAttrStore) WriteTo(w io.Writer) (int64, error) { return 0, nil } - func TestAPI_CombineForExistence(t *testing.T) { bm := roaring.NewBitmap(pos(1, 1), pos(1, 2), pos(1, 3), pos(1, 65537), pos(1, 65538), pos(2, 1), pos(2, 2), pos(2, 5), pos(2, 65537), pos(2, 65538)) buf := new(bytes.Buffer) diff --git a/pql/ast.go b/pql/ast.go index 1147cb00a..1782a47c7 100644 --- a/pql/ast.go +++ b/pql/ast.go @@ -282,7 +282,7 @@ func (q *Query) WriteCallN() int { var n int for _, call := range q.Calls { switch call.Name { - case "Set", "Clear", "SetRowAttrs", "SetColumnAttrs", "ClearRow", "Store", "SetBit": + case "Set", "Clear", "ClearRow", "Store", "SetBit": n++ } } @@ -506,10 +506,7 @@ var callInfoByFunc = map[string]callInfo{ "Options": { allowUnknown: false, prototypes: map[string]interface{}{ - "excludeRowAttrs": true, - "excludeColumns": true, - "columnAttrs": true, - "shards": nil, + "shards": nil, }, }, "Set": { @@ -528,21 +525,6 @@ var callInfoByFunc = map[string]callInfo{ "_col": stringOrInt64, }, }, - "SetRowAttrs": { - allowUnknown: true, - prototypes: map[string]interface{}{ - "_field": "", - "field": "", - "_row": stringOrInt64, - }, - }, - "SetColumnAttrs": { - allowUnknown: true, - prototypes: map[string]interface{}{ - "_field": "", - "_col": stringOrInt64, - }, - }, "IncludesColumn": { allowUnknown: false, prototypes: map[string]interface{}{ @@ -552,7 +534,7 @@ var callInfoByFunc = map[string]callInfo{ } // We want to allow case-insensitive names, but we want to continue using -// friendly easy-to-read names like "SetRowAttrs", not "setrowattrs". So, +// friendly easy-to-read names like "SetBit", not "setbit". So, // we make a map; put in a ToLower() string, get back the canonical // capitalization. This might not have seemed like the best strategy if we // didn't already have so much code relying on the exact strings. @@ -888,13 +870,10 @@ func (c *Call) HasConditionArg() bool { // TranslateInfo returns the relevant translation fields. func (c *Call) TranslateInfo(columnLabel, rowLabel string) (colKey, rowKey, fieldName string) { switch c.Name { - case "Set", "Clear", "Row", "Range", "SetColumnAttrs", "ClearRow": + case "Set", "Clear", "Row", "Range", "ClearRow": // Positional args in new PQL syntax require special handling here. fieldName, _ = c.FieldArg() return "_" + columnLabel, fieldName, fieldName - case "SetRowAttrs": - // Positional args in new PQL syntax require special handling here. - return "", "_" + rowLabel, c.ArgString("_field") case "Rows": return "column", "previous", c.ArgString("_field") case "IncludesColumn": @@ -909,7 +888,7 @@ func (c *Call) TranslateInfo(columnLabel, rowLabel string) (colKey, rowKey, fiel // Writable returns true if call is mutable (e.g. can write new translation keys) func (c *Call) Writable() bool { switch c.Name { - case "Set", "SetRowAttrs", "SetColumnAttrs", "SetBit": + case "Set", "SetBit": return true case "Not": // to support queries like Not(Row(f="garbage")) diff --git a/pql/pql.peg b/pql/pql.peg index cb8aec256..a5590132d 100644 --- a/pql/pql.peg +++ b/pql/pql.peg @@ -7,8 +7,6 @@ type PQL Peg { # All input queries consist of a sequence of calls, at the top level. Calls <- sp (Call sp)* !. Call <- "Set" {p.startCall("Set")} open col comma args (comma time)? close {p.endCall()} - / "SetRowAttrs" {p.startCall("SetRowAttrs")} open posfield comma row comma args close {p.endCall()} - / "SetColumnAttrs" {p.startCall("SetColumnAttrs")} open col comma args close {p.endCall()} / "Clear" {p.startCall("Clear")} open col comma args close {p.endCall()} / "ClearRow" {p.startCall("ClearRow")} open arg close {p.endCall()} / "Store" {p.startCall("Store")} open Call comma arg close {p.endCall()} @@ -63,9 +61,6 @@ posfield <- 'field='? { p.addPosStr("_field", text) } col <- < digits > {p.addPosNum("_col", text)} / < '\'' singlequotedstring '\'' > {p.addPosStr("_col", text)} / < '"' doublequotedstring '"' > {p.addPosStr("_col", text)} -row <- < digits > {p.addPosNum("_row", text)} - / < '\'' singlequotedstring '\'' > {p.addPosStr("_row", text)} - / < '"' doublequotedstring '"' > {p.addPosStr("_row", text)} open <- '(' sp close <- sp ')' sp diff --git a/pql/pql.peg.go b/pql/pql.peg.go index f3b910752..bbc48da7f 100644 --- a/pql/pql.peg.go +++ b/pql/pql.peg.go @@ -8,7 +8,6 @@ import ( "os" "sort" "strconv" - "strings" ) const endSymbol rune = 1114112 @@ -38,7 +37,6 @@ const ( rulereserved ruleposfield rulecol - rulerow ruleopen ruleclose rulesp @@ -86,11 +84,11 @@ const ( ruleAction25 ruleAction26 ruleAction27 + rulePegText ruleAction28 ruleAction29 ruleAction30 ruleAction31 - rulePegText ruleAction32 ruleAction33 ruleAction34 @@ -120,13 +118,6 @@ const ( ruleAction58 ruleAction59 ruleAction60 - ruleAction61 - ruleAction62 - ruleAction63 - ruleAction64 - ruleAction65 - ruleAction66 - ruleAction67 ) var rul3s = [...]string{ @@ -151,7 +142,6 @@ var rul3s = [...]string{ "reserved", "posfield", "col", - "row", "open", "close", "sp", @@ -199,11 +189,11 @@ var rul3s = [...]string{ "Action25", "Action26", "Action27", + "PegText", "Action28", "Action29", "Action30", "Action31", - "PegText", "Action32", "Action33", "Action34", @@ -233,13 +223,6 @@ var rul3s = [...]string{ "Action58", "Action59", "Action60", - "Action61", - "Action62", - "Action63", - "Action64", - "Action65", - "Action66", - "Action67", } type token32 struct { @@ -268,7 +251,7 @@ func (node *node32) print(w io.Writer, pretty bool, buffer string) { if !pretty { fmt.Fprintf(w, "%v %v\n", rule, quote) } else { - fmt.Fprintf(w, "\x1B[36m%v\x1B[m %v\n", rule, quote) + fmt.Fprintf(w, "\x1B[34m%v\x1B[m %v\n", rule, quote) } if node.up != nil { print(node.up, depth+1) @@ -356,7 +339,7 @@ type PQL struct { Buffer string buffer []rune - rules [110]func() bool + rules [102]func() bool parse func(rule ...int) error reset func() Pretty bool @@ -443,12 +426,6 @@ func (p *PQL) WriteSyntaxTree(w io.Writer) { p.tokens32.WriteSyntaxTree(w, p.Buffer) } -func (p *PQL) SprintSyntaxTree() string { - var bldr strings.Builder - p.WriteSyntaxTree(&bldr) - return bldr.String() -} - func (p *PQL) Execute() { buffer, _buffer, text, begin, end := p.Buffer, p.buffer, "", 0, 0 for _, token := range p.Tokens() { @@ -463,136 +440,122 @@ func (p *PQL) Execute() { case ruleAction1: p.endCall() case ruleAction2: - p.startCall("SetRowAttrs") + p.startCall("Clear") case ruleAction3: p.endCall() case ruleAction4: - p.startCall("SetColumnAttrs") + p.startCall("ClearRow") case ruleAction5: p.endCall() case ruleAction6: - p.startCall("Clear") + p.startCall("Store") case ruleAction7: p.endCall() case ruleAction8: - p.startCall("ClearRow") + p.startCall("TopN") case ruleAction9: p.endCall() case ruleAction10: - p.startCall("Store") + p.startCall("TopK") case ruleAction11: p.endCall() case ruleAction12: - p.startCall("TopN") + p.startCall("Percentile") case ruleAction13: p.endCall() case ruleAction14: - p.startCall("TopK") + p.startCall("Rows") case ruleAction15: p.endCall() case ruleAction16: - p.startCall("Percentile") + p.startCall("Min") case ruleAction17: p.endCall() case ruleAction18: - p.startCall("Rows") + p.startCall("Max") case ruleAction19: p.endCall() case ruleAction20: - p.startCall("Min") + p.startCall("Sum") case ruleAction21: p.endCall() case ruleAction22: - p.startCall("Max") - case ruleAction23: - p.endCall() - case ruleAction24: - p.startCall("Sum") - case ruleAction25: - p.endCall() - case ruleAction26: p.startCall("Range") - case ruleAction27: + case ruleAction23: p.addField("from") - case ruleAction28: + case ruleAction24: p.addVal(text) - case ruleAction29: + case ruleAction25: p.addField("to") + case ruleAction26: + p.addVal(text) + case ruleAction27: + p.endCall() + case ruleAction28: + p.startCall(text) + case ruleAction29: + p.endCall() case ruleAction30: - p.addVal(text) - case ruleAction31: - p.endCall() - case ruleAction32: - p.startCall(text) - case ruleAction33: - p.endCall() - case ruleAction34: p.addBTWN() - case ruleAction35: + case ruleAction31: p.addLTE() - case ruleAction36: + case ruleAction32: p.addGTE() - case ruleAction37: + case ruleAction33: p.addEQ() - case ruleAction38: + case ruleAction34: p.addNEQ() - case ruleAction39: + case ruleAction35: p.addLT() - case ruleAction40: + case ruleAction36: p.addGT() - case ruleAction41: + case ruleAction37: p.startConditional() - case ruleAction42: + case ruleAction38: p.endConditional() - case ruleAction43: + case ruleAction39: p.condAdd(text) - case ruleAction44: + case ruleAction40: p.condAdd(text) - case ruleAction45: + case ruleAction41: p.condAdd(text) - case ruleAction46: + case ruleAction42: p.startList() - case ruleAction47: + case ruleAction43: p.endList() - case ruleAction48: + case ruleAction44: p.addVal(nil) - case ruleAction49: + case ruleAction45: p.addVal(true) - case ruleAction50: + case ruleAction46: p.addVal(false) - case ruleAction51: + case ruleAction47: p.addVal(text) - case ruleAction52: + case ruleAction48: p.addTimestampVal(text) - case ruleAction53: + case ruleAction49: p.addNumVal(text) - case ruleAction54: + case ruleAction50: p.startCall(text) - case ruleAction55: + case ruleAction51: p.addVal(p.endCall()) - case ruleAction56: + case ruleAction52: p.addVal(text) - case ruleAction57: + case ruleAction53: p.addVal(text) - case ruleAction58: + case ruleAction54: p.addVal(text) - case ruleAction59: + case ruleAction55: p.addField(text) - case ruleAction60: + case ruleAction56: p.addPosStr("_field", text) - case ruleAction61: + case ruleAction57: p.addPosNum("_col", text) - case ruleAction62: + case ruleAction58: p.addPosStr("_col", text) - case ruleAction63: + case ruleAction59: p.addPosStr("_col", text) - case ruleAction64: - p.addPosNum("_row", text) - case ruleAction65: - p.addPosStr("_row", text) - case ruleAction66: - p.addPosStr("_row", text) - case ruleAction67: + case ruleAction60: p.addPosStr("_timestamp", text) } @@ -724,7 +687,7 @@ func (p *PQL) Init(options ...func(*PQL) error) error { position, tokenIndex = position0, tokenIndex0 return false }, - /* 1 Call <- <((('s' / 'S') ('e' / 'E') ('t' / 'T') Action0 open col comma args (comma time)? close Action1) / (('s' / 'S') ('e' / 'E') ('t' / 'T') ('r' / 'R') ('o' / 'O') ('w' / 'W') ('a' / 'A') ('t' / 'T') ('t' / 'T') ('r' / 'R') ('s' / 'S') Action2 open posfield comma row comma args close Action3) / (('s' / 'S') ('e' / 'E') ('t' / 'T') ('c' / 'C') ('o' / 'O') ('l' / 'L') ('u' / 'U') ('m' / 'M') ('n' / 'N') ('a' / 'A') ('t' / 'T') ('t' / 'T') ('r' / 'R') ('s' / 'S') Action4 open col comma args close Action5) / (('c' / 'C') ('l' / 'L') ('e' / 'E') ('a' / 'A') ('r' / 'R') Action6 open col comma args close Action7) / (('c' / 'C') ('l' / 'L') ('e' / 'E') ('a' / 'A') ('r' / 'R') ('r' / 'R') ('o' / 'O') ('w' / 'W') Action8 open arg close Action9) / (('s' / 'S') ('t' / 'T') ('o' / 'O') ('r' / 'R') ('e' / 'E') Action10 open Call comma arg close Action11) / (('t' / 'T') ('o' / 'O') ('p' / 'P') ('n' / 'N') Action12 open posfield (comma allargs)? close Action13) / (('t' / 'T') ('o' / 'O') ('p' / 'P') ('k' / 'K') Action14 open posfield (comma allargs)? close Action15) / (('p' / 'P') ('e' / 'E') ('r' / 'R') ('c' / 'C') ('e' / 'E') ('n' / 'N') ('t' / 'T') ('i' / 'I') ('l' / 'L') ('e' / 'E') Action16 open posfield (comma allargs)? close Action17) / (('r' / 'R') ('o' / 'O') ('w' / 'W') ('s' / 'S') Action18 open posfield (comma allargs)? close Action19) / (('m' / 'M') ('i' / 'I') ('n' / 'N') Action20 open posfield (comma allargs)? close Action21) / (('m' / 'M') ('a' / 'A') ('x' / 'X') Action22 open posfield (comma allargs)? close Action23) / (('s' / 'S') ('u' / 'U') ('m' / 'M') Action24 open posfield (comma allargs)? close Action25) / (('r' / 'R') ('a' / 'A') ('n' / 'N') ('g' / 'G') ('e' / 'E') Action26 open field eq value comma ('f' 'r' 'o' 'm' '=')? Action27 timefmt Action28 comma ('t' 'o' '=')? sp Action29 timefmt Action30 close Action31) / ( Action32 open allargs comma? close Action33))> */ + /* 1 Call <- <((('s' / 'S') ('e' / 'E') ('t' / 'T') Action0 open col comma args (comma time)? close Action1) / (('c' / 'C') ('l' / 'L') ('e' / 'E') ('a' / 'A') ('r' / 'R') Action2 open col comma args close Action3) / (('c' / 'C') ('l' / 'L') ('e' / 'E') ('a' / 'A') ('r' / 'R') ('r' / 'R') ('o' / 'O') ('w' / 'W') Action4 open arg close Action5) / (('s' / 'S') ('t' / 'T') ('o' / 'O') ('r' / 'R') ('e' / 'E') Action6 open Call comma arg close Action7) / (('t' / 'T') ('o' / 'O') ('p' / 'P') ('n' / 'N') Action8 open posfield (comma allargs)? close Action9) / (('t' / 'T') ('o' / 'O') ('p' / 'P') ('k' / 'K') Action10 open posfield (comma allargs)? close Action11) / (('p' / 'P') ('e' / 'E') ('r' / 'R') ('c' / 'C') ('e' / 'E') ('n' / 'N') ('t' / 'T') ('i' / 'I') ('l' / 'L') ('e' / 'E') Action12 open posfield (comma allargs)? close Action13) / (('r' / 'R') ('o' / 'O') ('w' / 'W') ('s' / 'S') Action14 open posfield (comma allargs)? close Action15) / (('m' / 'M') ('i' / 'I') ('n' / 'N') Action16 open posfield (comma allargs)? close Action17) / (('m' / 'M') ('a' / 'A') ('x' / 'X') Action18 open posfield (comma allargs)? close Action19) / (('s' / 'S') ('u' / 'U') ('m' / 'M') Action20 open posfield (comma allargs)? close Action21) / (('r' / 'R') ('a' / 'A') ('n' / 'N') ('g' / 'G') ('e' / 'E') Action22 open field eq value comma ('f' 'r' 'o' 'm' '=')? Action23 timefmt Action24 comma ('t' 'o' '=')? sp Action25 timefmt Action26 close Action27) / ( Action28 open allargs comma? close Action29))> */ func() bool { position5, tokenIndex5 := position, tokenIndex { @@ -806,7 +769,7 @@ func (p *PQL) Init(options ...func(*PQL) error) error { add(rulePegText, position19) } { - add(ruleAction67, position) + add(ruleAction60, position) } add(ruletime, position18) } @@ -826,14 +789,14 @@ func (p *PQL) Init(options ...func(*PQL) error) error { position, tokenIndex = position7, tokenIndex7 { position23, tokenIndex23 := position, tokenIndex - if buffer[position] != rune('s') { + if buffer[position] != rune('c') { goto l24 } position++ goto l23 l24: position, tokenIndex = position23, tokenIndex23 - if buffer[position] != rune('S') { + if buffer[position] != rune('C') { goto l22 } position++ @@ -841,14 +804,14 @@ func (p *PQL) Init(options ...func(*PQL) error) error { l23: { position25, tokenIndex25 := position, tokenIndex - if buffer[position] != rune('e') { + if buffer[position] != rune('l') { goto l26 } position++ goto l25 l26: position, tokenIndex = position25, tokenIndex25 - if buffer[position] != rune('E') { + if buffer[position] != rune('L') { goto l22 } position++ @@ -856,14 +819,14 @@ func (p *PQL) Init(options ...func(*PQL) error) error { l25: { position27, tokenIndex27 := position, tokenIndex - if buffer[position] != rune('t') { + if buffer[position] != rune('e') { goto l28 } position++ goto l27 l28: position, tokenIndex = position27, tokenIndex27 - if buffer[position] != rune('T') { + if buffer[position] != rune('E') { goto l22 } position++ @@ -871,14 +834,14 @@ func (p *PQL) Init(options ...func(*PQL) error) error { l27: { position29, tokenIndex29 := position, tokenIndex - if buffer[position] != rune('r') { + if buffer[position] != rune('a') { goto l30 } position++ goto l29 l30: position, tokenIndex = position29, tokenIndex29 - if buffer[position] != rune('R') { + if buffer[position] != rune('A') { goto l22 } position++ @@ -886,184 +849,31 @@ func (p *PQL) Init(options ...func(*PQL) error) error { l29: { position31, tokenIndex31 := position, tokenIndex - if buffer[position] != rune('o') { + if buffer[position] != rune('r') { goto l32 } position++ goto l31 l32: position, tokenIndex = position31, tokenIndex31 - if buffer[position] != rune('O') { + if buffer[position] != rune('R') { goto l22 } position++ } l31: - { - position33, tokenIndex33 := position, tokenIndex - if buffer[position] != rune('w') { - goto l34 - } - position++ - goto l33 - l34: - position, tokenIndex = position33, tokenIndex33 - if buffer[position] != rune('W') { - goto l22 - } - position++ - } - l33: - { - position35, tokenIndex35 := position, tokenIndex - if buffer[position] != rune('a') { - goto l36 - } - position++ - goto l35 - l36: - position, tokenIndex = position35, tokenIndex35 - if buffer[position] != rune('A') { - goto l22 - } - position++ - } - l35: - { - position37, tokenIndex37 := position, tokenIndex - if buffer[position] != rune('t') { - goto l38 - } - position++ - goto l37 - l38: - position, tokenIndex = position37, tokenIndex37 - if buffer[position] != rune('T') { - goto l22 - } - position++ - } - l37: - { - position39, tokenIndex39 := position, tokenIndex - if buffer[position] != rune('t') { - goto l40 - } - position++ - goto l39 - l40: - position, tokenIndex = position39, tokenIndex39 - if buffer[position] != rune('T') { - goto l22 - } - position++ - } - l39: - { - position41, tokenIndex41 := position, tokenIndex - if buffer[position] != rune('r') { - goto l42 - } - position++ - goto l41 - l42: - position, tokenIndex = position41, tokenIndex41 - if buffer[position] != rune('R') { - goto l22 - } - position++ - } - l41: - { - position43, tokenIndex43 := position, tokenIndex - if buffer[position] != rune('s') { - goto l44 - } - position++ - goto l43 - l44: - position, tokenIndex = position43, tokenIndex43 - if buffer[position] != rune('S') { - goto l22 - } - position++ - } - l43: { add(ruleAction2, position) } if !_rules[ruleopen]() { goto l22 } - if !_rules[ruleposfield]() { + if !_rules[rulecol]() { goto l22 } if !_rules[rulecomma]() { goto l22 } - { - position46 := position - { - position47, tokenIndex47 := position, tokenIndex - { - position49 := position - if !_rules[ruledigits]() { - goto l48 - } - add(rulePegText, position49) - } - { - add(ruleAction64, position) - } - goto l47 - l48: - position, tokenIndex = position47, tokenIndex47 - { - position52 := position - if buffer[position] != rune('\'') { - goto l51 - } - position++ - if !_rules[rulesinglequotedstring]() { - goto l51 - } - if buffer[position] != rune('\'') { - goto l51 - } - position++ - add(rulePegText, position52) - } - { - add(ruleAction65, position) - } - goto l47 - l51: - position, tokenIndex = position47, tokenIndex47 - { - position54 := position - if buffer[position] != rune('"') { - goto l22 - } - position++ - if !_rules[ruledoublequotedstring]() { - goto l22 - } - if buffer[position] != rune('"') { - goto l22 - } - position++ - add(rulePegText, position54) - } - { - add(ruleAction66, position) - } - } - l47: - add(rulerow, position46) - } - if !_rules[rulecomma]() { - goto l22 - } if !_rules[ruleargs]() { goto l22 } @@ -1077,121 +887,283 @@ func (p *PQL) Init(options ...func(*PQL) error) error { l22: position, tokenIndex = position7, tokenIndex7 { - position58, tokenIndex58 := position, tokenIndex - if buffer[position] != rune('s') { - goto l59 - } - position++ - goto l58 - l59: - position, tokenIndex = position58, tokenIndex58 - if buffer[position] != rune('S') { - goto l57 - } - position++ - } - l58: - { - position60, tokenIndex60 := position, tokenIndex - if buffer[position] != rune('e') { - goto l61 - } - position++ - goto l60 - l61: - position, tokenIndex = position60, tokenIndex60 - if buffer[position] != rune('E') { - goto l57 - } - position++ - } - l60: - { - position62, tokenIndex62 := position, tokenIndex - if buffer[position] != rune('t') { - goto l63 - } - position++ - goto l62 - l63: - position, tokenIndex = position62, tokenIndex62 - if buffer[position] != rune('T') { - goto l57 - } - position++ - } - l62: - { - position64, tokenIndex64 := position, tokenIndex + position36, tokenIndex36 := position, tokenIndex if buffer[position] != rune('c') { - goto l65 + goto l37 } position++ - goto l64 - l65: - position, tokenIndex = position64, tokenIndex64 + goto l36 + l37: + position, tokenIndex = position36, tokenIndex36 if buffer[position] != rune('C') { - goto l57 + goto l35 } position++ } - l64: + l36: { - position66, tokenIndex66 := position, tokenIndex - if buffer[position] != rune('o') { - goto l67 + position38, tokenIndex38 := position, tokenIndex + if buffer[position] != rune('l') { + goto l39 } position++ - goto l66 - l67: - position, tokenIndex = position66, tokenIndex66 - if buffer[position] != rune('O') { - goto l57 + goto l38 + l39: + position, tokenIndex = position38, tokenIndex38 + if buffer[position] != rune('L') { + goto l35 } position++ } - l66: + l38: + { + position40, tokenIndex40 := position, tokenIndex + if buffer[position] != rune('e') { + goto l41 + } + position++ + goto l40 + l41: + position, tokenIndex = position40, tokenIndex40 + if buffer[position] != rune('E') { + goto l35 + } + position++ + } + l40: + { + position42, tokenIndex42 := position, tokenIndex + if buffer[position] != rune('a') { + goto l43 + } + position++ + goto l42 + l43: + position, tokenIndex = position42, tokenIndex42 + if buffer[position] != rune('A') { + goto l35 + } + position++ + } + l42: + { + position44, tokenIndex44 := position, tokenIndex + if buffer[position] != rune('r') { + goto l45 + } + position++ + goto l44 + l45: + position, tokenIndex = position44, tokenIndex44 + if buffer[position] != rune('R') { + goto l35 + } + position++ + } + l44: + { + position46, tokenIndex46 := position, tokenIndex + if buffer[position] != rune('r') { + goto l47 + } + position++ + goto l46 + l47: + position, tokenIndex = position46, tokenIndex46 + if buffer[position] != rune('R') { + goto l35 + } + position++ + } + l46: + { + position48, tokenIndex48 := position, tokenIndex + if buffer[position] != rune('o') { + goto l49 + } + position++ + goto l48 + l49: + position, tokenIndex = position48, tokenIndex48 + if buffer[position] != rune('O') { + goto l35 + } + position++ + } + l48: + { + position50, tokenIndex50 := position, tokenIndex + if buffer[position] != rune('w') { + goto l51 + } + position++ + goto l50 + l51: + position, tokenIndex = position50, tokenIndex50 + if buffer[position] != rune('W') { + goto l35 + } + position++ + } + l50: + { + add(ruleAction4, position) + } + if !_rules[ruleopen]() { + goto l35 + } + if !_rules[rulearg]() { + goto l35 + } + if !_rules[ruleclose]() { + goto l35 + } + { + add(ruleAction5, position) + } + goto l7 + l35: + position, tokenIndex = position7, tokenIndex7 + { + position55, tokenIndex55 := position, tokenIndex + if buffer[position] != rune('s') { + goto l56 + } + position++ + goto l55 + l56: + position, tokenIndex = position55, tokenIndex55 + if buffer[position] != rune('S') { + goto l54 + } + position++ + } + l55: + { + position57, tokenIndex57 := position, tokenIndex + if buffer[position] != rune('t') { + goto l58 + } + position++ + goto l57 + l58: + position, tokenIndex = position57, tokenIndex57 + if buffer[position] != rune('T') { + goto l54 + } + position++ + } + l57: + { + position59, tokenIndex59 := position, tokenIndex + if buffer[position] != rune('o') { + goto l60 + } + position++ + goto l59 + l60: + position, tokenIndex = position59, tokenIndex59 + if buffer[position] != rune('O') { + goto l54 + } + position++ + } + l59: + { + position61, tokenIndex61 := position, tokenIndex + if buffer[position] != rune('r') { + goto l62 + } + position++ + goto l61 + l62: + position, tokenIndex = position61, tokenIndex61 + if buffer[position] != rune('R') { + goto l54 + } + position++ + } + l61: + { + position63, tokenIndex63 := position, tokenIndex + if buffer[position] != rune('e') { + goto l64 + } + position++ + goto l63 + l64: + position, tokenIndex = position63, tokenIndex63 + if buffer[position] != rune('E') { + goto l54 + } + position++ + } + l63: + { + add(ruleAction6, position) + } + if !_rules[ruleopen]() { + goto l54 + } + if !_rules[ruleCall]() { + goto l54 + } + if !_rules[rulecomma]() { + goto l54 + } + if !_rules[rulearg]() { + goto l54 + } + if !_rules[ruleclose]() { + goto l54 + } + { + add(ruleAction7, position) + } + goto l7 + l54: + position, tokenIndex = position7, tokenIndex7 { position68, tokenIndex68 := position, tokenIndex - if buffer[position] != rune('l') { + if buffer[position] != rune('t') { goto l69 } position++ goto l68 l69: position, tokenIndex = position68, tokenIndex68 - if buffer[position] != rune('L') { - goto l57 + if buffer[position] != rune('T') { + goto l67 } position++ } l68: { position70, tokenIndex70 := position, tokenIndex - if buffer[position] != rune('u') { + if buffer[position] != rune('o') { goto l71 } position++ goto l70 l71: position, tokenIndex = position70, tokenIndex70 - if buffer[position] != rune('U') { - goto l57 + if buffer[position] != rune('O') { + goto l67 } position++ } l70: { position72, tokenIndex72 := position, tokenIndex - if buffer[position] != rune('m') { + if buffer[position] != rune('p') { goto l73 } position++ goto l72 l73: position, tokenIndex = position72, tokenIndex72 - if buffer[position] != rune('M') { - goto l57 + if buffer[position] != rune('P') { + goto l67 } position++ } @@ -1206,1309 +1178,814 @@ func (p *PQL) Init(options ...func(*PQL) error) error { l75: position, tokenIndex = position74, tokenIndex74 if buffer[position] != rune('N') { - goto l57 + goto l67 } position++ } l74: { - position76, tokenIndex76 := position, tokenIndex - if buffer[position] != rune('a') { + add(ruleAction8, position) + } + if !_rules[ruleopen]() { + goto l67 + } + if !_rules[ruleposfield]() { + goto l67 + } + { + position77, tokenIndex77 := position, tokenIndex + if !_rules[rulecomma]() { goto l77 } - position++ - goto l76 - l77: - position, tokenIndex = position76, tokenIndex76 - if buffer[position] != rune('A') { - goto l57 + if !_rules[ruleallargs]() { + goto l77 } - position++ - } - l76: - { - position78, tokenIndex78 := position, tokenIndex - if buffer[position] != rune('t') { - goto l79 - } - position++ goto l78 - l79: - position, tokenIndex = position78, tokenIndex78 - if buffer[position] != rune('T') { - goto l57 - } - position++ + l77: + position, tokenIndex = position77, tokenIndex77 } l78: - { - position80, tokenIndex80 := position, tokenIndex - if buffer[position] != rune('t') { - goto l81 - } - position++ - goto l80 - l81: - position, tokenIndex = position80, tokenIndex80 - if buffer[position] != rune('T') { - goto l57 - } - position++ - } - l80: - { - position82, tokenIndex82 := position, tokenIndex - if buffer[position] != rune('r') { - goto l83 - } - position++ - goto l82 - l83: - position, tokenIndex = position82, tokenIndex82 - if buffer[position] != rune('R') { - goto l57 - } - position++ - } - l82: - { - position84, tokenIndex84 := position, tokenIndex - if buffer[position] != rune('s') { - goto l85 - } - position++ - goto l84 - l85: - position, tokenIndex = position84, tokenIndex84 - if buffer[position] != rune('S') { - goto l57 - } - position++ - } - l84: - { - add(ruleAction4, position) - } - if !_rules[ruleopen]() { - goto l57 - } - if !_rules[rulecol]() { - goto l57 - } - if !_rules[rulecomma]() { - goto l57 - } - if !_rules[ruleargs]() { - goto l57 - } if !_rules[ruleclose]() { - goto l57 + goto l67 } { - add(ruleAction5, position) + add(ruleAction9, position) } goto l7 - l57: + l67: position, tokenIndex = position7, tokenIndex7 { - position89, tokenIndex89 := position, tokenIndex - if buffer[position] != rune('c') { + position81, tokenIndex81 := position, tokenIndex + if buffer[position] != rune('t') { + goto l82 + } + position++ + goto l81 + l82: + position, tokenIndex = position81, tokenIndex81 + if buffer[position] != rune('T') { + goto l80 + } + position++ + } + l81: + { + position83, tokenIndex83 := position, tokenIndex + if buffer[position] != rune('o') { + goto l84 + } + position++ + goto l83 + l84: + position, tokenIndex = position83, tokenIndex83 + if buffer[position] != rune('O') { + goto l80 + } + position++ + } + l83: + { + position85, tokenIndex85 := position, tokenIndex + if buffer[position] != rune('p') { + goto l86 + } + position++ + goto l85 + l86: + position, tokenIndex = position85, tokenIndex85 + if buffer[position] != rune('P') { + goto l80 + } + position++ + } + l85: + { + position87, tokenIndex87 := position, tokenIndex + if buffer[position] != rune('k') { + goto l88 + } + position++ + goto l87 + l88: + position, tokenIndex = position87, tokenIndex87 + if buffer[position] != rune('K') { + goto l80 + } + position++ + } + l87: + { + add(ruleAction10, position) + } + if !_rules[ruleopen]() { + goto l80 + } + if !_rules[ruleposfield]() { + goto l80 + } + { + position90, tokenIndex90 := position, tokenIndex + if !_rules[rulecomma]() { goto l90 } - position++ - goto l89 - l90: - position, tokenIndex = position89, tokenIndex89 - if buffer[position] != rune('C') { - goto l88 + if !_rules[ruleallargs]() { + goto l90 } - position++ - } - l89: - { - position91, tokenIndex91 := position, tokenIndex - if buffer[position] != rune('l') { - goto l92 - } - position++ goto l91 - l92: - position, tokenIndex = position91, tokenIndex91 - if buffer[position] != rune('L') { - goto l88 - } - position++ + l90: + position, tokenIndex = position90, tokenIndex90 } l91: - { - position93, tokenIndex93 := position, tokenIndex - if buffer[position] != rune('e') { - goto l94 - } - position++ - goto l93 - l94: - position, tokenIndex = position93, tokenIndex93 - if buffer[position] != rune('E') { - goto l88 - } - position++ - } - l93: - { - position95, tokenIndex95 := position, tokenIndex - if buffer[position] != rune('a') { - goto l96 - } - position++ - goto l95 - l96: - position, tokenIndex = position95, tokenIndex95 - if buffer[position] != rune('A') { - goto l88 - } - position++ - } - l95: - { - position97, tokenIndex97 := position, tokenIndex - if buffer[position] != rune('r') { - goto l98 - } - position++ - goto l97 - l98: - position, tokenIndex = position97, tokenIndex97 - if buffer[position] != rune('R') { - goto l88 - } - position++ - } - l97: - { - add(ruleAction6, position) - } - if !_rules[ruleopen]() { - goto l88 - } - if !_rules[rulecol]() { - goto l88 - } - if !_rules[rulecomma]() { - goto l88 - } - if !_rules[ruleargs]() { - goto l88 - } if !_rules[ruleclose]() { - goto l88 + goto l80 } { - add(ruleAction7, position) + add(ruleAction11, position) } goto l7 - l88: + l80: position, tokenIndex = position7, tokenIndex7 { - position102, tokenIndex102 := position, tokenIndex + position94, tokenIndex94 := position, tokenIndex + if buffer[position] != rune('p') { + goto l95 + } + position++ + goto l94 + l95: + position, tokenIndex = position94, tokenIndex94 + if buffer[position] != rune('P') { + goto l93 + } + position++ + } + l94: + { + position96, tokenIndex96 := position, tokenIndex + if buffer[position] != rune('e') { + goto l97 + } + position++ + goto l96 + l97: + position, tokenIndex = position96, tokenIndex96 + if buffer[position] != rune('E') { + goto l93 + } + position++ + } + l96: + { + position98, tokenIndex98 := position, tokenIndex + if buffer[position] != rune('r') { + goto l99 + } + position++ + goto l98 + l99: + position, tokenIndex = position98, tokenIndex98 + if buffer[position] != rune('R') { + goto l93 + } + position++ + } + l98: + { + position100, tokenIndex100 := position, tokenIndex if buffer[position] != rune('c') { + goto l101 + } + position++ + goto l100 + l101: + position, tokenIndex = position100, tokenIndex100 + if buffer[position] != rune('C') { + goto l93 + } + position++ + } + l100: + { + position102, tokenIndex102 := position, tokenIndex + if buffer[position] != rune('e') { goto l103 } position++ goto l102 l103: position, tokenIndex = position102, tokenIndex102 - if buffer[position] != rune('C') { - goto l101 + if buffer[position] != rune('E') { + goto l93 } position++ } l102: { position104, tokenIndex104 := position, tokenIndex - if buffer[position] != rune('l') { + if buffer[position] != rune('n') { goto l105 } position++ goto l104 l105: position, tokenIndex = position104, tokenIndex104 - if buffer[position] != rune('L') { - goto l101 + if buffer[position] != rune('N') { + goto l93 } position++ } l104: { position106, tokenIndex106 := position, tokenIndex - if buffer[position] != rune('e') { + if buffer[position] != rune('t') { goto l107 } position++ goto l106 l107: position, tokenIndex = position106, tokenIndex106 - if buffer[position] != rune('E') { - goto l101 + if buffer[position] != rune('T') { + goto l93 } position++ } l106: { position108, tokenIndex108 := position, tokenIndex - if buffer[position] != rune('a') { + if buffer[position] != rune('i') { goto l109 } position++ goto l108 l109: position, tokenIndex = position108, tokenIndex108 - if buffer[position] != rune('A') { - goto l101 + if buffer[position] != rune('I') { + goto l93 } position++ } l108: { position110, tokenIndex110 := position, tokenIndex - if buffer[position] != rune('r') { + if buffer[position] != rune('l') { goto l111 } position++ goto l110 l111: position, tokenIndex = position110, tokenIndex110 - if buffer[position] != rune('R') { - goto l101 + if buffer[position] != rune('L') { + goto l93 } position++ } l110: { position112, tokenIndex112 := position, tokenIndex - if buffer[position] != rune('r') { + if buffer[position] != rune('e') { goto l113 } position++ goto l112 l113: position, tokenIndex = position112, tokenIndex112 - if buffer[position] != rune('R') { - goto l101 + if buffer[position] != rune('E') { + goto l93 } position++ } l112: { - position114, tokenIndex114 := position, tokenIndex - if buffer[position] != rune('o') { - goto l115 - } - position++ - goto l114 - l115: - position, tokenIndex = position114, tokenIndex114 - if buffer[position] != rune('O') { - goto l101 - } - position++ - } - l114: - { - position116, tokenIndex116 := position, tokenIndex - if buffer[position] != rune('w') { - goto l117 - } - position++ - goto l116 - l117: - position, tokenIndex = position116, tokenIndex116 - if buffer[position] != rune('W') { - goto l101 - } - position++ - } - l116: - { - add(ruleAction8, position) + add(ruleAction12, position) } if !_rules[ruleopen]() { - goto l101 + goto l93 } - if !_rules[rulearg]() { - goto l101 - } - if !_rules[ruleclose]() { - goto l101 + if !_rules[ruleposfield]() { + goto l93 } { - add(ruleAction9, position) + position115, tokenIndex115 := position, tokenIndex + if !_rules[rulecomma]() { + goto l115 + } + if !_rules[ruleallargs]() { + goto l115 + } + goto l116 + l115: + position, tokenIndex = position115, tokenIndex115 + } + l116: + if !_rules[ruleclose]() { + goto l93 + } + { + add(ruleAction13, position) } goto l7 - l101: + l93: position, tokenIndex = position7, tokenIndex7 + { + position119, tokenIndex119 := position, tokenIndex + if buffer[position] != rune('r') { + goto l120 + } + position++ + goto l119 + l120: + position, tokenIndex = position119, tokenIndex119 + if buffer[position] != rune('R') { + goto l118 + } + position++ + } + l119: { position121, tokenIndex121 := position, tokenIndex - if buffer[position] != rune('s') { + if buffer[position] != rune('o') { goto l122 } position++ goto l121 l122: position, tokenIndex = position121, tokenIndex121 - if buffer[position] != rune('S') { - goto l120 + if buffer[position] != rune('O') { + goto l118 } position++ } l121: { position123, tokenIndex123 := position, tokenIndex - if buffer[position] != rune('t') { + if buffer[position] != rune('w') { goto l124 } position++ goto l123 l124: position, tokenIndex = position123, tokenIndex123 - if buffer[position] != rune('T') { - goto l120 + if buffer[position] != rune('W') { + goto l118 } position++ } l123: { position125, tokenIndex125 := position, tokenIndex - if buffer[position] != rune('o') { + if buffer[position] != rune('s') { goto l126 } position++ goto l125 l126: position, tokenIndex = position125, tokenIndex125 - if buffer[position] != rune('O') { - goto l120 + if buffer[position] != rune('S') { + goto l118 } position++ } l125: { - position127, tokenIndex127 := position, tokenIndex - if buffer[position] != rune('r') { - goto l128 - } - position++ - goto l127 - l128: - position, tokenIndex = position127, tokenIndex127 - if buffer[position] != rune('R') { - goto l120 - } - position++ - } - l127: - { - position129, tokenIndex129 := position, tokenIndex - if buffer[position] != rune('e') { - goto l130 - } - position++ - goto l129 - l130: - position, tokenIndex = position129, tokenIndex129 - if buffer[position] != rune('E') { - goto l120 - } - position++ - } - l129: - { - add(ruleAction10, position) + add(ruleAction14, position) } if !_rules[ruleopen]() { - goto l120 + goto l118 } - if !_rules[ruleCall]() { - goto l120 - } - if !_rules[rulecomma]() { - goto l120 - } - if !_rules[rulearg]() { - goto l120 - } - if !_rules[ruleclose]() { - goto l120 + if !_rules[ruleposfield]() { + goto l118 } { - add(ruleAction11, position) + position128, tokenIndex128 := position, tokenIndex + if !_rules[rulecomma]() { + goto l128 + } + if !_rules[ruleallargs]() { + goto l128 + } + goto l129 + l128: + position, tokenIndex = position128, tokenIndex128 + } + l129: + if !_rules[ruleclose]() { + goto l118 + } + { + add(ruleAction15, position) } goto l7 - l120: + l118: position, tokenIndex = position7, tokenIndex7 + { + position132, tokenIndex132 := position, tokenIndex + if buffer[position] != rune('m') { + goto l133 + } + position++ + goto l132 + l133: + position, tokenIndex = position132, tokenIndex132 + if buffer[position] != rune('M') { + goto l131 + } + position++ + } + l132: { position134, tokenIndex134 := position, tokenIndex - if buffer[position] != rune('t') { + if buffer[position] != rune('i') { goto l135 } position++ goto l134 l135: position, tokenIndex = position134, tokenIndex134 - if buffer[position] != rune('T') { - goto l133 + if buffer[position] != rune('I') { + goto l131 } position++ } l134: { position136, tokenIndex136 := position, tokenIndex - if buffer[position] != rune('o') { + if buffer[position] != rune('n') { goto l137 } position++ goto l136 l137: position, tokenIndex = position136, tokenIndex136 - if buffer[position] != rune('O') { - goto l133 + if buffer[position] != rune('N') { + goto l131 } position++ } l136: { - position138, tokenIndex138 := position, tokenIndex - if buffer[position] != rune('p') { - goto l139 - } - position++ - goto l138 - l139: - position, tokenIndex = position138, tokenIndex138 - if buffer[position] != rune('P') { - goto l133 - } - position++ - } - l138: - { - position140, tokenIndex140 := position, tokenIndex - if buffer[position] != rune('n') { - goto l141 - } - position++ - goto l140 - l141: - position, tokenIndex = position140, tokenIndex140 - if buffer[position] != rune('N') { - goto l133 - } - position++ - } - l140: - { - add(ruleAction12, position) + add(ruleAction16, position) } if !_rules[ruleopen]() { - goto l133 + goto l131 } if !_rules[ruleposfield]() { - goto l133 + goto l131 } { - position143, tokenIndex143 := position, tokenIndex + position139, tokenIndex139 := position, tokenIndex if !_rules[rulecomma]() { - goto l143 + goto l139 } if !_rules[ruleallargs]() { - goto l143 + goto l139 } - goto l144 - l143: - position, tokenIndex = position143, tokenIndex143 + goto l140 + l139: + position, tokenIndex = position139, tokenIndex139 } - l144: + l140: if !_rules[ruleclose]() { - goto l133 + goto l131 } { - add(ruleAction13, position) + add(ruleAction17, position) } goto l7 - l133: + l131: position, tokenIndex = position7, tokenIndex7 + { + position143, tokenIndex143 := position, tokenIndex + if buffer[position] != rune('m') { + goto l144 + } + position++ + goto l143 + l144: + position, tokenIndex = position143, tokenIndex143 + if buffer[position] != rune('M') { + goto l142 + } + position++ + } + l143: + { + position145, tokenIndex145 := position, tokenIndex + if buffer[position] != rune('a') { + goto l146 + } + position++ + goto l145 + l146: + position, tokenIndex = position145, tokenIndex145 + if buffer[position] != rune('A') { + goto l142 + } + position++ + } + l145: { position147, tokenIndex147 := position, tokenIndex - if buffer[position] != rune('t') { + if buffer[position] != rune('x') { goto l148 } position++ goto l147 l148: position, tokenIndex = position147, tokenIndex147 - if buffer[position] != rune('T') { - goto l146 + if buffer[position] != rune('X') { + goto l142 } position++ } l147: - { - position149, tokenIndex149 := position, tokenIndex - if buffer[position] != rune('o') { - goto l150 - } - position++ - goto l149 - l150: - position, tokenIndex = position149, tokenIndex149 - if buffer[position] != rune('O') { - goto l146 - } - position++ - } - l149: - { - position151, tokenIndex151 := position, tokenIndex - if buffer[position] != rune('p') { - goto l152 - } - position++ - goto l151 - l152: - position, tokenIndex = position151, tokenIndex151 - if buffer[position] != rune('P') { - goto l146 - } - position++ - } - l151: - { - position153, tokenIndex153 := position, tokenIndex - if buffer[position] != rune('k') { - goto l154 - } - position++ - goto l153 - l154: - position, tokenIndex = position153, tokenIndex153 - if buffer[position] != rune('K') { - goto l146 - } - position++ - } - l153: - { - add(ruleAction14, position) - } - if !_rules[ruleopen]() { - goto l146 - } - if !_rules[ruleposfield]() { - goto l146 - } - { - position156, tokenIndex156 := position, tokenIndex - if !_rules[rulecomma]() { - goto l156 - } - if !_rules[ruleallargs]() { - goto l156 - } - goto l157 - l156: - position, tokenIndex = position156, tokenIndex156 - } - l157: - if !_rules[ruleclose]() { - goto l146 - } - { - add(ruleAction15, position) - } - goto l7 - l146: - position, tokenIndex = position7, tokenIndex7 - { - position160, tokenIndex160 := position, tokenIndex - if buffer[position] != rune('p') { - goto l161 - } - position++ - goto l160 - l161: - position, tokenIndex = position160, tokenIndex160 - if buffer[position] != rune('P') { - goto l159 - } - position++ - } - l160: - { - position162, tokenIndex162 := position, tokenIndex - if buffer[position] != rune('e') { - goto l163 - } - position++ - goto l162 - l163: - position, tokenIndex = position162, tokenIndex162 - if buffer[position] != rune('E') { - goto l159 - } - position++ - } - l162: - { - position164, tokenIndex164 := position, tokenIndex - if buffer[position] != rune('r') { - goto l165 - } - position++ - goto l164 - l165: - position, tokenIndex = position164, tokenIndex164 - if buffer[position] != rune('R') { - goto l159 - } - position++ - } - l164: - { - position166, tokenIndex166 := position, tokenIndex - if buffer[position] != rune('c') { - goto l167 - } - position++ - goto l166 - l167: - position, tokenIndex = position166, tokenIndex166 - if buffer[position] != rune('C') { - goto l159 - } - position++ - } - l166: - { - position168, tokenIndex168 := position, tokenIndex - if buffer[position] != rune('e') { - goto l169 - } - position++ - goto l168 - l169: - position, tokenIndex = position168, tokenIndex168 - if buffer[position] != rune('E') { - goto l159 - } - position++ - } - l168: - { - position170, tokenIndex170 := position, tokenIndex - if buffer[position] != rune('n') { - goto l171 - } - position++ - goto l170 - l171: - position, tokenIndex = position170, tokenIndex170 - if buffer[position] != rune('N') { - goto l159 - } - position++ - } - l170: - { - position172, tokenIndex172 := position, tokenIndex - if buffer[position] != rune('t') { - goto l173 - } - position++ - goto l172 - l173: - position, tokenIndex = position172, tokenIndex172 - if buffer[position] != rune('T') { - goto l159 - } - position++ - } - l172: - { - position174, tokenIndex174 := position, tokenIndex - if buffer[position] != rune('i') { - goto l175 - } - position++ - goto l174 - l175: - position, tokenIndex = position174, tokenIndex174 - if buffer[position] != rune('I') { - goto l159 - } - position++ - } - l174: - { - position176, tokenIndex176 := position, tokenIndex - if buffer[position] != rune('l') { - goto l177 - } - position++ - goto l176 - l177: - position, tokenIndex = position176, tokenIndex176 - if buffer[position] != rune('L') { - goto l159 - } - position++ - } - l176: - { - position178, tokenIndex178 := position, tokenIndex - if buffer[position] != rune('e') { - goto l179 - } - position++ - goto l178 - l179: - position, tokenIndex = position178, tokenIndex178 - if buffer[position] != rune('E') { - goto l159 - } - position++ - } - l178: - { - add(ruleAction16, position) - } - if !_rules[ruleopen]() { - goto l159 - } - if !_rules[ruleposfield]() { - goto l159 - } - { - position181, tokenIndex181 := position, tokenIndex - if !_rules[rulecomma]() { - goto l181 - } - if !_rules[ruleallargs]() { - goto l181 - } - goto l182 - l181: - position, tokenIndex = position181, tokenIndex181 - } - l182: - if !_rules[ruleclose]() { - goto l159 - } - { - add(ruleAction17, position) - } - goto l7 - l159: - position, tokenIndex = position7, tokenIndex7 - { - position185, tokenIndex185 := position, tokenIndex - if buffer[position] != rune('r') { - goto l186 - } - position++ - goto l185 - l186: - position, tokenIndex = position185, tokenIndex185 - if buffer[position] != rune('R') { - goto l184 - } - position++ - } - l185: - { - position187, tokenIndex187 := position, tokenIndex - if buffer[position] != rune('o') { - goto l188 - } - position++ - goto l187 - l188: - position, tokenIndex = position187, tokenIndex187 - if buffer[position] != rune('O') { - goto l184 - } - position++ - } - l187: - { - position189, tokenIndex189 := position, tokenIndex - if buffer[position] != rune('w') { - goto l190 - } - position++ - goto l189 - l190: - position, tokenIndex = position189, tokenIndex189 - if buffer[position] != rune('W') { - goto l184 - } - position++ - } - l189: - { - position191, tokenIndex191 := position, tokenIndex - if buffer[position] != rune('s') { - goto l192 - } - position++ - goto l191 - l192: - position, tokenIndex = position191, tokenIndex191 - if buffer[position] != rune('S') { - goto l184 - } - position++ - } - l191: { add(ruleAction18, position) } if !_rules[ruleopen]() { - goto l184 + goto l142 } if !_rules[ruleposfield]() { - goto l184 + goto l142 } { - position194, tokenIndex194 := position, tokenIndex + position150, tokenIndex150 := position, tokenIndex if !_rules[rulecomma]() { - goto l194 + goto l150 } if !_rules[ruleallargs]() { - goto l194 + goto l150 } - goto l195 - l194: - position, tokenIndex = position194, tokenIndex194 + goto l151 + l150: + position, tokenIndex = position150, tokenIndex150 } - l195: + l151: if !_rules[ruleclose]() { - goto l184 + goto l142 } { add(ruleAction19, position) } goto l7 - l184: + l142: position, tokenIndex = position7, tokenIndex7 { - position198, tokenIndex198 := position, tokenIndex + position154, tokenIndex154 := position, tokenIndex + if buffer[position] != rune('s') { + goto l155 + } + position++ + goto l154 + l155: + position, tokenIndex = position154, tokenIndex154 + if buffer[position] != rune('S') { + goto l153 + } + position++ + } + l154: + { + position156, tokenIndex156 := position, tokenIndex + if buffer[position] != rune('u') { + goto l157 + } + position++ + goto l156 + l157: + position, tokenIndex = position156, tokenIndex156 + if buffer[position] != rune('U') { + goto l153 + } + position++ + } + l156: + { + position158, tokenIndex158 := position, tokenIndex if buffer[position] != rune('m') { - goto l199 + goto l159 } position++ - goto l198 - l199: - position, tokenIndex = position198, tokenIndex198 + goto l158 + l159: + position, tokenIndex = position158, tokenIndex158 if buffer[position] != rune('M') { - goto l197 + goto l153 } position++ } - l198: - { - position200, tokenIndex200 := position, tokenIndex - if buffer[position] != rune('i') { - goto l201 - } - position++ - goto l200 - l201: - position, tokenIndex = position200, tokenIndex200 - if buffer[position] != rune('I') { - goto l197 - } - position++ - } - l200: - { - position202, tokenIndex202 := position, tokenIndex - if buffer[position] != rune('n') { - goto l203 - } - position++ - goto l202 - l203: - position, tokenIndex = position202, tokenIndex202 - if buffer[position] != rune('N') { - goto l197 - } - position++ - } - l202: + l158: { add(ruleAction20, position) } if !_rules[ruleopen]() { - goto l197 + goto l153 } if !_rules[ruleposfield]() { - goto l197 + goto l153 } { - position205, tokenIndex205 := position, tokenIndex + position161, tokenIndex161 := position, tokenIndex if !_rules[rulecomma]() { - goto l205 + goto l161 } if !_rules[ruleallargs]() { - goto l205 + goto l161 } - goto l206 - l205: - position, tokenIndex = position205, tokenIndex205 + goto l162 + l161: + position, tokenIndex = position161, tokenIndex161 } - l206: + l162: if !_rules[ruleclose]() { - goto l197 + goto l153 } { add(ruleAction21, position) } goto l7 - l197: + l153: position, tokenIndex = position7, tokenIndex7 { - position209, tokenIndex209 := position, tokenIndex - if buffer[position] != rune('m') { - goto l210 + position165, tokenIndex165 := position, tokenIndex + if buffer[position] != rune('r') { + goto l166 } position++ - goto l209 - l210: - position, tokenIndex = position209, tokenIndex209 - if buffer[position] != rune('M') { - goto l208 + goto l165 + l166: + position, tokenIndex = position165, tokenIndex165 + if buffer[position] != rune('R') { + goto l164 } position++ } - l209: + l165: { - position211, tokenIndex211 := position, tokenIndex + position167, tokenIndex167 := position, tokenIndex if buffer[position] != rune('a') { - goto l212 + goto l168 } position++ - goto l211 - l212: - position, tokenIndex = position211, tokenIndex211 + goto l167 + l168: + position, tokenIndex = position167, tokenIndex167 if buffer[position] != rune('A') { - goto l208 + goto l164 } position++ } - l211: + l167: { - position213, tokenIndex213 := position, tokenIndex - if buffer[position] != rune('x') { - goto l214 + position169, tokenIndex169 := position, tokenIndex + if buffer[position] != rune('n') { + goto l170 } position++ - goto l213 - l214: - position, tokenIndex = position213, tokenIndex213 - if buffer[position] != rune('X') { - goto l208 + goto l169 + l170: + position, tokenIndex = position169, tokenIndex169 + if buffer[position] != rune('N') { + goto l164 } position++ } - l213: + l169: + { + position171, tokenIndex171 := position, tokenIndex + if buffer[position] != rune('g') { + goto l172 + } + position++ + goto l171 + l172: + position, tokenIndex = position171, tokenIndex171 + if buffer[position] != rune('G') { + goto l164 + } + position++ + } + l171: + { + position173, tokenIndex173 := position, tokenIndex + if buffer[position] != rune('e') { + goto l174 + } + position++ + goto l173 + l174: + position, tokenIndex = position173, tokenIndex173 + if buffer[position] != rune('E') { + goto l164 + } + position++ + } + l173: { add(ruleAction22, position) } if !_rules[ruleopen]() { - goto l208 + goto l164 } - if !_rules[ruleposfield]() { - goto l208 + if !_rules[rulefield]() { + goto l164 + } + if !_rules[ruleeq]() { + goto l164 + } + if !_rules[rulevalue]() { + goto l164 + } + if !_rules[rulecomma]() { + goto l164 } { - position216, tokenIndex216 := position, tokenIndex - if !_rules[rulecomma]() { - goto l216 + position176, tokenIndex176 := position, tokenIndex + if buffer[position] != rune('f') { + goto l176 } - if !_rules[ruleallargs]() { - goto l216 + position++ + if buffer[position] != rune('r') { + goto l176 } - goto l217 - l216: - position, tokenIndex = position216, tokenIndex216 - } - l217: - if !_rules[ruleclose]() { - goto l208 + position++ + if buffer[position] != rune('o') { + goto l176 + } + position++ + if buffer[position] != rune('m') { + goto l176 + } + position++ + if buffer[position] != rune('=') { + goto l176 + } + position++ + goto l177 + l176: + position, tokenIndex = position176, tokenIndex176 } + l177: { add(ruleAction23, position) } - goto l7 - l208: - position, tokenIndex = position7, tokenIndex7 - { - position220, tokenIndex220 := position, tokenIndex - if buffer[position] != rune('s') { - goto l221 - } - position++ - goto l220 - l221: - position, tokenIndex = position220, tokenIndex220 - if buffer[position] != rune('S') { - goto l219 - } - position++ + if !_rules[ruletimefmt]() { + goto l164 } - l220: - { - position222, tokenIndex222 := position, tokenIndex - if buffer[position] != rune('u') { - goto l223 - } - position++ - goto l222 - l223: - position, tokenIndex = position222, tokenIndex222 - if buffer[position] != rune('U') { - goto l219 - } - position++ - } - l222: - { - position224, tokenIndex224 := position, tokenIndex - if buffer[position] != rune('m') { - goto l225 - } - position++ - goto l224 - l225: - position, tokenIndex = position224, tokenIndex224 - if buffer[position] != rune('M') { - goto l219 - } - position++ - } - l224: { add(ruleAction24, position) } - if !_rules[ruleopen]() { - goto l219 - } - if !_rules[ruleposfield]() { - goto l219 + if !_rules[rulecomma]() { + goto l164 } { - position227, tokenIndex227 := position, tokenIndex - if !_rules[rulecomma]() { - goto l227 + position180, tokenIndex180 := position, tokenIndex + if buffer[position] != rune('t') { + goto l180 } - if !_rules[ruleallargs]() { - goto l227 + position++ + if buffer[position] != rune('o') { + goto l180 } - goto l228 - l227: - position, tokenIndex = position227, tokenIndex227 + position++ + if buffer[position] != rune('=') { + goto l180 + } + position++ + goto l181 + l180: + position, tokenIndex = position180, tokenIndex180 } - l228: - if !_rules[ruleclose]() { - goto l219 + l181: + if !_rules[rulesp]() { + goto l164 } { add(ruleAction25, position) } - goto l7 - l219: - position, tokenIndex = position7, tokenIndex7 - { - position231, tokenIndex231 := position, tokenIndex - if buffer[position] != rune('r') { - goto l232 - } - position++ - goto l231 - l232: - position, tokenIndex = position231, tokenIndex231 - if buffer[position] != rune('R') { - goto l230 - } - position++ + if !_rules[ruletimefmt]() { + goto l164 } - l231: - { - position233, tokenIndex233 := position, tokenIndex - if buffer[position] != rune('a') { - goto l234 - } - position++ - goto l233 - l234: - position, tokenIndex = position233, tokenIndex233 - if buffer[position] != rune('A') { - goto l230 - } - position++ - } - l233: - { - position235, tokenIndex235 := position, tokenIndex - if buffer[position] != rune('n') { - goto l236 - } - position++ - goto l235 - l236: - position, tokenIndex = position235, tokenIndex235 - if buffer[position] != rune('N') { - goto l230 - } - position++ - } - l235: - { - position237, tokenIndex237 := position, tokenIndex - if buffer[position] != rune('g') { - goto l238 - } - position++ - goto l237 - l238: - position, tokenIndex = position237, tokenIndex237 - if buffer[position] != rune('G') { - goto l230 - } - position++ - } - l237: - { - position239, tokenIndex239 := position, tokenIndex - if buffer[position] != rune('e') { - goto l240 - } - position++ - goto l239 - l240: - position, tokenIndex = position239, tokenIndex239 - if buffer[position] != rune('E') { - goto l230 - } - position++ - } - l239: { add(ruleAction26, position) } - if !_rules[ruleopen]() { - goto l230 + if !_rules[ruleclose]() { + goto l164 } - if !_rules[rulefield]() { - goto l230 - } - if !_rules[ruleeq]() { - goto l230 - } - if !_rules[rulevalue]() { - goto l230 - } - if !_rules[rulecomma]() { - goto l230 - } - { - position242, tokenIndex242 := position, tokenIndex - if buffer[position] != rune('f') { - goto l242 - } - position++ - if buffer[position] != rune('r') { - goto l242 - } - position++ - if buffer[position] != rune('o') { - goto l242 - } - position++ - if buffer[position] != rune('m') { - goto l242 - } - position++ - if buffer[position] != rune('=') { - goto l242 - } - position++ - goto l243 - l242: - position, tokenIndex = position242, tokenIndex242 - } - l243: { add(ruleAction27, position) } - if !_rules[ruletimefmt]() { - goto l230 - } - { - add(ruleAction28, position) - } - if !_rules[rulecomma]() { - goto l230 - } - { - position246, tokenIndex246 := position, tokenIndex - if buffer[position] != rune('t') { - goto l246 - } - position++ - if buffer[position] != rune('o') { - goto l246 - } - position++ - if buffer[position] != rune('=') { - goto l246 - } - position++ - goto l247 - l246: - position, tokenIndex = position246, tokenIndex246 - } - l247: - if !_rules[rulesp]() { - goto l230 - } - { - add(ruleAction29, position) - } - if !_rules[ruletimefmt]() { - goto l230 - } - { - add(ruleAction30, position) - } - if !_rules[ruleclose]() { - goto l230 - } - { - add(ruleAction31, position) - } goto l7 - l230: + l164: position, tokenIndex = position7, tokenIndex7 { - position251 := position + position185 := position if !_rules[ruleIDENT]() { goto l5 } - add(rulePegText, position251) + add(rulePegText, position185) } { - add(ruleAction32, position) + add(ruleAction28, position) } if !_rules[ruleopen]() { goto l5 @@ -2517,20 +1994,20 @@ func (p *PQL) Init(options ...func(*PQL) error) error { goto l5 } { - position253, tokenIndex253 := position, tokenIndex + position187, tokenIndex187 := position, tokenIndex if !_rules[rulecomma]() { - goto l253 + goto l187 } - goto l254 - l253: - position, tokenIndex = position253, tokenIndex253 + goto l188 + l187: + position, tokenIndex = position187, tokenIndex187 } - l254: + l188: if !_rules[ruleclose]() { goto l5 } { - add(ruleAction33, position) + add(ruleAction29, position) } } l7: @@ -2543,2267 +2020,2251 @@ func (p *PQL) Init(options ...func(*PQL) error) error { }, /* 2 allargs <- <((Call (comma Call)* (comma args)?) / args / sp)> */ func() bool { - position256, tokenIndex256 := position, tokenIndex + position190, tokenIndex190 := position, tokenIndex { - position257 := position + position191 := position { - position258, tokenIndex258 := position, tokenIndex + position192, tokenIndex192 := position, tokenIndex if !_rules[ruleCall]() { - goto l259 + goto l193 } - l260: + l194: { - position261, tokenIndex261 := position, tokenIndex + position195, tokenIndex195 := position, tokenIndex if !_rules[rulecomma]() { - goto l261 + goto l195 } if !_rules[ruleCall]() { - goto l261 + goto l195 } - goto l260 - l261: - position, tokenIndex = position261, tokenIndex261 + goto l194 + l195: + position, tokenIndex = position195, tokenIndex195 } { - position262, tokenIndex262 := position, tokenIndex + position196, tokenIndex196 := position, tokenIndex if !_rules[rulecomma]() { - goto l262 + goto l196 } if !_rules[ruleargs]() { - goto l262 + goto l196 } - goto l263 - l262: - position, tokenIndex = position262, tokenIndex262 + goto l197 + l196: + position, tokenIndex = position196, tokenIndex196 } - l263: - goto l258 - l259: - position, tokenIndex = position258, tokenIndex258 + l197: + goto l192 + l193: + position, tokenIndex = position192, tokenIndex192 if !_rules[ruleargs]() { - goto l264 + goto l198 } - goto l258 - l264: - position, tokenIndex = position258, tokenIndex258 + goto l192 + l198: + position, tokenIndex = position192, tokenIndex192 if !_rules[rulesp]() { - goto l256 + goto l190 } } - l258: - add(ruleallargs, position257) + l192: + add(ruleallargs, position191) } return true - l256: - position, tokenIndex = position256, tokenIndex256 + l190: + position, tokenIndex = position190, tokenIndex190 return false }, /* 3 args <- <(arg (comma args)? sp)> */ func() bool { - position265, tokenIndex265 := position, tokenIndex + position199, tokenIndex199 := position, tokenIndex { - position266 := position + position200 := position if !_rules[rulearg]() { - goto l265 + goto l199 } { - position267, tokenIndex267 := position, tokenIndex + position201, tokenIndex201 := position, tokenIndex if !_rules[rulecomma]() { - goto l267 + goto l201 } if !_rules[ruleargs]() { - goto l267 + goto l201 } - goto l268 - l267: - position, tokenIndex = position267, tokenIndex267 + goto l202 + l201: + position, tokenIndex = position201, tokenIndex201 } - l268: + l202: if !_rules[rulesp]() { - goto l265 + goto l199 } - add(ruleargs, position266) + add(ruleargs, position200) } return true - l265: - position, tokenIndex = position265, tokenIndex265 + l199: + position, tokenIndex = position199, tokenIndex199 return false }, /* 4 arg <- <((field eq value) / (field sp COND sp value) / conditional)> */ func() bool { - position269, tokenIndex269 := position, tokenIndex + position203, tokenIndex203 := position, tokenIndex { - position270 := position + position204 := position { - position271, tokenIndex271 := position, tokenIndex + position205, tokenIndex205 := position, tokenIndex if !_rules[rulefield]() { - goto l272 + goto l206 } if !_rules[ruleeq]() { - goto l272 + goto l206 } if !_rules[rulevalue]() { - goto l272 + goto l206 } - goto l271 - l272: - position, tokenIndex = position271, tokenIndex271 + goto l205 + l206: + position, tokenIndex = position205, tokenIndex205 if !_rules[rulefield]() { - goto l273 + goto l207 } if !_rules[rulesp]() { - goto l273 + goto l207 } { - position274 := position + position208 := position { - position275, tokenIndex275 := position, tokenIndex + position209, tokenIndex209 := position, tokenIndex if buffer[position] != rune('>') { - goto l276 + goto l210 } position++ if buffer[position] != rune('<') { - goto l276 + goto l210 + } + position++ + { + add(ruleAction30, position) + } + goto l209 + l210: + position, tokenIndex = position209, tokenIndex209 + if buffer[position] != rune('<') { + goto l212 + } + position++ + if buffer[position] != rune('=') { + goto l212 + } + position++ + { + add(ruleAction31, position) + } + goto l209 + l212: + position, tokenIndex = position209, tokenIndex209 + if buffer[position] != rune('>') { + goto l214 + } + position++ + if buffer[position] != rune('=') { + goto l214 + } + position++ + { + add(ruleAction32, position) + } + goto l209 + l214: + position, tokenIndex = position209, tokenIndex209 + if buffer[position] != rune('=') { + goto l216 + } + position++ + if buffer[position] != rune('=') { + goto l216 + } + position++ + { + add(ruleAction33, position) + } + goto l209 + l216: + position, tokenIndex = position209, tokenIndex209 + if buffer[position] != rune('!') { + goto l218 + } + position++ + if buffer[position] != rune('=') { + goto l218 } position++ { add(ruleAction34, position) } - goto l275 - l276: - position, tokenIndex = position275, tokenIndex275 + goto l209 + l218: + position, tokenIndex = position209, tokenIndex209 if buffer[position] != rune('<') { - goto l278 - } - position++ - if buffer[position] != rune('=') { - goto l278 + goto l220 } position++ { add(ruleAction35, position) } - goto l275 - l278: - position, tokenIndex = position275, tokenIndex275 + goto l209 + l220: + position, tokenIndex = position209, tokenIndex209 if buffer[position] != rune('>') { - goto l280 - } - position++ - if buffer[position] != rune('=') { - goto l280 + goto l207 } position++ { add(ruleAction36, position) } - goto l275 - l280: - position, tokenIndex = position275, tokenIndex275 - if buffer[position] != rune('=') { - goto l282 - } - position++ - if buffer[position] != rune('=') { - goto l282 - } - position++ - { - add(ruleAction37, position) - } - goto l275 - l282: - position, tokenIndex = position275, tokenIndex275 - if buffer[position] != rune('!') { - goto l284 - } - position++ - if buffer[position] != rune('=') { - goto l284 - } - position++ - { - add(ruleAction38, position) - } - goto l275 - l284: - position, tokenIndex = position275, tokenIndex275 - if buffer[position] != rune('<') { - goto l286 - } - position++ - { - add(ruleAction39, position) - } - goto l275 - l286: - position, tokenIndex = position275, tokenIndex275 - if buffer[position] != rune('>') { - goto l273 - } - position++ - { - add(ruleAction40, position) - } } - l275: - add(ruleCOND, position274) + l209: + add(ruleCOND, position208) } if !_rules[rulesp]() { - goto l273 + goto l207 } if !_rules[rulevalue]() { - goto l273 + goto l207 } - goto l271 - l273: - position, tokenIndex = position271, tokenIndex271 + goto l205 + l207: + position, tokenIndex = position205, tokenIndex205 { - position289 := position + position223 := position { - add(ruleAction41, position) + add(ruleAction37, position) } if !_rules[rulecondint]() { - goto l269 + goto l203 } if !_rules[rulecondLT]() { - goto l269 + goto l203 } { - position291 := position + position225 := position { - position292 := position + position226 := position if !_rules[rulefieldExpr]() { - goto l269 + goto l203 } - add(rulePegText, position292) + add(rulePegText, position226) } if !_rules[rulesp]() { - goto l269 + goto l203 } { - add(ruleAction45, position) + add(ruleAction41, position) } - add(rulecondfield, position291) + add(rulecondfield, position225) } if !_rules[rulecondLT]() { - goto l269 + goto l203 } if !_rules[rulecondint]() { - goto l269 + goto l203 } { - add(ruleAction42, position) + add(ruleAction38, position) } - add(ruleconditional, position289) + add(ruleconditional, position223) } } - l271: - add(rulearg, position270) + l205: + add(rulearg, position204) } return true - l269: - position, tokenIndex = position269, tokenIndex269 + l203: + position, tokenIndex = position203, tokenIndex203 return false }, - /* 5 COND <- <(('>' '<' Action34) / ('<' '=' Action35) / ('>' '=' Action36) / ('=' '=' Action37) / ('!' '=' Action38) / ('<' Action39) / ('>' Action40))> */ + /* 5 COND <- <(('>' '<' Action30) / ('<' '=' Action31) / ('>' '=' Action32) / ('=' '=' Action33) / ('!' '=' Action34) / ('<' Action35) / ('>' Action36))> */ nil, - /* 6 conditional <- <(Action41 condint condLT condfield condLT condint Action42)> */ + /* 6 conditional <- <(Action37 condint condLT condfield condLT condint Action38)> */ nil, - /* 7 condint <- <( sp Action43)> */ + /* 7 condint <- <( sp Action39)> */ func() bool { - position297, tokenIndex297 := position, tokenIndex + position231, tokenIndex231 := position, tokenIndex { - position298 := position + position232 := position { - position299 := position + position233 := position if !_rules[ruledecimal]() { - goto l297 + goto l231 } - add(rulePegText, position299) + add(rulePegText, position233) } if !_rules[rulesp]() { - goto l297 + goto l231 } { - add(ruleAction43, position) + add(ruleAction39, position) } - add(rulecondint, position298) + add(rulecondint, position232) } return true - l297: - position, tokenIndex = position297, tokenIndex297 + l231: + position, tokenIndex = position231, tokenIndex231 return false }, - /* 8 condLT <- <(<(('<' '=') / '<')> sp Action44)> */ + /* 8 condLT <- <(<(('<' '=') / '<')> sp Action40)> */ func() bool { - position301, tokenIndex301 := position, tokenIndex + position235, tokenIndex235 := position, tokenIndex { - position302 := position + position236 := position { - position303 := position + position237 := position { - position304, tokenIndex304 := position, tokenIndex + position238, tokenIndex238 := position, tokenIndex if buffer[position] != rune('<') { - goto l305 + goto l239 } position++ if buffer[position] != rune('=') { - goto l305 + goto l239 } position++ - goto l304 - l305: - position, tokenIndex = position304, tokenIndex304 + goto l238 + l239: + position, tokenIndex = position238, tokenIndex238 if buffer[position] != rune('<') { - goto l301 + goto l235 } position++ } - l304: - add(rulePegText, position303) + l238: + add(rulePegText, position237) } if !_rules[rulesp]() { - goto l301 + goto l235 } { - add(ruleAction44, position) + add(ruleAction40, position) } - add(rulecondLT, position302) + add(rulecondLT, position236) } return true - l301: - position, tokenIndex = position301, tokenIndex301 + l235: + position, tokenIndex = position235, tokenIndex235 return false }, - /* 9 condfield <- <( sp Action45)> */ + /* 9 condfield <- <( sp Action41)> */ nil, - /* 10 value <- <(item / (lbrack Action46 items rbrack Action47))> */ + /* 10 value <- <(item / (lbrack Action42 items rbrack Action43))> */ func() bool { - position308, tokenIndex308 := position, tokenIndex + position242, tokenIndex242 := position, tokenIndex { - position309 := position + position243 := position { - position310, tokenIndex310 := position, tokenIndex + position244, tokenIndex244 := position, tokenIndex if !_rules[ruleitem]() { - goto l311 + goto l245 } - goto l310 - l311: - position, tokenIndex = position310, tokenIndex310 + goto l244 + l245: + position, tokenIndex = position244, tokenIndex244 { - position312 := position + position246 := position if buffer[position] != rune('[') { - goto l308 + goto l242 } position++ if !_rules[rulesp]() { - goto l308 + goto l242 } - add(rulelbrack, position312) + add(rulelbrack, position246) } { - add(ruleAction46, position) + add(ruleAction42, position) } if !_rules[ruleitems]() { - goto l308 + goto l242 } { - position314 := position + position248 := position if !_rules[rulesp]() { - goto l308 + goto l242 } if buffer[position] != rune(']') { - goto l308 + goto l242 } position++ if !_rules[rulesp]() { - goto l308 + goto l242 } - add(rulerbrack, position314) + add(rulerbrack, position248) } { - add(ruleAction47, position) + add(ruleAction43, position) } } - l310: - add(rulevalue, position309) + l244: + add(rulevalue, position243) } return true - l308: - position, tokenIndex = position308, tokenIndex308 + l242: + position, tokenIndex = position242, tokenIndex242 return false }, /* 11 items <- <(item (comma items)?)> */ func() bool { - position316, tokenIndex316 := position, tokenIndex + position250, tokenIndex250 := position, tokenIndex { - position317 := position + position251 := position if !_rules[ruleitem]() { - goto l316 + goto l250 } { - position318, tokenIndex318 := position, tokenIndex + position252, tokenIndex252 := position, tokenIndex if !_rules[rulecomma]() { - goto l318 + goto l252 } if !_rules[ruleitems]() { - goto l318 + goto l252 } - goto l319 - l318: - position, tokenIndex = position318, tokenIndex318 + goto l253 + l252: + position, tokenIndex = position252, tokenIndex252 } - l319: - add(ruleitems, position317) + l253: + add(ruleitems, position251) } return true - l316: - position, tokenIndex = position316, tokenIndex316 + l250: + position, tokenIndex = position250, tokenIndex250 return false }, - /* 12 item <- <(('n' 'u' 'l' 'l' &(comma / close) Action48) / ('t' 'r' 'u' 'e' &(comma / close) Action49) / ('f' 'a' 'l' 's' 'e' &(comma / close) Action50) / (timefmt Action51) / (timestampfmt Action52) / ( Action53) / ( Action54 open allargs comma? close Action55) / (<([a-z] / [A-Z] / [0-9] / '-' / '_' / ':')+> Action56) / (<('"' doublequotedstring '"')> Action57) / (<('\'' singlequotedstring '\'')> Action58))> */ + /* 12 item <- <(('n' 'u' 'l' 'l' &(comma / close) Action44) / ('t' 'r' 'u' 'e' &(comma / close) Action45) / ('f' 'a' 'l' 's' 'e' &(comma / close) Action46) / (timefmt Action47) / (timestampfmt Action48) / ( Action49) / ( Action50 open allargs comma? close Action51) / (<([a-z] / [A-Z] / [0-9] / '-' / '_' / ':')+> Action52) / (<('"' doublequotedstring '"')> Action53) / (<('\'' singlequotedstring '\'')> Action54))> */ func() bool { - position320, tokenIndex320 := position, tokenIndex + position254, tokenIndex254 := position, tokenIndex { - position321 := position + position255 := position { - position322, tokenIndex322 := position, tokenIndex + position256, tokenIndex256 := position, tokenIndex if buffer[position] != rune('n') { - goto l323 + goto l257 } position++ if buffer[position] != rune('u') { - goto l323 + goto l257 } position++ if buffer[position] != rune('l') { - goto l323 + goto l257 } position++ if buffer[position] != rune('l') { - goto l323 + goto l257 } position++ { - position324, tokenIndex324 := position, tokenIndex + position258, tokenIndex258 := position, tokenIndex { - position325, tokenIndex325 := position, tokenIndex + position259, tokenIndex259 := position, tokenIndex if !_rules[rulecomma]() { - goto l326 + goto l260 } - goto l325 - l326: - position, tokenIndex = position325, tokenIndex325 + goto l259 + l260: + position, tokenIndex = position259, tokenIndex259 if !_rules[ruleclose]() { - goto l323 + goto l257 } } - l325: - position, tokenIndex = position324, tokenIndex324 + l259: + position, tokenIndex = position258, tokenIndex258 + } + { + add(ruleAction44, position) + } + goto l256 + l257: + position, tokenIndex = position256, tokenIndex256 + if buffer[position] != rune('t') { + goto l262 + } + position++ + if buffer[position] != rune('r') { + goto l262 + } + position++ + if buffer[position] != rune('u') { + goto l262 + } + position++ + if buffer[position] != rune('e') { + goto l262 + } + position++ + { + position263, tokenIndex263 := position, tokenIndex + { + position264, tokenIndex264 := position, tokenIndex + if !_rules[rulecomma]() { + goto l265 + } + goto l264 + l265: + position, tokenIndex = position264, tokenIndex264 + if !_rules[ruleclose]() { + goto l262 + } + } + l264: + position, tokenIndex = position263, tokenIndex263 + } + { + add(ruleAction45, position) + } + goto l256 + l262: + position, tokenIndex = position256, tokenIndex256 + if buffer[position] != rune('f') { + goto l267 + } + position++ + if buffer[position] != rune('a') { + goto l267 + } + position++ + if buffer[position] != rune('l') { + goto l267 + } + position++ + if buffer[position] != rune('s') { + goto l267 + } + position++ + if buffer[position] != rune('e') { + goto l267 + } + position++ + { + position268, tokenIndex268 := position, tokenIndex + { + position269, tokenIndex269 := position, tokenIndex + if !_rules[rulecomma]() { + goto l270 + } + goto l269 + l270: + position, tokenIndex = position269, tokenIndex269 + if !_rules[ruleclose]() { + goto l267 + } + } + l269: + position, tokenIndex = position268, tokenIndex268 + } + { + add(ruleAction46, position) + } + goto l256 + l267: + position, tokenIndex = position256, tokenIndex256 + if !_rules[ruletimefmt]() { + goto l272 + } + { + add(ruleAction47, position) + } + goto l256 + l272: + position, tokenIndex = position256, tokenIndex256 + { + position275 := position + { + position276, tokenIndex276 := position, tokenIndex + if buffer[position] != rune('"') { + goto l277 + } + position++ + { + position278 := position + if !_rules[ruletimestampbasicfmt]() { + goto l277 + } + add(rulePegText, position278) + } + if buffer[position] != rune('"') { + goto l277 + } + position++ + goto l276 + l277: + position, tokenIndex = position276, tokenIndex276 + if buffer[position] != rune('\'') { + goto l279 + } + position++ + { + position280 := position + if !_rules[ruletimestampbasicfmt]() { + goto l279 + } + add(rulePegText, position280) + } + if buffer[position] != rune('\'') { + goto l279 + } + position++ + goto l276 + l279: + position, tokenIndex = position276, tokenIndex276 + { + position281 := position + if !_rules[ruletimestampbasicfmt]() { + goto l274 + } + add(rulePegText, position281) + } + } + l276: + add(ruletimestampfmt, position275) } { add(ruleAction48, position) } - goto l322 - l323: - position, tokenIndex = position322, tokenIndex322 - if buffer[position] != rune('t') { - goto l328 - } - position++ - if buffer[position] != rune('r') { - goto l328 - } - position++ - if buffer[position] != rune('u') { - goto l328 - } - position++ - if buffer[position] != rune('e') { - goto l328 - } - position++ + goto l256 + l274: + position, tokenIndex = position256, tokenIndex256 { - position329, tokenIndex329 := position, tokenIndex - { - position330, tokenIndex330 := position, tokenIndex - if !_rules[rulecomma]() { - goto l331 - } - goto l330 - l331: - position, tokenIndex = position330, tokenIndex330 - if !_rules[ruleclose]() { - goto l328 - } + position284 := position + if !_rules[ruledecimal]() { + goto l283 } - l330: - position, tokenIndex = position329, tokenIndex329 + add(rulePegText, position284) } { add(ruleAction49, position) } - goto l322 - l328: - position, tokenIndex = position322, tokenIndex322 - if buffer[position] != rune('f') { - goto l333 - } - position++ - if buffer[position] != rune('a') { - goto l333 - } - position++ - if buffer[position] != rune('l') { - goto l333 - } - position++ - if buffer[position] != rune('s') { - goto l333 - } - position++ - if buffer[position] != rune('e') { - goto l333 - } - position++ + goto l256 + l283: + position, tokenIndex = position256, tokenIndex256 { - position334, tokenIndex334 := position, tokenIndex - { - position335, tokenIndex335 := position, tokenIndex - if !_rules[rulecomma]() { - goto l336 - } - goto l335 - l336: - position, tokenIndex = position335, tokenIndex335 - if !_rules[ruleclose]() { - goto l333 - } + position287 := position + if !_rules[ruleIDENT]() { + goto l286 } - l335: - position, tokenIndex = position334, tokenIndex334 + add(rulePegText, position287) } { add(ruleAction50, position) } - goto l322 - l333: - position, tokenIndex = position322, tokenIndex322 - if !_rules[ruletimefmt]() { - goto l338 + if !_rules[ruleopen]() { + goto l286 + } + if !_rules[ruleallargs]() { + goto l286 + } + { + position289, tokenIndex289 := position, tokenIndex + if !_rules[rulecomma]() { + goto l289 + } + goto l290 + l289: + position, tokenIndex = position289, tokenIndex289 + } + l290: + if !_rules[ruleclose]() { + goto l286 } { add(ruleAction51, position) } - goto l322 - l338: - position, tokenIndex = position322, tokenIndex322 + goto l256 + l286: + position, tokenIndex = position256, tokenIndex256 { - position341 := position + position293 := position { - position342, tokenIndex342 := position, tokenIndex - if buffer[position] != rune('"') { - goto l343 + position296, tokenIndex296 := position, tokenIndex + if c := buffer[position]; c < rune('a') || c > rune('z') { + goto l297 } position++ - { - position344 := position - if !_rules[ruletimestampbasicfmt]() { - goto l343 - } - add(rulePegText, position344) - } - if buffer[position] != rune('"') { - goto l343 + goto l296 + l297: + position, tokenIndex = position296, tokenIndex296 + if c := buffer[position]; c < rune('A') || c > rune('Z') { + goto l298 } position++ - goto l342 - l343: - position, tokenIndex = position342, tokenIndex342 - if buffer[position] != rune('\'') { - goto l345 + goto l296 + l298: + position, tokenIndex = position296, tokenIndex296 + if c := buffer[position]; c < rune('0') || c > rune('9') { + goto l299 } position++ - { - position346 := position - if !_rules[ruletimestampbasicfmt]() { - goto l345 - } - add(rulePegText, position346) - } - if buffer[position] != rune('\'') { - goto l345 + goto l296 + l299: + position, tokenIndex = position296, tokenIndex296 + if buffer[position] != rune('-') { + goto l300 } position++ - goto l342 - l345: - position, tokenIndex = position342, tokenIndex342 - { - position347 := position - if !_rules[ruletimestampbasicfmt]() { - goto l340 - } - add(rulePegText, position347) + goto l296 + l300: + position, tokenIndex = position296, tokenIndex296 + if buffer[position] != rune('_') { + goto l301 } + position++ + goto l296 + l301: + position, tokenIndex = position296, tokenIndex296 + if buffer[position] != rune(':') { + goto l292 + } + position++ } - l342: - add(ruletimestampfmt, position341) + l296: + l294: + { + position295, tokenIndex295 := position, tokenIndex + { + position302, tokenIndex302 := position, tokenIndex + if c := buffer[position]; c < rune('a') || c > rune('z') { + goto l303 + } + position++ + goto l302 + l303: + position, tokenIndex = position302, tokenIndex302 + if c := buffer[position]; c < rune('A') || c > rune('Z') { + goto l304 + } + position++ + goto l302 + l304: + position, tokenIndex = position302, tokenIndex302 + if c := buffer[position]; c < rune('0') || c > rune('9') { + goto l305 + } + position++ + goto l302 + l305: + position, tokenIndex = position302, tokenIndex302 + if buffer[position] != rune('-') { + goto l306 + } + position++ + goto l302 + l306: + position, tokenIndex = position302, tokenIndex302 + if buffer[position] != rune('_') { + goto l307 + } + position++ + goto l302 + l307: + position, tokenIndex = position302, tokenIndex302 + if buffer[position] != rune(':') { + goto l295 + } + position++ + } + l302: + goto l294 + l295: + position, tokenIndex = position295, tokenIndex295 + } + add(rulePegText, position293) } { add(ruleAction52, position) } - goto l322 - l340: - position, tokenIndex = position322, tokenIndex322 + goto l256 + l292: + position, tokenIndex = position256, tokenIndex256 { - position350 := position - if !_rules[ruledecimal]() { - goto l349 + position310 := position + if buffer[position] != rune('"') { + goto l309 } - add(rulePegText, position350) + position++ + if !_rules[ruledoublequotedstring]() { + goto l309 + } + if buffer[position] != rune('"') { + goto l309 + } + position++ + add(rulePegText, position310) } { add(ruleAction53, position) } - goto l322 - l349: - position, tokenIndex = position322, tokenIndex322 + goto l256 + l309: + position, tokenIndex = position256, tokenIndex256 { - position353 := position - if !_rules[ruleIDENT]() { - goto l352 + position312 := position + if buffer[position] != rune('\'') { + goto l254 } - add(rulePegText, position353) + position++ + if !_rules[rulesinglequotedstring]() { + goto l254 + } + if buffer[position] != rune('\'') { + goto l254 + } + position++ + add(rulePegText, position312) } { add(ruleAction54, position) } - if !_rules[ruleopen]() { - goto l352 - } - if !_rules[ruleallargs]() { - goto l352 - } - { - position355, tokenIndex355 := position, tokenIndex - if !_rules[rulecomma]() { - goto l355 - } - goto l356 - l355: - position, tokenIndex = position355, tokenIndex355 - } - l356: - if !_rules[ruleclose]() { - goto l352 - } - { - add(ruleAction55, position) - } - goto l322 - l352: - position, tokenIndex = position322, tokenIndex322 - { - position359 := position - { - position362, tokenIndex362 := position, tokenIndex - if c := buffer[position]; c < rune('a') || c > rune('z') { - goto l363 - } - position++ - goto l362 - l363: - position, tokenIndex = position362, tokenIndex362 - if c := buffer[position]; c < rune('A') || c > rune('Z') { - goto l364 - } - position++ - goto l362 - l364: - position, tokenIndex = position362, tokenIndex362 - if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l365 - } - position++ - goto l362 - l365: - position, tokenIndex = position362, tokenIndex362 - if buffer[position] != rune('-') { - goto l366 - } - position++ - goto l362 - l366: - position, tokenIndex = position362, tokenIndex362 - if buffer[position] != rune('_') { - goto l367 - } - position++ - goto l362 - l367: - position, tokenIndex = position362, tokenIndex362 - if buffer[position] != rune(':') { - goto l358 - } - position++ - } - l362: - l360: - { - position361, tokenIndex361 := position, tokenIndex - { - position368, tokenIndex368 := position, tokenIndex - if c := buffer[position]; c < rune('a') || c > rune('z') { - goto l369 - } - position++ - goto l368 - l369: - position, tokenIndex = position368, tokenIndex368 - if c := buffer[position]; c < rune('A') || c > rune('Z') { - goto l370 - } - position++ - goto l368 - l370: - position, tokenIndex = position368, tokenIndex368 - if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l371 - } - position++ - goto l368 - l371: - position, tokenIndex = position368, tokenIndex368 - if buffer[position] != rune('-') { - goto l372 - } - position++ - goto l368 - l372: - position, tokenIndex = position368, tokenIndex368 - if buffer[position] != rune('_') { - goto l373 - } - position++ - goto l368 - l373: - position, tokenIndex = position368, tokenIndex368 - if buffer[position] != rune(':') { - goto l361 - } - position++ - } - l368: - goto l360 - l361: - position, tokenIndex = position361, tokenIndex361 - } - add(rulePegText, position359) - } - { - add(ruleAction56, position) - } - goto l322 - l358: - position, tokenIndex = position322, tokenIndex322 - { - position376 := position - if buffer[position] != rune('"') { - goto l375 - } - position++ - if !_rules[ruledoublequotedstring]() { - goto l375 - } - if buffer[position] != rune('"') { - goto l375 - } - position++ - add(rulePegText, position376) - } - { - add(ruleAction57, position) - } - goto l322 - l375: - position, tokenIndex = position322, tokenIndex322 - { - position378 := position - if buffer[position] != rune('\'') { - goto l320 - } - position++ - if !_rules[rulesinglequotedstring]() { - goto l320 - } - if buffer[position] != rune('\'') { - goto l320 - } - position++ - add(rulePegText, position378) - } - { - add(ruleAction58, position) - } } - l322: - add(ruleitem, position321) + l256: + add(ruleitem, position255) } return true - l320: - position, tokenIndex = position320, tokenIndex320 + l254: + position, tokenIndex = position254, tokenIndex254 return false }, /* 13 doublequotedstring <- <(('\\' '"') / ('\\' '\\') / ('\\' 'n') / ('\\' 't') / (!('"' / '\\') .))*> */ func() bool { { - position381 := position - l382: + position315 := position + l316: { - position383, tokenIndex383 := position, tokenIndex + position317, tokenIndex317 := position, tokenIndex { - position384, tokenIndex384 := position, tokenIndex + position318, tokenIndex318 := position, tokenIndex if buffer[position] != rune('\\') { - goto l385 + goto l319 } position++ if buffer[position] != rune('"') { - goto l385 + goto l319 } position++ - goto l384 - l385: - position, tokenIndex = position384, tokenIndex384 + goto l318 + l319: + position, tokenIndex = position318, tokenIndex318 if buffer[position] != rune('\\') { - goto l386 + goto l320 } position++ if buffer[position] != rune('\\') { - goto l386 + goto l320 } position++ - goto l384 - l386: - position, tokenIndex = position384, tokenIndex384 + goto l318 + l320: + position, tokenIndex = position318, tokenIndex318 if buffer[position] != rune('\\') { - goto l387 + goto l321 } position++ if buffer[position] != rune('n') { - goto l387 + goto l321 } position++ - goto l384 - l387: - position, tokenIndex = position384, tokenIndex384 + goto l318 + l321: + position, tokenIndex = position318, tokenIndex318 if buffer[position] != rune('\\') { - goto l388 + goto l322 } position++ if buffer[position] != rune('t') { - goto l388 + goto l322 } position++ - goto l384 - l388: - position, tokenIndex = position384, tokenIndex384 + goto l318 + l322: + position, tokenIndex = position318, tokenIndex318 { - position389, tokenIndex389 := position, tokenIndex + position323, tokenIndex323 := position, tokenIndex { - position390, tokenIndex390 := position, tokenIndex + position324, tokenIndex324 := position, tokenIndex if buffer[position] != rune('"') { - goto l391 + goto l325 } position++ - goto l390 - l391: - position, tokenIndex = position390, tokenIndex390 + goto l324 + l325: + position, tokenIndex = position324, tokenIndex324 if buffer[position] != rune('\\') { - goto l389 + goto l323 } position++ } - l390: - goto l383 - l389: - position, tokenIndex = position389, tokenIndex389 + l324: + goto l317 + l323: + position, tokenIndex = position323, tokenIndex323 } if !matchDot() { - goto l383 + goto l317 } } - l384: - goto l382 - l383: - position, tokenIndex = position383, tokenIndex383 + l318: + goto l316 + l317: + position, tokenIndex = position317, tokenIndex317 } - add(ruledoublequotedstring, position381) + add(ruledoublequotedstring, position315) } return true }, /* 14 singlequotedstring <- <(('\\' '\'') / ('\\' '\\') / ('\\' 'n') / ('\\' 't') / (!('\'' / '\\') .))*> */ func() bool { { - position393 := position - l394: + position327 := position + l328: { - position395, tokenIndex395 := position, tokenIndex + position329, tokenIndex329 := position, tokenIndex { - position396, tokenIndex396 := position, tokenIndex + position330, tokenIndex330 := position, tokenIndex if buffer[position] != rune('\\') { - goto l397 + goto l331 } position++ if buffer[position] != rune('\'') { - goto l397 + goto l331 } position++ - goto l396 - l397: - position, tokenIndex = position396, tokenIndex396 + goto l330 + l331: + position, tokenIndex = position330, tokenIndex330 if buffer[position] != rune('\\') { - goto l398 + goto l332 } position++ if buffer[position] != rune('\\') { - goto l398 + goto l332 } position++ - goto l396 - l398: - position, tokenIndex = position396, tokenIndex396 + goto l330 + l332: + position, tokenIndex = position330, tokenIndex330 if buffer[position] != rune('\\') { - goto l399 + goto l333 } position++ if buffer[position] != rune('n') { - goto l399 + goto l333 } position++ - goto l396 - l399: - position, tokenIndex = position396, tokenIndex396 + goto l330 + l333: + position, tokenIndex = position330, tokenIndex330 if buffer[position] != rune('\\') { - goto l400 + goto l334 } position++ if buffer[position] != rune('t') { - goto l400 + goto l334 } position++ - goto l396 - l400: - position, tokenIndex = position396, tokenIndex396 + goto l330 + l334: + position, tokenIndex = position330, tokenIndex330 { - position401, tokenIndex401 := position, tokenIndex + position335, tokenIndex335 := position, tokenIndex { - position402, tokenIndex402 := position, tokenIndex + position336, tokenIndex336 := position, tokenIndex if buffer[position] != rune('\'') { - goto l403 + goto l337 } position++ - goto l402 - l403: - position, tokenIndex = position402, tokenIndex402 + goto l336 + l337: + position, tokenIndex = position336, tokenIndex336 if buffer[position] != rune('\\') { - goto l401 + goto l335 } position++ } - l402: - goto l395 - l401: - position, tokenIndex = position401, tokenIndex401 + l336: + goto l329 + l335: + position, tokenIndex = position335, tokenIndex335 } if !matchDot() { - goto l395 + goto l329 } } - l396: - goto l394 - l395: - position, tokenIndex = position395, tokenIndex395 + l330: + goto l328 + l329: + position, tokenIndex = position329, tokenIndex329 } - add(rulesinglequotedstring, position393) + add(rulesinglequotedstring, position327) } return true }, /* 15 fieldExpr <- <(([a-z] / [A-Z] / '_') ([a-z] / [A-Z] / [0-9] / '_' / '-')*)> */ func() bool { - position404, tokenIndex404 := position, tokenIndex + position338, tokenIndex338 := position, tokenIndex { - position405 := position + position339 := position { - position406, tokenIndex406 := position, tokenIndex + position340, tokenIndex340 := position, tokenIndex if c := buffer[position]; c < rune('a') || c > rune('z') { - goto l407 + goto l341 } position++ - goto l406 - l407: - position, tokenIndex = position406, tokenIndex406 + goto l340 + l341: + position, tokenIndex = position340, tokenIndex340 if c := buffer[position]; c < rune('A') || c > rune('Z') { - goto l408 + goto l342 } position++ - goto l406 - l408: - position, tokenIndex = position406, tokenIndex406 + goto l340 + l342: + position, tokenIndex = position340, tokenIndex340 if buffer[position] != rune('_') { - goto l404 + goto l338 } position++ } - l406: - l409: + l340: + l343: { - position410, tokenIndex410 := position, tokenIndex + position344, tokenIndex344 := position, tokenIndex { - position411, tokenIndex411 := position, tokenIndex + position345, tokenIndex345 := position, tokenIndex if c := buffer[position]; c < rune('a') || c > rune('z') { - goto l412 + goto l346 } position++ - goto l411 - l412: - position, tokenIndex = position411, tokenIndex411 + goto l345 + l346: + position, tokenIndex = position345, tokenIndex345 if c := buffer[position]; c < rune('A') || c > rune('Z') { - goto l413 + goto l347 } position++ - goto l411 - l413: - position, tokenIndex = position411, tokenIndex411 + goto l345 + l347: + position, tokenIndex = position345, tokenIndex345 if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l414 + goto l348 } position++ - goto l411 - l414: - position, tokenIndex = position411, tokenIndex411 + goto l345 + l348: + position, tokenIndex = position345, tokenIndex345 if buffer[position] != rune('_') { - goto l415 + goto l349 } position++ - goto l411 - l415: - position, tokenIndex = position411, tokenIndex411 + goto l345 + l349: + position, tokenIndex = position345, tokenIndex345 if buffer[position] != rune('-') { - goto l410 + goto l344 } position++ } - l411: - goto l409 - l410: - position, tokenIndex = position410, tokenIndex410 + l345: + goto l343 + l344: + position, tokenIndex = position344, tokenIndex344 } - add(rulefieldExpr, position405) + add(rulefieldExpr, position339) } return true - l404: - position, tokenIndex = position404, tokenIndex404 + l338: + position, tokenIndex = position338, tokenIndex338 return false }, - /* 16 field <- <(<(fieldExpr / reserved)> Action59)> */ + /* 16 field <- <(<(fieldExpr / reserved)> Action55)> */ func() bool { - position416, tokenIndex416 := position, tokenIndex + position350, tokenIndex350 := position, tokenIndex { - position417 := position + position351 := position { - position418 := position + position352 := position { - position419, tokenIndex419 := position, tokenIndex + position353, tokenIndex353 := position, tokenIndex if !_rules[rulefieldExpr]() { - goto l420 + goto l354 } - goto l419 - l420: - position, tokenIndex = position419, tokenIndex419 + goto l353 + l354: + position, tokenIndex = position353, tokenIndex353 { - position421 := position + position355 := position { - position422, tokenIndex422 := position, tokenIndex + position356, tokenIndex356 := position, tokenIndex if buffer[position] != rune('_') { - goto l423 + goto l357 } position++ if buffer[position] != rune('r') { - goto l423 + goto l357 } position++ if buffer[position] != rune('o') { - goto l423 + goto l357 } position++ if buffer[position] != rune('w') { - goto l423 + goto l357 } position++ - goto l422 - l423: - position, tokenIndex = position422, tokenIndex422 + goto l356 + l357: + position, tokenIndex = position356, tokenIndex356 if buffer[position] != rune('_') { - goto l424 + goto l358 } position++ if buffer[position] != rune('c') { - goto l424 + goto l358 } position++ if buffer[position] != rune('o') { - goto l424 + goto l358 } position++ if buffer[position] != rune('l') { - goto l424 + goto l358 } position++ - goto l422 - l424: - position, tokenIndex = position422, tokenIndex422 + goto l356 + l358: + position, tokenIndex = position356, tokenIndex356 if buffer[position] != rune('_') { - goto l425 + goto l359 } position++ if buffer[position] != rune('s') { - goto l425 + goto l359 } position++ if buffer[position] != rune('t') { - goto l425 + goto l359 } position++ if buffer[position] != rune('a') { - goto l425 + goto l359 } position++ if buffer[position] != rune('r') { - goto l425 + goto l359 } position++ if buffer[position] != rune('t') { - goto l425 + goto l359 } position++ - goto l422 - l425: - position, tokenIndex = position422, tokenIndex422 + goto l356 + l359: + position, tokenIndex = position356, tokenIndex356 if buffer[position] != rune('_') { - goto l426 + goto l360 } position++ if buffer[position] != rune('e') { - goto l426 + goto l360 } position++ if buffer[position] != rune('n') { - goto l426 + goto l360 } position++ if buffer[position] != rune('d') { - goto l426 + goto l360 } position++ - goto l422 - l426: - position, tokenIndex = position422, tokenIndex422 + goto l356 + l360: + position, tokenIndex = position356, tokenIndex356 if buffer[position] != rune('_') { - goto l427 + goto l361 } position++ if buffer[position] != rune('t') { - goto l427 + goto l361 } position++ if buffer[position] != rune('i') { - goto l427 + goto l361 } position++ if buffer[position] != rune('m') { - goto l427 + goto l361 } position++ if buffer[position] != rune('e') { - goto l427 + goto l361 } position++ if buffer[position] != rune('s') { - goto l427 + goto l361 } position++ if buffer[position] != rune('t') { - goto l427 + goto l361 } position++ if buffer[position] != rune('a') { - goto l427 + goto l361 } position++ if buffer[position] != rune('m') { - goto l427 + goto l361 } position++ if buffer[position] != rune('p') { - goto l427 + goto l361 } position++ - goto l422 - l427: - position, tokenIndex = position422, tokenIndex422 + goto l356 + l361: + position, tokenIndex = position356, tokenIndex356 if buffer[position] != rune('_') { - goto l416 + goto l350 } position++ if buffer[position] != rune('f') { - goto l416 + goto l350 } position++ if buffer[position] != rune('i') { - goto l416 + goto l350 } position++ if buffer[position] != rune('e') { - goto l416 + goto l350 } position++ if buffer[position] != rune('l') { - goto l416 + goto l350 } position++ if buffer[position] != rune('d') { - goto l416 + goto l350 } position++ } - l422: - add(rulereserved, position421) + l356: + add(rulereserved, position355) } } - l419: - add(rulePegText, position418) + l353: + add(rulePegText, position352) } { - add(ruleAction59, position) + add(ruleAction55, position) } - add(rulefield, position417) + add(rulefield, position351) } return true - l416: - position, tokenIndex = position416, tokenIndex416 + l350: + position, tokenIndex = position350, tokenIndex350 return false }, /* 17 reserved <- <(('_' 'r' 'o' 'w') / ('_' 'c' 'o' 'l') / ('_' 's' 't' 'a' 'r' 't') / ('_' 'e' 'n' 'd') / ('_' 't' 'i' 'm' 'e' 's' 't' 'a' 'm' 'p') / ('_' 'f' 'i' 'e' 'l' 'd'))> */ nil, - /* 18 posfield <- <(('f' 'i' 'e' 'l' 'd' '=')? Action60)> */ + /* 18 posfield <- <(('f' 'i' 'e' 'l' 'd' '=')? Action56)> */ func() bool { - position430, tokenIndex430 := position, tokenIndex + position364, tokenIndex364 := position, tokenIndex { - position431 := position + position365 := position { - position432, tokenIndex432 := position, tokenIndex + position366, tokenIndex366 := position, tokenIndex if buffer[position] != rune('f') { - goto l432 + goto l366 } position++ if buffer[position] != rune('i') { - goto l432 + goto l366 } position++ if buffer[position] != rune('e') { - goto l432 + goto l366 } position++ if buffer[position] != rune('l') { - goto l432 + goto l366 } position++ if buffer[position] != rune('d') { - goto l432 + goto l366 } position++ if buffer[position] != rune('=') { - goto l432 + goto l366 } position++ - goto l433 - l432: - position, tokenIndex = position432, tokenIndex432 + goto l367 + l366: + position, tokenIndex = position366, tokenIndex366 } - l433: + l367: { - position434 := position + position368 := position if !_rules[rulefieldExpr]() { - goto l430 + goto l364 } - add(rulePegText, position434) + add(rulePegText, position368) } { - add(ruleAction60, position) + add(ruleAction56, position) } - add(ruleposfield, position431) + add(ruleposfield, position365) } return true - l430: - position, tokenIndex = position430, tokenIndex430 + l364: + position, tokenIndex = position364, tokenIndex364 return false }, - /* 19 col <- <(( Action61) / (<('\'' singlequotedstring '\'')> Action62) / (<('"' doublequotedstring '"')> Action63))> */ + /* 19 col <- <(( Action57) / (<('\'' singlequotedstring '\'')> Action58) / (<('"' doublequotedstring '"')> Action59))> */ func() bool { - position436, tokenIndex436 := position, tokenIndex + position370, tokenIndex370 := position, tokenIndex { - position437 := position + position371 := position { - position438, tokenIndex438 := position, tokenIndex + position372, tokenIndex372 := position, tokenIndex { - position440 := position + position374 := position if !_rules[ruledigits]() { - goto l439 + goto l373 } - add(rulePegText, position440) + add(rulePegText, position374) } { - add(ruleAction61, position) + add(ruleAction57, position) } - goto l438 - l439: - position, tokenIndex = position438, tokenIndex438 + goto l372 + l373: + position, tokenIndex = position372, tokenIndex372 { - position443 := position + position377 := position if buffer[position] != rune('\'') { - goto l442 + goto l376 } position++ if !_rules[rulesinglequotedstring]() { - goto l442 + goto l376 } if buffer[position] != rune('\'') { - goto l442 + goto l376 } position++ - add(rulePegText, position443) + add(rulePegText, position377) } { - add(ruleAction62, position) + add(ruleAction58, position) } - goto l438 - l442: - position, tokenIndex = position438, tokenIndex438 + goto l372 + l376: + position, tokenIndex = position372, tokenIndex372 { - position445 := position + position379 := position if buffer[position] != rune('"') { - goto l436 + goto l370 } position++ if !_rules[ruledoublequotedstring]() { - goto l436 + goto l370 } if buffer[position] != rune('"') { - goto l436 + goto l370 } position++ - add(rulePegText, position445) + add(rulePegText, position379) } { - add(ruleAction63, position) + add(ruleAction59, position) } } - l438: - add(rulecol, position437) + l372: + add(rulecol, position371) } return true - l436: - position, tokenIndex = position436, tokenIndex436 + l370: + position, tokenIndex = position370, tokenIndex370 return false }, - /* 20 row <- <(( Action64) / (<('\'' singlequotedstring '\'')> Action65) / (<('"' doublequotedstring '"')> Action66))> */ - nil, - /* 21 open <- <('(' sp)> */ + /* 20 open <- <('(' sp)> */ func() bool { - position448, tokenIndex448 := position, tokenIndex + position381, tokenIndex381 := position, tokenIndex { - position449 := position + position382 := position if buffer[position] != rune('(') { - goto l448 + goto l381 } position++ if !_rules[rulesp]() { - goto l448 + goto l381 } - add(ruleopen, position449) + add(ruleopen, position382) } return true - l448: - position, tokenIndex = position448, tokenIndex448 + l381: + position, tokenIndex = position381, tokenIndex381 return false }, - /* 22 close <- <(sp ')' sp)> */ + /* 21 close <- <(sp ')' sp)> */ func() bool { - position450, tokenIndex450 := position, tokenIndex + position383, tokenIndex383 := position, tokenIndex { - position451 := position + position384 := position if !_rules[rulesp]() { - goto l450 + goto l383 } if buffer[position] != rune(')') { - goto l450 + goto l383 } position++ if !_rules[rulesp]() { - goto l450 + goto l383 } - add(ruleclose, position451) + add(ruleclose, position384) } return true - l450: - position, tokenIndex = position450, tokenIndex450 + l383: + position, tokenIndex = position383, tokenIndex383 return false }, - /* 23 sp <- <(' ' / '\t' / '\n')*> */ + /* 22 sp <- <(' ' / '\t' / '\n')*> */ func() bool { { - position453 := position - l454: + position386 := position + l387: { - position455, tokenIndex455 := position, tokenIndex + position388, tokenIndex388 := position, tokenIndex { - position456, tokenIndex456 := position, tokenIndex + position389, tokenIndex389 := position, tokenIndex if buffer[position] != rune(' ') { - goto l457 + goto l390 } position++ - goto l456 - l457: - position, tokenIndex = position456, tokenIndex456 + goto l389 + l390: + position, tokenIndex = position389, tokenIndex389 if buffer[position] != rune('\t') { - goto l458 + goto l391 } position++ - goto l456 - l458: - position, tokenIndex = position456, tokenIndex456 + goto l389 + l391: + position, tokenIndex = position389, tokenIndex389 if buffer[position] != rune('\n') { - goto l455 + goto l388 } position++ } - l456: - goto l454 - l455: - position, tokenIndex = position455, tokenIndex455 + l389: + goto l387 + l388: + position, tokenIndex = position388, tokenIndex388 } - add(rulesp, position453) + add(rulesp, position386) } return true }, - /* 24 eq <- <(sp '=' sp)> */ + /* 23 eq <- <(sp '=' sp)> */ func() bool { - position459, tokenIndex459 := position, tokenIndex + position392, tokenIndex392 := position, tokenIndex { - position460 := position + position393 := position if !_rules[rulesp]() { - goto l459 + goto l392 } if buffer[position] != rune('=') { - goto l459 + goto l392 } position++ if !_rules[rulesp]() { - goto l459 + goto l392 } - add(ruleeq, position460) + add(ruleeq, position393) } return true - l459: - position, tokenIndex = position459, tokenIndex459 + l392: + position, tokenIndex = position392, tokenIndex392 return false }, - /* 25 comma <- <(sp ',' sp)> */ + /* 24 comma <- <(sp ',' sp)> */ func() bool { - position461, tokenIndex461 := position, tokenIndex + position394, tokenIndex394 := position, tokenIndex { - position462 := position + position395 := position if !_rules[rulesp]() { - goto l461 + goto l394 } if buffer[position] != rune(',') { - goto l461 + goto l394 } position++ if !_rules[rulesp]() { - goto l461 + goto l394 } - add(rulecomma, position462) + add(rulecomma, position395) } return true - l461: - position, tokenIndex = position461, tokenIndex461 + l394: + position, tokenIndex = position394, tokenIndex394 return false }, - /* 26 lbrack <- <('[' sp)> */ + /* 25 lbrack <- <('[' sp)> */ nil, - /* 27 rbrack <- <(sp ']' sp)> */ + /* 26 rbrack <- <(sp ']' sp)> */ nil, - /* 28 IDENT <- <(([a-z] / [A-Z]) ([a-z] / [A-Z] / [0-9])*)> */ + /* 27 IDENT <- <(([a-z] / [A-Z]) ([a-z] / [A-Z] / [0-9])*)> */ func() bool { - position465, tokenIndex465 := position, tokenIndex + position398, tokenIndex398 := position, tokenIndex { - position466 := position + position399 := position { - position467, tokenIndex467 := position, tokenIndex + position400, tokenIndex400 := position, tokenIndex if c := buffer[position]; c < rune('a') || c > rune('z') { - goto l468 + goto l401 } position++ - goto l467 - l468: - position, tokenIndex = position467, tokenIndex467 + goto l400 + l401: + position, tokenIndex = position400, tokenIndex400 if c := buffer[position]; c < rune('A') || c > rune('Z') { - goto l465 + goto l398 } position++ } - l467: - l469: + l400: + l402: { - position470, tokenIndex470 := position, tokenIndex + position403, tokenIndex403 := position, tokenIndex { - position471, tokenIndex471 := position, tokenIndex + position404, tokenIndex404 := position, tokenIndex if c := buffer[position]; c < rune('a') || c > rune('z') { - goto l472 + goto l405 } position++ - goto l471 - l472: - position, tokenIndex = position471, tokenIndex471 + goto l404 + l405: + position, tokenIndex = position404, tokenIndex404 if c := buffer[position]; c < rune('A') || c > rune('Z') { - goto l473 + goto l406 } position++ - goto l471 - l473: - position, tokenIndex = position471, tokenIndex471 + goto l404 + l406: + position, tokenIndex = position404, tokenIndex404 if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l470 + goto l403 } position++ } - l471: - goto l469 - l470: - position, tokenIndex = position470, tokenIndex470 + l404: + goto l402 + l403: + position, tokenIndex = position403, tokenIndex403 } - add(ruleIDENT, position466) + add(ruleIDENT, position399) } return true - l465: - position, tokenIndex = position465, tokenIndex465 + l398: + position, tokenIndex = position398, tokenIndex398 return false }, - /* 29 digits <- <[0-9]+> */ + /* 28 digits <- <[0-9]+> */ func() bool { - position474, tokenIndex474 := position, tokenIndex + position407, tokenIndex407 := position, tokenIndex { - position475 := position + position408 := position if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l474 + goto l407 } position++ - l476: + l409: { - position477, tokenIndex477 := position, tokenIndex + position410, tokenIndex410 := position, tokenIndex if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l477 + goto l410 } position++ - goto l476 - l477: - position, tokenIndex = position477, tokenIndex477 + goto l409 + l410: + position, tokenIndex = position410, tokenIndex410 } - add(ruledigits, position475) + add(ruledigits, position408) } return true - l474: - position, tokenIndex = position474, tokenIndex474 + l407: + position, tokenIndex = position407, tokenIndex407 return false }, - /* 30 signedDigits <- <('-'? digits)> */ + /* 29 signedDigits <- <('-'? digits)> */ nil, - /* 31 decimal <- <((signedDigits ('.' digits?)?) / ('-'? '.' digits))> */ + /* 30 decimal <- <((signedDigits ('.' digits?)?) / ('-'? '.' digits))> */ func() bool { - position479, tokenIndex479 := position, tokenIndex + position412, tokenIndex412 := position, tokenIndex { - position480 := position + position413 := position { - position481, tokenIndex481 := position, tokenIndex + position414, tokenIndex414 := position, tokenIndex { - position483 := position + position416 := position { - position484, tokenIndex484 := position, tokenIndex + position417, tokenIndex417 := position, tokenIndex if buffer[position] != rune('-') { - goto l484 + goto l417 } position++ - goto l485 - l484: - position, tokenIndex = position484, tokenIndex484 + goto l418 + l417: + position, tokenIndex = position417, tokenIndex417 } - l485: + l418: if !_rules[ruledigits]() { - goto l482 + goto l415 } - add(rulesignedDigits, position483) + add(rulesignedDigits, position416) } { - position486, tokenIndex486 := position, tokenIndex + position419, tokenIndex419 := position, tokenIndex if buffer[position] != rune('.') { - goto l486 + goto l419 } position++ { - position488, tokenIndex488 := position, tokenIndex + position421, tokenIndex421 := position, tokenIndex if !_rules[ruledigits]() { - goto l488 + goto l421 } - goto l489 - l488: - position, tokenIndex = position488, tokenIndex488 + goto l422 + l421: + position, tokenIndex = position421, tokenIndex421 } - l489: - goto l487 - l486: - position, tokenIndex = position486, tokenIndex486 + l422: + goto l420 + l419: + position, tokenIndex = position419, tokenIndex419 } - l487: - goto l481 - l482: - position, tokenIndex = position481, tokenIndex481 + l420: + goto l414 + l415: + position, tokenIndex = position414, tokenIndex414 { - position490, tokenIndex490 := position, tokenIndex + position423, tokenIndex423 := position, tokenIndex if buffer[position] != rune('-') { - goto l490 + goto l423 } position++ - goto l491 - l490: - position, tokenIndex = position490, tokenIndex490 + goto l424 + l423: + position, tokenIndex = position423, tokenIndex423 } - l491: + l424: if buffer[position] != rune('.') { - goto l479 + goto l412 } position++ if !_rules[ruledigits]() { - goto l479 + goto l412 } } - l481: - add(ruledecimal, position480) + l414: + add(ruledecimal, position413) } return true - l479: - position, tokenIndex = position479, tokenIndex479 + l412: + position, tokenIndex = position412, tokenIndex412 return false }, - /* 32 tz <- <('Z' / ('-' [0-9] [0-9] ':' [0-9] [0-9]) / ('+' [0-9] [0-9] ':' [0-9] [0-9]))> */ + /* 31 tz <- <('Z' / ('-' [0-9] [0-9] ':' [0-9] [0-9]) / ('+' [0-9] [0-9] ':' [0-9] [0-9]))> */ func() bool { - position492, tokenIndex492 := position, tokenIndex + position425, tokenIndex425 := position, tokenIndex { - position493 := position + position426 := position { - position494, tokenIndex494 := position, tokenIndex + position427, tokenIndex427 := position, tokenIndex if buffer[position] != rune('Z') { - goto l495 + goto l428 } position++ - goto l494 - l495: - position, tokenIndex = position494, tokenIndex494 + goto l427 + l428: + position, tokenIndex = position427, tokenIndex427 if buffer[position] != rune('-') { - goto l496 + goto l429 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l496 + goto l429 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l496 + goto l429 } position++ if buffer[position] != rune(':') { - goto l496 + goto l429 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l496 + goto l429 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l496 + goto l429 } position++ - goto l494 - l496: - position, tokenIndex = position494, tokenIndex494 + goto l427 + l429: + position, tokenIndex = position427, tokenIndex427 if buffer[position] != rune('+') { - goto l492 + goto l425 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l492 + goto l425 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l492 + goto l425 } position++ if buffer[position] != rune(':') { - goto l492 + goto l425 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l492 + goto l425 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l492 + goto l425 } position++ } - l494: - add(ruletz, position493) + l427: + add(ruletz, position426) } return true - l492: - position, tokenIndex = position492, tokenIndex492 + l425: + position, tokenIndex = position425, tokenIndex425 return false }, - /* 33 iso8601 <- <([0-9] [0-9] [0-9] [0-9] '-' ('0' / '1') [0-9] '-' [0-3] [0-9] 'T' [0-9] [0-9] ':' [0-9] [0-9] ':' [0-9] [0-9] )> */ + /* 32 iso8601 <- <([0-9] [0-9] [0-9] [0-9] '-' ('0' / '1') [0-9] '-' [0-3] [0-9] 'T' [0-9] [0-9] ':' [0-9] [0-9] ':' [0-9] [0-9] )> */ nil, - /* 34 iso8601nano <- <([0-9] [0-9] [0-9] [0-9] '-' ('0' / '1') [0-9] '-' [0-3] [0-9] 'T' [0-9] [0-9] ':' [0-9] [0-9] ':' [0-9] [0-9] '.' [0-9]+ )> */ + /* 33 iso8601nano <- <([0-9] [0-9] [0-9] [0-9] '-' ('0' / '1') [0-9] '-' [0-3] [0-9] 'T' [0-9] [0-9] ':' [0-9] [0-9] ':' [0-9] [0-9] '.' [0-9]+ )> */ nil, - /* 35 timestampbasicfmt <- <(iso8601nano / iso8601)> */ + /* 34 timestampbasicfmt <- <(iso8601nano / iso8601)> */ func() bool { - position499, tokenIndex499 := position, tokenIndex + position432, tokenIndex432 := position, tokenIndex { - position500 := position + position433 := position { - position501, tokenIndex501 := position, tokenIndex + position434, tokenIndex434 := position, tokenIndex { - position503 := position + position436 := position if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l502 + goto l435 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l502 + goto l435 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l502 + goto l435 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l502 + goto l435 } position++ if buffer[position] != rune('-') { - goto l502 + goto l435 } position++ { - position504, tokenIndex504 := position, tokenIndex + position437, tokenIndex437 := position, tokenIndex if buffer[position] != rune('0') { - goto l505 + goto l438 } position++ - goto l504 - l505: - position, tokenIndex = position504, tokenIndex504 + goto l437 + l438: + position, tokenIndex = position437, tokenIndex437 if buffer[position] != rune('1') { - goto l502 + goto l435 } position++ } - l504: + l437: if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l502 + goto l435 } position++ if buffer[position] != rune('-') { - goto l502 + goto l435 } position++ if c := buffer[position]; c < rune('0') || c > rune('3') { - goto l502 + goto l435 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l502 + goto l435 } position++ if buffer[position] != rune('T') { - goto l502 + goto l435 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l502 + goto l435 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l502 + goto l435 } position++ if buffer[position] != rune(':') { - goto l502 + goto l435 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l502 + goto l435 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l502 + goto l435 } position++ if buffer[position] != rune(':') { - goto l502 + goto l435 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l502 + goto l435 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l502 + goto l435 } position++ if buffer[position] != rune('.') { - goto l502 + goto l435 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l502 + goto l435 } position++ - l506: + l439: { - position507, tokenIndex507 := position, tokenIndex + position440, tokenIndex440 := position, tokenIndex if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l507 + goto l440 } position++ - goto l506 - l507: - position, tokenIndex = position507, tokenIndex507 + goto l439 + l440: + position, tokenIndex = position440, tokenIndex440 } { - position508 := position + position441 := position if !_rules[ruletz]() { - goto l502 + goto l435 } - add(rulePegText, position508) + add(rulePegText, position441) } - add(ruleiso8601nano, position503) + add(ruleiso8601nano, position436) } - goto l501 - l502: - position, tokenIndex = position501, tokenIndex501 + goto l434 + l435: + position, tokenIndex = position434, tokenIndex434 { - position509 := position + position442 := position if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l499 + goto l432 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l499 + goto l432 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l499 + goto l432 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l499 + goto l432 } position++ if buffer[position] != rune('-') { - goto l499 + goto l432 } position++ { - position510, tokenIndex510 := position, tokenIndex + position443, tokenIndex443 := position, tokenIndex if buffer[position] != rune('0') { - goto l511 + goto l444 } position++ - goto l510 - l511: - position, tokenIndex = position510, tokenIndex510 + goto l443 + l444: + position, tokenIndex = position443, tokenIndex443 if buffer[position] != rune('1') { - goto l499 + goto l432 } position++ } - l510: + l443: if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l499 + goto l432 } position++ if buffer[position] != rune('-') { - goto l499 + goto l432 } position++ if c := buffer[position]; c < rune('0') || c > rune('3') { - goto l499 + goto l432 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l499 + goto l432 } position++ if buffer[position] != rune('T') { - goto l499 + goto l432 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l499 + goto l432 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l499 + goto l432 } position++ if buffer[position] != rune(':') { - goto l499 + goto l432 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l499 + goto l432 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l499 + goto l432 } position++ if buffer[position] != rune(':') { - goto l499 + goto l432 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l499 + goto l432 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l499 + goto l432 } position++ { - position512 := position + position445 := position if !_rules[ruletz]() { - goto l499 + goto l432 } - add(rulePegText, position512) + add(rulePegText, position445) } - add(ruleiso8601, position509) + add(ruleiso8601, position442) } } - l501: - add(ruletimestampbasicfmt, position500) + l434: + add(ruletimestampbasicfmt, position433) } return true - l499: - position, tokenIndex = position499, tokenIndex499 + l432: + position, tokenIndex = position432, tokenIndex432 return false }, - /* 36 timestampfmt <- <(('"' '"') / ('\'' '\'') / )> */ + /* 35 timestampfmt <- <(('"' '"') / ('\'' '\'') / )> */ nil, - /* 37 timebasicfmt <- <([0-9] [0-9] [0-9] [0-9] '-' ('0' / '1') [0-9] '-' [0-3] [0-9] 'T' [0-9] [0-9] ':' [0-9] [0-9])> */ + /* 36 timebasicfmt <- <([0-9] [0-9] [0-9] [0-9] '-' ('0' / '1') [0-9] '-' [0-3] [0-9] 'T' [0-9] [0-9] ':' [0-9] [0-9])> */ func() bool { - position514, tokenIndex514 := position, tokenIndex + position447, tokenIndex447 := position, tokenIndex { - position515 := position + position448 := position if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l514 + goto l447 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l514 + goto l447 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l514 + goto l447 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l514 + goto l447 } position++ if buffer[position] != rune('-') { - goto l514 + goto l447 } position++ { - position516, tokenIndex516 := position, tokenIndex + position449, tokenIndex449 := position, tokenIndex if buffer[position] != rune('0') { - goto l517 + goto l450 } position++ - goto l516 - l517: - position, tokenIndex = position516, tokenIndex516 + goto l449 + l450: + position, tokenIndex = position449, tokenIndex449 if buffer[position] != rune('1') { - goto l514 + goto l447 } position++ } - l516: + l449: if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l514 + goto l447 } position++ if buffer[position] != rune('-') { - goto l514 + goto l447 } position++ if c := buffer[position]; c < rune('0') || c > rune('3') { - goto l514 + goto l447 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l514 + goto l447 } position++ if buffer[position] != rune('T') { - goto l514 + goto l447 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l514 + goto l447 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l514 + goto l447 } position++ if buffer[position] != rune(':') { - goto l514 + goto l447 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l514 + goto l447 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l514 + goto l447 } position++ - add(ruletimebasicfmt, position515) + add(ruletimebasicfmt, position448) } return true - l514: - position, tokenIndex = position514, tokenIndex514 + l447: + position, tokenIndex = position447, tokenIndex447 return false }, - /* 38 timefmt <- <(('"' '"') / ('\'' '\'') / )> */ + /* 37 timefmt <- <(('"' '"') / ('\'' '\'') / )> */ func() bool { - position518, tokenIndex518 := position, tokenIndex + position451, tokenIndex451 := position, tokenIndex { - position519 := position + position452 := position { - position520, tokenIndex520 := position, tokenIndex + position453, tokenIndex453 := position, tokenIndex if buffer[position] != rune('"') { - goto l521 + goto l454 } position++ { - position522 := position + position455 := position if !_rules[ruletimebasicfmt]() { - goto l521 + goto l454 } - add(rulePegText, position522) + add(rulePegText, position455) } if buffer[position] != rune('"') { - goto l521 + goto l454 } position++ - goto l520 - l521: - position, tokenIndex = position520, tokenIndex520 + goto l453 + l454: + position, tokenIndex = position453, tokenIndex453 if buffer[position] != rune('\'') { - goto l523 + goto l456 } position++ { - position524 := position + position457 := position if !_rules[ruletimebasicfmt]() { - goto l523 + goto l456 } - add(rulePegText, position524) + add(rulePegText, position457) } if buffer[position] != rune('\'') { - goto l523 + goto l456 } position++ - goto l520 - l523: - position, tokenIndex = position520, tokenIndex520 + goto l453 + l456: + position, tokenIndex = position453, tokenIndex453 { - position525 := position + position458 := position if !_rules[ruletimebasicfmt]() { - goto l518 + goto l451 } - add(rulePegText, position525) + add(rulePegText, position458) } } - l520: - add(ruletimefmt, position519) + l453: + add(ruletimefmt, position452) } return true - l518: - position, tokenIndex = position518, tokenIndex518 + l451: + position, tokenIndex = position451, tokenIndex451 return false }, - /* 39 time <- <( Action67)> */ + /* 38 time <- <( Action60)> */ nil, - /* 41 Action0 <- <{p.startCall("Set")}> */ + /* 40 Action0 <- <{p.startCall("Set")}> */ nil, - /* 42 Action1 <- <{p.endCall()}> */ + /* 41 Action1 <- <{p.endCall()}> */ nil, - /* 43 Action2 <- <{p.startCall("SetRowAttrs")}> */ + /* 42 Action2 <- <{p.startCall("Clear")}> */ nil, - /* 44 Action3 <- <{p.endCall()}> */ + /* 43 Action3 <- <{p.endCall()}> */ nil, - /* 45 Action4 <- <{p.startCall("SetColumnAttrs")}> */ + /* 44 Action4 <- <{p.startCall("ClearRow")}> */ nil, - /* 46 Action5 <- <{p.endCall()}> */ + /* 45 Action5 <- <{p.endCall()}> */ nil, - /* 47 Action6 <- <{p.startCall("Clear")}> */ + /* 46 Action6 <- <{p.startCall("Store")}> */ nil, - /* 48 Action7 <- <{p.endCall()}> */ + /* 47 Action7 <- <{p.endCall()}> */ nil, - /* 49 Action8 <- <{p.startCall("ClearRow")}> */ + /* 48 Action8 <- <{p.startCall("TopN")}> */ nil, - /* 50 Action9 <- <{p.endCall()}> */ + /* 49 Action9 <- <{p.endCall()}> */ nil, - /* 51 Action10 <- <{p.startCall("Store")}> */ + /* 50 Action10 <- <{p.startCall("TopK")}> */ nil, - /* 52 Action11 <- <{p.endCall()}> */ + /* 51 Action11 <- <{p.endCall()}> */ nil, - /* 53 Action12 <- <{p.startCall("TopN")}> */ + /* 52 Action12 <- <{p.startCall("Percentile")}> */ nil, - /* 54 Action13 <- <{p.endCall()}> */ + /* 53 Action13 <- <{p.endCall()}> */ nil, - /* 55 Action14 <- <{p.startCall("TopK")}> */ + /* 54 Action14 <- <{p.startCall("Rows")}> */ nil, - /* 56 Action15 <- <{p.endCall()}> */ + /* 55 Action15 <- <{p.endCall()}> */ nil, - /* 57 Action16 <- <{p.startCall("Percentile")}> */ + /* 56 Action16 <- <{p.startCall("Min")}> */ nil, - /* 58 Action17 <- <{p.endCall()}> */ + /* 57 Action17 <- <{p.endCall()}> */ nil, - /* 59 Action18 <- <{p.startCall("Rows")}> */ + /* 58 Action18 <- <{p.startCall("Max")}> */ nil, - /* 60 Action19 <- <{p.endCall()}> */ + /* 59 Action19 <- <{p.endCall()}> */ nil, - /* 61 Action20 <- <{p.startCall("Min")}> */ + /* 60 Action20 <- <{p.startCall("Sum")}> */ nil, - /* 62 Action21 <- <{p.endCall()}> */ + /* 61 Action21 <- <{p.endCall()}> */ nil, - /* 63 Action22 <- <{p.startCall("Max")}> */ + /* 62 Action22 <- <{p.startCall("Range")}> */ nil, - /* 64 Action23 <- <{p.endCall()}> */ + /* 63 Action23 <- <{p.addField("from")}> */ nil, - /* 65 Action24 <- <{p.startCall("Sum")}> */ + /* 64 Action24 <- <{p.addVal(text)}> */ nil, - /* 66 Action25 <- <{p.endCall()}> */ + /* 65 Action25 <- <{p.addField("to")}> */ nil, - /* 67 Action26 <- <{p.startCall("Range")}> */ + /* 66 Action26 <- <{p.addVal(text)}> */ nil, - /* 68 Action27 <- <{p.addField("from")}> */ + /* 67 Action27 <- <{p.endCall()}> */ nil, - /* 69 Action28 <- <{p.addVal(text)}> */ nil, - /* 70 Action29 <- <{p.addField("to")}> */ + /* 69 Action28 <- <{ p.startCall(text) }> */ nil, - /* 71 Action30 <- <{p.addVal(text)}> */ + /* 70 Action29 <- <{ p.endCall() }> */ nil, - /* 72 Action31 <- <{p.endCall()}> */ + /* 71 Action30 <- <{ p.addBTWN() }> */ nil, + /* 72 Action31 <- <{ p.addLTE() }> */ nil, - /* 74 Action32 <- <{ p.startCall(text) }> */ + /* 73 Action32 <- <{ p.addGTE() }> */ nil, - /* 75 Action33 <- <{ p.endCall() }> */ + /* 74 Action33 <- <{ p.addEQ() }> */ nil, - /* 76 Action34 <- <{ p.addBTWN() }> */ + /* 75 Action34 <- <{ p.addNEQ() }> */ nil, - /* 77 Action35 <- <{ p.addLTE() }> */ + /* 76 Action35 <- <{ p.addLT() }> */ nil, - /* 78 Action36 <- <{ p.addGTE() }> */ + /* 77 Action36 <- <{ p.addGT() }> */ nil, - /* 79 Action37 <- <{ p.addEQ() }> */ + /* 78 Action37 <- <{p.startConditional()}> */ nil, - /* 80 Action38 <- <{ p.addNEQ() }> */ + /* 79 Action38 <- <{p.endConditional()}> */ nil, - /* 81 Action39 <- <{ p.addLT() }> */ + /* 80 Action39 <- <{p.condAdd(text)}> */ nil, - /* 82 Action40 <- <{ p.addGT() }> */ + /* 81 Action40 <- <{p.condAdd(text)}> */ nil, - /* 83 Action41 <- <{p.startConditional()}> */ + /* 82 Action41 <- <{p.condAdd(text)}> */ nil, - /* 84 Action42 <- <{p.endConditional()}> */ + /* 83 Action42 <- <{ p.startList() }> */ nil, - /* 85 Action43 <- <{p.condAdd(text)}> */ + /* 84 Action43 <- <{ p.endList() }> */ nil, - /* 86 Action44 <- <{p.condAdd(text)}> */ + /* 85 Action44 <- <{ p.addVal(nil) }> */ nil, - /* 87 Action45 <- <{p.condAdd(text)}> */ + /* 86 Action45 <- <{ p.addVal(true) }> */ nil, - /* 88 Action46 <- <{ p.startList() }> */ + /* 87 Action46 <- <{ p.addVal(false) }> */ nil, - /* 89 Action47 <- <{ p.endList() }> */ + /* 88 Action47 <- <{ p.addVal(text) }> */ nil, - /* 90 Action48 <- <{ p.addVal(nil) }> */ + /* 89 Action48 <- <{ p.addTimestampVal(text) }> */ nil, - /* 91 Action49 <- <{ p.addVal(true) }> */ + /* 90 Action49 <- <{ p.addNumVal(text) }> */ nil, - /* 92 Action50 <- <{ p.addVal(false) }> */ + /* 91 Action50 <- <{ p.startCall(text) }> */ nil, - /* 93 Action51 <- <{ p.addVal(text) }> */ + /* 92 Action51 <- <{ p.addVal(p.endCall()) }> */ nil, - /* 94 Action52 <- <{ p.addTimestampVal(text) }> */ + /* 93 Action52 <- <{ p.addVal(text) }> */ nil, - /* 95 Action53 <- <{ p.addNumVal(text) }> */ + /* 94 Action53 <- <{ p.addVal(text) }> */ nil, - /* 96 Action54 <- <{ p.startCall(text) }> */ + /* 95 Action54 <- <{ p.addVal(text) }> */ nil, - /* 97 Action55 <- <{ p.addVal(p.endCall()) }> */ + /* 96 Action55 <- <{ p.addField(text) }> */ nil, - /* 98 Action56 <- <{ p.addVal(text) }> */ + /* 97 Action56 <- <{ p.addPosStr("_field", text) }> */ nil, - /* 99 Action57 <- <{ p.addVal(text) }> */ + /* 98 Action57 <- <{p.addPosNum("_col", text)}> */ nil, - /* 100 Action58 <- <{ p.addVal(text) }> */ + /* 99 Action58 <- <{p.addPosStr("_col", text)}> */ nil, - /* 101 Action59 <- <{ p.addField(text) }> */ + /* 100 Action59 <- <{p.addPosStr("_col", text)}> */ nil, - /* 102 Action60 <- <{ p.addPosStr("_field", text) }> */ - nil, - /* 103 Action61 <- <{p.addPosNum("_col", text)}> */ - nil, - /* 104 Action62 <- <{p.addPosStr("_col", text)}> */ - nil, - /* 105 Action63 <- <{p.addPosStr("_col", text)}> */ - nil, - /* 106 Action64 <- <{p.addPosNum("_row", text)}> */ - nil, - /* 107 Action65 <- <{p.addPosStr("_row", text)}> */ - nil, - /* 108 Action66 <- <{p.addPosStr("_row", text)}> */ - nil, - /* 109 Action67 <- <{p.addPosStr("_timestamp", text)}> */ + /* 101 Action60 <- <{p.addPosStr("_timestamp", text)}> */ nil, } p.rules = _rules diff --git a/pql/pqlpeg_test.go b/pql/pqlpeg_test.go index 037d6ee42..ebe878a73 100644 --- a/pql/pqlpeg_test.go +++ b/pql/pqlpeg_test.go @@ -36,16 +36,6 @@ SetBit(Union(Zitmap(row==4), Intersect(Qitmap(blah>4), Ritmap(field="http://zoo9 } p.Execute() - p = PQL{Buffer: `SetRowAttrs(attr="http://zoo9.com=\\'hello' "and \"hello\"")`} - err = p.Init() - if err != nil { - t.Fatal(errors.Wrap(err, "creating parser")) - } - err = p.Parse() - if err == nil { - t.Fatalf("should have been an error because of the interior unescaped double quote") - } - q, err := ParseString("TopN(blah, Bitmap(id==other), field=f, n=0)") if err != nil { t.Fatalf("should have parsed: %v", err) @@ -190,38 +180,6 @@ func TestPEGWorking(t *testing.T) { name: "single quoted args", input: `Row(a='zm""e')`, ncalls: 1}, - { - name: "SetRowAttrs", - input: "SetRowAttrs(blah, 9, a=47)", - ncalls: 1}, - { - name: "SetRowAttrs2args", - input: "SetRowAttrs(blah, 9, a=47, b=bval)", - ncalls: 1}, - { - name: "SetRowAttrsWithRowKeySingleQuote", - input: "SetRowAttrs(blah, 'rowKey', a=47)", - ncalls: 1}, - { - name: "SetRowAttrsWithRowKeyDoubleQuote", - input: `SetRowAttrs(blah, "rowKey", a=47)`, - ncalls: 1}, - { - name: "SetColumnAttrs", - input: "SetColumnAttrs(9, a=47)", - ncalls: 1}, - { - name: "SetColumnAttrs2args", - input: "SetColumnAttrs(9, a=47, b=bval)", - ncalls: 1}, - { - name: "SetColumnAttrsWithColKeySingleQuote", - input: "SetColumnAttrs('colKey', a=47)", - ncalls: 1}, - { - name: "SetColumnAttrsWithColKeyDoubleQuote", - input: `SetColumnAttrs("colKey", a=47)`, - ncalls: 1}, { name: "Clear", input: "Clear(1, a=53)", @@ -352,9 +310,6 @@ func TestPEGErrors(t *testing.T) { { name: "StartinCommaArb", input: "Row(, a=4)"}, - { - name: "SetRowAttrs0args", - input: "SetRowAttrs(blah, 9)"}, { name: "Clear0args", input: "Clear(9)"}, @@ -485,91 +440,6 @@ func TestPQLDeepEquality(t *testing.T) { "_field": "myfield", }, }}, - { - name: "SetRowAttrs", - call: "SetRowAttrs(myfield, 9, z=4)", - exp: &Call{ - Name: "SetRowAttrs", - Args: map[string]interface{}{ - "z": int64(4), - "_field": "myfield", - "_row": int64(9), - }, - }}, - { - name: "SetRowAttrsWithField=", - call: "SetRowAttrs(field=myfield, 9, z=4)", - exp: &Call{ - Name: "SetRowAttrs", - Args: map[string]interface{}{ - "z": int64(4), - "_field": "myfield", - "_row": int64(9), - }, - }}, - { - name: "SetRowAttrsWithRowKeySingleQuote", - call: "SetRowAttrs(myfield, 'rowKey', z=4)", - exp: &Call{ - Name: "SetRowAttrs", - Args: map[string]interface{}{ - "z": int64(4), - "_field": "myfield", - "_row": "rowKey", - }, - }}, - { - name: "SetRowAttrsWithRowKeyDoubleQuote", - call: `SetRowAttrs(myfield, "rowKey", z=4)`, - exp: &Call{ - Name: "SetRowAttrs", - Args: map[string]interface{}{ - "z": int64(4), - "_field": "myfield", - "_row": "rowKey", - }, - }}, - { - name: "SetRowAttrsWithUnicodeValues", - call: `SetRowAttrs(myfield, "∫", z="∀", a="∑")`, - exp: &Call{ - Name: "SetRowAttrs", - Args: map[string]interface{}{ - "z": "∀", - "a": "∑", - "_field": "myfield", - "_row": "∫", - }, - }}, { - name: "SetColumnAttrs", - call: "SetColumnAttrs(9, z=4)", - exp: &Call{ - Name: "SetColumnAttrs", - Args: map[string]interface{}{ - "z": int64(4), - "_col": int64(9), - }, - }}, - { - name: "SetColumnAttrsWithColKeySingleQuote", - call: "SetColumnAttrs('colKey', z=4)", - exp: &Call{ - Name: "SetColumnAttrs", - Args: map[string]interface{}{ - "z": int64(4), - "_col": "colKey", - }, - }}, - { - name: "SetColumnAttrsWithColKeyDoubleQuote", - call: `SetColumnAttrs("colKey", z=4)`, - exp: &Call{ - Name: "SetColumnAttrs", - Args: map[string]interface{}{ - "z": int64(4), - "_col": "colKey", - }, - }}, { name: "Clear", call: "Clear(1, a=7)", @@ -839,11 +709,15 @@ func TestPQLDeepEquality(t *testing.T) { }}, { name: "OptionsWrapper", - call: "Options(Row(f1=123), excludeRowAttrs=true)", + call: "Options(Row(f1=123), shards=[1,2,3])", exp: &Call{ Name: "Options", Args: map[string]interface{}{ - "excludeRowAttrs": true, + "shards": []interface{}{ + int64(1), + int64(2), + int64(3), + }, }, Children: []*Call{ { diff --git a/row.go b/row.go index 5e946d09a..246bbb4ae 100644 --- a/row.go +++ b/row.go @@ -23,17 +23,13 @@ import ( "github.com/pkg/errors" ) -// Row is a set of integers (the associated columns), and attributes which are -// arbitrary key/value pairs storing metadata about what the row represents. +// Row is a set of integers (the associated columns). type Row struct { segments []rowSegment // String keys translated to/from segment columns. Keys []string - // Attributes associated with the row. - Attrs map[string]interface{} - // Index tells what index this row is from - needed for key translation. Index string @@ -67,13 +63,8 @@ func (r *Row) Clone() (clone *Row) { copy(keyClone, r.Keys) } - attrClone := make(map[string]interface{}) - for k, v := range r.Attrs { - attrClone[k] = v - } clone = &Row{ Keys: keyClone, - Attrs: attrClone, Index: r.Index, Field: r.Field, } @@ -474,18 +465,12 @@ func (r *Row) Count() uint64 { // MarshalJSON returns a JSON-encoded byte slice of r. func (r *Row) MarshalJSON() ([]byte, error) { var o struct { - Attrs map[string]interface{} `json:"attrs"` - Columns []uint64 `json:"columns"` - Keys []string `json:"keys,omitempty"` + Columns []uint64 `json:"columns"` + Keys []string `json:"keys,omitempty"` } o.Columns = r.Columns() o.Keys = r.Keys - o.Attrs = r.Attrs - if o.Attrs == nil { - o.Attrs = make(map[string]interface{}) - } - return json.Marshal(&o) } diff --git a/server.go b/server.go index 6a7f8ad4b..e940b092c 100644 --- a/server.go +++ b/server.go @@ -141,16 +141,6 @@ func OptServerDataDir(dir string) ServerOption { } } -// OptServerAttrStoreFunc is a functional option on Server -// used to provide the function to use to generate a new -// attribute store. -func OptServerAttrStoreFunc(af func(string) AttrStore) ServerOption { - return func(s *Server) error { - s.holderConfig.NewAttrStore = af - return nil - } -} - // OptServerAntiEntropyInterval is a functional option on Server // used to set the anti-entropy interval. func OptServerAntiEntropyInterval(interval time.Duration) ServerOption { diff --git a/server/cluster_test.go b/server/cluster_test.go index 16ae4f7a5..56895baa0 100644 --- a/server/cluster_test.go +++ b/server/cluster_test.go @@ -234,7 +234,7 @@ func TestClusterResize_AddNode(t *testing.T) { t.Fatal(err) } // exp is the expected result for the Row queries that follow. - exp := fmt.Sprintf(`{"results":[{"attrs":{},"columns":[1,%d]}]}`, col) + exp := fmt.Sprintf(`{"results":[{"columns":[1,%d]}]}`, col) // Verify the data exists on the single node. m0.QueryExpect(t, "i", "", `Row(f=1)`, exp) @@ -277,7 +277,7 @@ func TestClusterResize_AddNode(t *testing.T) { t.Fatal(err) } // exp is the expected result for the Row queries that follow. - exp := `{"results":[{"attrs":{},"columns":[1]}]}` + exp := `{"results":[{"columns":[1]}]}` // Verify the data exists on the single node. m0.QueryExpect(t, "i", "", `Row(f=1)`, exp) @@ -324,7 +324,7 @@ func TestClusterResize_AddNode(t *testing.T) { } // exp is the expected result for the Row queries that follow. - exp := fmt.Sprintf(`{"results":[{"attrs":{},"columns":[1,%d]}]}`, col) + exp := fmt.Sprintf(`{"results":[{"columns":[1,%d]}]}`, col) // Verify the data exists on the single node. m0.QueryExpect(t, "i", "", `Row(f=1)`, exp) @@ -411,7 +411,7 @@ func TestClusterResize_AddNodeConcurrentIndex(t *testing.T) { } // exp is the expected result for the Row queries that follow. - exp := fmt.Sprintf(`{"results":[{"attrs":{},"columns":[1,%d]}]}`, col) + exp := fmt.Sprintf(`{"results":[{"columns":[1,%d]}]}`, col) // Verify the data exists on the single node. m0.QueryExpect(t, "i", "", `Row(f=1)`, exp) @@ -457,7 +457,7 @@ func TestClusterResize_AddNodeConcurrentIndex(t *testing.T) { } // exp is the expected result for the Row queries that follow. - exp := fmt.Sprintf(`{"results":[{"attrs":{},"columns":[1,%d]}]}`, col) + exp := fmt.Sprintf(`{"results":[{"columns":[1,%d]}]}`, col) // Verify the data exists on the single node. m0.QueryExpect(t, "i", "", `Row(f=1)`, exp) @@ -501,7 +501,7 @@ func TestClusterResize_AddNodeConcurrentIndex(t *testing.T) { } // exp is the expected result for the Row queries that follow. - exp := `{"results":[{"attrs":{},"columns":[],"keys":["col2","col1"]}]}` + exp := `{"results":[{"columns":[],"keys":["col2","col1"]}]}` // Verify the data exists on the single node. m0.QueryExpect(t, "i", "", `Row(f=1)`, exp) diff --git a/server/config.go b/server/config.go index 074dbdc07..f59040271 100644 --- a/server/config.go +++ b/server/config.go @@ -83,8 +83,7 @@ type Config struct { AdvertiseGRPC string `toml:"advertise-grpc"` // MaxWritesPerRequest limits the number of mutating commands that can be in - // a single request to the server. This includes Set, Clear, - // SetRowAttrs & SetColumnAttrs. + // a single request to the server. This includes Set, Clear, ClearRow, Store, and SetBit. MaxWritesPerRequest int `toml:"max-writes-per-request"` // LogPath configures where Pilosa will write logs. diff --git a/server/grpc.go b/server/grpc.go index d91409b7a..be949b67d 100644 --- a/server/grpc.go +++ b/server/grpc.go @@ -215,7 +215,6 @@ func (h *GRPCHandler) QueryPQL(req *pb.QueryPQLRequest, stream pb.Pilosa_QueryPQ resp, err := h.api.Query(stream.Context(), &query) durQuery := time.Since(t) - // TODO: what about resp.CollumnAttrSets? if err != nil { return errToStatusError(err) } else if len(resp.Results) != 1 { diff --git a/server/handler_test.go b/server/handler_test.go index 7cb957936..f49b61624 100644 --- a/server/handler_test.go +++ b/server/handler_test.go @@ -687,31 +687,11 @@ func TestHandler_Endpoints(t *testing.T) { h.ServeHTTP(w, test.MustNewHTTPRequest("POST", "/index/i0/query", strings.NewReader("Row(f0=30)"))) if w.Code != gohttp.StatusOK { t.Fatalf("unexpected status code: %d", w.Code) - } else if body := w.Body.String(); body != fmt.Sprintf(`{"results":[{"attrs":{},"columns":[%d,%d,%d]}]}`, pilosa.ShardWidth+1, pilosa.ShardWidth+2, 3*pilosa.ShardWidth+4)+"\n" { + } else if body := w.Body.String(); body != fmt.Sprintf(`{"results":[{"columns":[%d,%d,%d]}]}`, pilosa.ShardWidth+1, pilosa.ShardWidth+2, 3*pilosa.ShardWidth+4)+"\n" { t.Fatalf("unexpected body: %s", body) } }) - f0 := i0.Field("f0") - if err := i0.ColumnAttrStore().SetAttrs((1*pilosa.ShardWidth)+1, map[string]interface{}{"x": "y"}); err != nil { - t.Fatal(err) - } else if err := i0.ColumnAttrStore().SetAttrs((1*pilosa.ShardWidth)+2, map[string]interface{}{"y": 123, "z": false}); err != nil { - t.Fatal(err) - } else if err := f0.RowAttrStore().SetAttrs(30, map[string]interface{}{"a": "b", "c": 1, "d": true}); err != nil { - t.Fatal(err) - } - - t.Run("ColumnAttrs_JSON", func(t *testing.T) { - w := httptest.NewRecorder() - h.ServeHTTP(w, test.MustNewHTTPRequest("POST", "/index/i0/query?columnAttrs=true", strings.NewReader("Row(f0=30)"))) - exp := fmt.Sprintf(`{"results":[{"attrs":{"a":"b","c":1,"d":true},"columns":[%[1]d,%[2]d,%[3]d]}],"columnAttrs":[{"id":%[1]d,"attrs":{"x":"y"}},{"id":%[2]d,"attrs":{"y":123,"z":false}}]}`, pilosa.ShardWidth+1, pilosa.ShardWidth+2, 3*pilosa.ShardWidth+4) + "\n" - if w.Code != gohttp.StatusOK { - t.Fatalf("unexpected status code: %d. body: %s", w.Code, w.Body.String()) - } else if body := w.Body.String(); body != exp { - t.Fatalf("unexpected body: \n%s\ngot:\n%s", body, exp) - } - }) - t.Run("Row pbuf", func(t *testing.T) { w := httptest.NewRecorder() r := test.MustNewHTTPRequest("POST", "/index/i0/query", strings.NewReader("Row(f0=30)")) @@ -726,62 +706,6 @@ func TestHandler_Endpoints(t *testing.T) { t.Fatal(err) } else if columns := resp.Results[0].(*pilosa.Row).Columns(); !reflect.DeepEqual(columns, []uint64{pilosa.ShardWidth + 1, pilosa.ShardWidth + 2, (3 * pilosa.ShardWidth) + 4}) { t.Fatalf("unexpected columns: %+v", columns) - } else if attrs := resp.Results[0].(*pilosa.Row).Attrs; len(attrs) != 3 { - t.Fatalf("unexpected attr length: %d", len(attrs)) - } else if attrs["a"] != "b" { - t.Fatalf("unexpected attr[a]: %v", attrs["a"]) - } else if attrs["c"] != int64(1) { - t.Fatalf("unexpected attr[c]: %v", attrs["c"]) - } else if !attrs["d"].(bool) { - t.Fatalf("unexpected attr[d]: %v", attrs["d"]) - } - }) - - t.Run("Row columnattrs protobuf", func(t *testing.T) { - // Encode request body. - buf, err := cmd.API.Serializer.Marshal(&pilosa.QueryRequest{ - Query: "Row(f0=30)", - ColumnAttrs: true, - }) - if err != nil { - t.Fatal(err) - } - - w := httptest.NewRecorder() - r := test.MustNewHTTPRequest("POST", "/index/i0/query", bytes.NewReader(buf)) - r.Header.Set("Content-Type", "application/x-protobuf") - r.Header.Set("Accept", "application/x-protobuf") - h.ServeHTTP(w, r) - if w.Code != gohttp.StatusOK { - t.Fatalf("unexpected status code: %d", w.Code) - } - - var resp pilosa.QueryResponse - if err := cmd.API.Serializer.Unmarshal(w.Body.Bytes(), &resp); err != nil { - t.Fatal(err) - } - if columns := resp.Results[0].(*pilosa.Row).Columns(); !reflect.DeepEqual(columns, []uint64{pilosa.ShardWidth + 1, pilosa.ShardWidth + 2, (3 * pilosa.ShardWidth) + 4}) { - t.Fatalf("unexpected columns: %+v", columns) - } else if _, ok := resp.Results[0].(*pilosa.Row); !ok { - t.Fatalf("unexpected response type: %#v", resp.Results[0]) - } else if attrs := resp.Results[0].(*pilosa.Row).Attrs; len(attrs) != 3 { - t.Fatalf("unexpected attr length: %d", len(attrs)) - } else if attrs["a"] != "b" { - t.Fatalf("unexpected attr[a]: %v", attrs["a"]) - } else if attrs["c"] != int64(1) { - t.Fatalf("unexpected attr[c]: %v", attrs["c"]) - } else if !attrs["d"].(bool) { - t.Fatalf("unexpected attr[d]: %v", attrs["d"]) - } - - if a := resp.ColumnAttrSets; len(a) != 2 { - t.Fatalf("unexpected column attributes length: %d", len(a)) - } else if a[0].ID != pilosa.ShardWidth+1 { - t.Fatalf("unexpected id: %d", a[0].ID) - } else if len(a[0].Attrs) != 1 { - t.Fatalf("unexpected column attr length: %d", len(a)) - } else if a[0].Attrs["x"] != "y" { - t.Fatalf("unexpected attr[x]: %v", a[0].Attrs["x"]) } }) @@ -1091,83 +1015,7 @@ func TestHandler_Endpoints(t *testing.T) { } }) - i := hldr.MustCreateIndexIfNotExists("i", pilosa.IndexOptions{}) - if err := i.ColumnAttrStore().SetAttrs(1, map[string]interface{}{"foo": 1, "bar": 2}); err != nil { - t.Fatal(err) - } else if err := i.ColumnAttrStore().SetAttrs(100, map[string]interface{}{"x": "y"}); err != nil { - t.Fatal(err) - } else if err := i.ColumnAttrStore().SetAttrs(200, map[string]interface{}{"snowman": "☃"}); err != nil { - t.Fatal(err) - } - - t.Run("AttrStore Diff", func(t *testing.T) { - blks, err := i.ColumnAttrStore().Blocks() - if err != nil { - t.Fatal(err) - } - - blks = blks[1:] - blks[1].Checksum = []byte("MISMATCHED_CHECKSUM") - - // Send block checksums to determine diff. - req := test.MustNewHTTPRequest( - "POST", - "/internal/index/i/attr/diff", - strings.NewReader(`{"blocks":`+string(test.MustMarshalJSON(blks))+`}`), - ) - req.Header.Set("Content-Type", "application/json") - req.Header.Set("Accept", "application/json") - w := httptest.NewRecorder() - h.ServeHTTP(w, req) - if w.Code != gohttp.StatusOK { - t.Fatalf("unexpected status code: %d, body: %s", w.Code, w.Body.String()) - } - - // Read and validate body. - if w.Body.String() != `{"attrs":{"1":{"bar":2,"foo":1},"200":{"snowman":"☃"}}}`+"\n" { - t.Fatalf("unexpected body: %s", w.Body.String()) - } - }) - - meta, err := i.CreateFieldIfNotExists("meta", pilosa.OptFieldTypeDefault()) - if err != nil { - t.Fatal(err) - } - if err := meta.RowAttrStore().SetAttrs(1, map[string]interface{}{"foo": 1, "bar": 2}); err != nil { - t.Fatal(err) - } else if err := meta.RowAttrStore().SetAttrs(100, map[string]interface{}{"x": "y"}); err != nil { - t.Fatal(err) - } else if err := meta.RowAttrStore().SetAttrs(200, map[string]interface{}{"snowman": "☃"}); err != nil { - t.Fatal(err) - } - - t.Run("field attrstore diff", func(t *testing.T) { - blks, err := meta.RowAttrStore().Blocks() - if err != nil { - t.Fatal(err) - } - blks = blks[1:] - blks[1].Checksum = []byte("MISMATCHED_CHECKSUM") - - // Send block checksums to determine diff. - req := test.MustNewHTTPRequest( - "POST", - "/internal/index/i/field/meta/attr/diff", - strings.NewReader(`{"blocks":`+string(test.MustMarshalJSON(blks))+`}`), - ) - req.Header.Set("Content-Type", "application/json") - req.Header.Set("Accept", "application/json") - w := httptest.NewRecorder() - h.ServeHTTP(w, req) - if w.Code != gohttp.StatusOK { - t.Fatalf("unexpected status code: %d, body: %s", w.Code, w.Body.String()) - } - - // Read and validate body. - if w.Body.String() != `{"attrs":{"1":{"bar":2,"foo":1},"200":{"snowman":"☃"}}}`+"\n" { - t.Fatalf("unexpected body: %s", w.Body.String()) - } - }) + hldr.MustCreateIndexIfNotExists("i", pilosa.IndexOptions{}) t.Run("Version", func(t *testing.T) { w := httptest.NewRecorder() diff --git a/server/server.go b/server/server.go index 63e208001..ea8de2110 100644 --- a/server/server.go +++ b/server/server.go @@ -478,7 +478,6 @@ func (m *Command) SetupServer() error { pilosa.OptServerOpenTranslateReader(http.GetOpenTranslateReaderWithLockerFunc(c, &sync.Mutex{})), pilosa.OptServerOpenIDAllocator(pilosa.OpenIDAllocator), pilosa.OptServerLogger(m.logger), - pilosa.OptServerAttrStoreFunc(boltdb.NewAttrStore), pilosa.OptServerSystemInfo(gopsutil.NewSystemInfo()), pilosa.OptServerGCNotifier(gcnotify.NewActiveGCNotifier()), pilosa.OptServerStatsClient(statsClient), diff --git a/server/server_test.go b/server/server_test.go index 771735f8b..ca1d6dd21 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -91,7 +91,6 @@ func TestMain_Set_Quick(t *testing.T) { "results": []interface{}{ map[string]interface{}{ "columns": columnIDs, - "attrs": map[string]interface{}{}, }, }, }) + "\n" @@ -118,7 +117,6 @@ func TestMain_Set_Quick(t *testing.T) { "results": []interface{}{ map[string]interface{}{ "columns": columnIDs, - "attrs": map[string]interface{}{}, }, }, }) + "\n" @@ -133,135 +131,6 @@ func TestMain_Set_Quick(t *testing.T) { } } -// Ensure program can set row attributes and retrieve them. -func TestMain_SetRowAttrs(t *testing.T) { - m := test.RunCommand(t) - defer m.Close() - - // Create fields. - client := m.Client() - if err := client.CreateIndex(context.Background(), "i", pilosa.IndexOptions{}); err != nil && err != pilosa.ErrIndexExists { - t.Fatal(err) - } else if err := client.CreateField(context.Background(), "i", "x"); err != nil { - t.Fatal(err) - } else if err := client.CreateField(context.Background(), "i", "z"); err != nil { - t.Fatal(err) - } else if err := client.CreateField(context.Background(), "i", "neg"); err != nil { - t.Fatal(err) - } - - // Set columns on different rows in different fields. - if _, err := m.Query(t, "i", "", `Set(100, x=1)`); err != nil { - t.Fatal(err) - } else if _, err := m.Query(t, "i", "", `Set(100, x=2)`); err != nil { - t.Fatal(err) - } else if _, err := m.Query(t, "i", "", `Set(100, x=2)`); err != nil { - t.Fatal(err) - } else if _, err := m.Query(t, "i", "", `Set(100, neg=3)`); err != nil { - t.Fatal(err) - } - - // Set row attributes. - if _, err := m.Query(t, "i", "", `SetRowAttrs(x, 1, x=100)`); err != nil { - t.Fatal(err) - } else if _, err := m.Query(t, "i", "", `SetRowAttrs(x, 2, x=-200)`); err != nil { - t.Fatal(err) - } else if _, err := m.Query(t, "i", "", `SetRowAttrs(z, 2, x=300)`); err != nil { - t.Fatal(err) - } else if _, err := m.Query(t, "i", "", `SetRowAttrs(neg, 3, x=-0.44)`); err != nil { - t.Fatal(err) - } - - // Query row x/1. - if res, err := m.Query(t, "i", "", `Row(x=1)`); err != nil { - t.Fatal(err) - } else if res != `{"results":[{"attrs":{"x":100},"columns":[100]}]}`+"\n" { - t.Fatalf("unexpected result: %s", res) - } - - // Query row x/2. - if res, err := m.Query(t, "i", "", `Row(x=2)`); err != nil { - t.Fatal(err) - } else if res != `{"results":[{"attrs":{"x":-200},"columns":[100]}]}`+"\n" { - t.Fatalf("unexpected result: %s", res) - } - - if err := m.Reopen(); err != nil { - t.Fatal(err) - } - - if err := m.AwaitState(disco.ClusterStateNormal, 10*time.Second); err != nil { - t.Fatalf("restarting cluster: %v", err) - } - - // Query rows after reopening. - if res, err := m.Query(t, "i", "columnAttrs=true", `Row(x=1)`); err != nil { - t.Fatal(err) - } else if res != `{"results":[{"attrs":{"x":100},"columns":[100]}]}`+"\n" { - t.Fatalf("unexpected result(reopen): %s", res) - } - - if res, err := m.Query(t, "i", "columnAttrs=true", `Row(neg=3)`); err != nil { - t.Fatal(err) - } else if res != `{"results":[{"attrs":{"x":-0.44},"columns":[100]}]}`+"\n" { - t.Fatalf("unexpected result(reopen): %s", res) - } - // Query row x/2. - if res, err := m.Query(t, "i", "", `Row(x=2)`); err != nil { - t.Fatal(err) - } else if res != `{"results":[{"attrs":{"x":-200},"columns":[100]}]}`+"\n" { - t.Fatalf("unexpected result: %s", res) - } -} - -// Ensure program can set column attributes and retrieve them. -func TestMain_SetColumnAttrs(t *testing.T) { - m := test.RunCommand(t) - defer m.Close() - - // Create fields. - client := m.Client() - if err := client.CreateIndex(context.Background(), "i", pilosa.IndexOptions{}); err != nil && err != pilosa.ErrIndexExists { - t.Fatal(err) - } else if err := client.CreateField(context.Background(), "i", "x"); err != nil { - t.Fatal(err) - } - - // Set columns on row. - if _, err := m.Query(t, "i", "", `Set(100, x=1)`); err != nil { - t.Fatal(err) - } else if _, err := m.Query(t, "i", "", `Set(101, x=1)`); err != nil { - t.Fatal(err) - } - - // Set column attributes. - if _, err := m.Query(t, "i", "", `SetColumnAttrs(100, foo="bar")`); err != nil { - t.Fatal(err) - } - - // Query row. - if res, err := m.Query(t, "i", "columnAttrs=true", `Row(x=1)`); err != nil { - t.Fatal(err) - } else if res != `{"results":[{"attrs":{},"columns":[100,101]}],"columnAttrs":[{"id":100,"attrs":{"foo":"bar"}}]}`+"\n" { - t.Fatalf("unexpected result: %s", res) - } - - if err := m.Reopen(); err != nil { - t.Fatal(err) - } - - if err := m.AwaitState(disco.ClusterStateNormal, 10*time.Second); err != nil { - t.Fatalf("restarting cluster: %v", err) - } - - // Query row after reopening. - if res, err := m.Query(t, "i", "columnAttrs=true", `Row(x=1)`); err != nil { - t.Fatal(err) - } else if res != `{"results":[{"attrs":{},"columns":[100,101]}],"columnAttrs":[{"id":100,"attrs":{"foo":"bar"}}]}`+"\n" { - t.Fatalf("unexpected result(reopen): %s", res) - } -} - func TestMain_GroupBy(t *testing.T) { m := test.RunCommand(t) defer m.Close() diff --git a/sql/mapper.go b/sql/mapper.go index eb6c23f0c..e9659bcd9 100644 --- a/sql/mapper.go +++ b/sql/mapper.go @@ -33,8 +33,6 @@ var ( ErrMultipleSQLStatements = errors.New("statement contains multiple sql queries") ) -type Attributes map[string]interface{} - type MappedSQL struct { SQLType string Statement sqlparser.Statement diff --git a/sql/select.go b/sql/select.go index bf4165c10..9cbc35c20 100644 --- a/sql/select.go +++ b/sql/select.go @@ -178,9 +178,7 @@ type selectFunc struct { } type selectFeatures struct { - HasRowAttrs bool - HasColAttrs bool - funcs []selectFunc + funcs []selectFunc } type HavingClause struct { diff --git a/stats/stats_test.go b/stats/stats_test.go index fd6aa9228..1fe8ce1f5 100644 --- a/stats/stats_test.go +++ b/stats/stats_test.go @@ -152,74 +152,6 @@ func TestStatsCount_Bitmap(t *testing.T) { } } -func TestStatsCount_SetRowAttrsBulk(t *testing.T) { - c := test.MustRunCluster(t, 1) - defer c.Close() - hldr := test.Holder{Holder: c.GetNode(0).Server.Holder()} - - hldr.SetBit("d", "f", 10, 0) - hldr.SetBit("d", "f", 10, 1) - - called := false - field := hldr.Field("d", "f") - if field == nil { - t.Fatal("field not found") - } - - hldr.Holder.Stats = &MockStats{ - mockCountWithTags: func(name string, value int64, rate float64, tags []string) { - if name != pilosa.MetricSetRowAttrs { - t.Errorf("Expected %v, Results %s", pilosa.MetricSetRowAttrs, name) - } - - if tags[0] != "index:d" { - t.Errorf("Expected index, Results %s", tags[0]) - } - called = true - }, - } - if _, err := c.GetNode(0).API.Query(context.Background(), &pilosa.QueryRequest{Index: "d", Query: `SetRowAttrs(f, 10, foo="bar")`}); err != nil { - t.Fatal(err) - } - if !called { - t.Error("Count isn't called") - } -} - -func TestStatsCount_SetColumnAttrs(t *testing.T) { - c := test.MustRunCluster(t, 1) - defer c.Close() - hldr := test.Holder{Holder: c.GetNode(0).Server.Holder()} - - hldr.SetBit("d", "f", 10, 0) - hldr.SetBit("d", "f", 10, 1) - - called := false - idx := hldr.Holder.Index("d") - if idx == nil { - t.Fatal("index not found") - } - - hldr.Holder.Stats = &MockStats{ - mockCountWithTags: func(name string, value int64, rate float64, tags []string) { - if name != pilosa.MetricSetColumnAttrs { - t.Errorf("Expected %v, Results %s", pilosa.MetricSetColumnAttrs, name) - } - - if tags[0] != "index:d" { - t.Errorf("Expected index, Results %s", tags[0]) - } - called = true - }, - } - if _, err := c.GetNode(0).API.Query(context.Background(), &pilosa.QueryRequest{Index: "d", Query: `SetColumnAttrs(10, foo="bar")`}); err != nil { - t.Fatal(err) - } - if !called { - t.Error("Count isn't called") - } -} - func TestStatsCount_APICalls(t *testing.T) { cluster := test.MustRunCluster(t, 1) defer cluster.Close() diff --git a/test/holder.go b/test/holder.go index 1b1914fb5..40ef4c843 100644 --- a/test/holder.go +++ b/test/holder.go @@ -20,7 +20,6 @@ import ( "time" "github.com/pilosa/pilosa/v2" - "github.com/pilosa/pilosa/v2/boltdb" "github.com/pilosa/pilosa/v2/pql" "github.com/pilosa/pilosa/v2/testhook" . "github.com/pilosa/pilosa/v2/vprint" // nolint:staticcheck @@ -40,7 +39,6 @@ func NewHolder(tb testing.TB) *Holder { } h := &Holder{Holder: pilosa.NewHolder(path, nil)} - h.Holder.NewAttrStore = boltdb.NewAttrStore return h } @@ -115,15 +113,6 @@ func (h *Holder) ReadRow(index, field string, rowID uint64) *pilosa.Row { return row.Clone() } -func (h *Holder) RowAttrStore(index, field string) pilosa.AttrStore { - idx := h.MustCreateIndexIfNotExists(index, pilosa.IndexOptions{}) - f, err := idx.CreateFieldIfNotExists(field, pilosa.OptFieldTypeDefault()) - if err != nil { - panic(err) - } - return f.RowAttrStore() -} - func (h *Holder) RowTime(index, field string, rowID uint64, t time.Time, quantum string) *pilosa.Row { idx := h.MustCreateIndexIfNotExists(index, pilosa.IndexOptions{}) f, err := idx.CreateFieldIfNotExists(field, pilosa.OptFieldTypeDefault()) diff --git a/txfactory.go b/txfactory.go index 4be8258b6..8a2b987cb 100644 --- a/txfactory.go +++ b/txfactory.go @@ -643,7 +643,7 @@ func (f *TxFactory) IndexUsageDetails() (map[string]IndexUsage, uint64, error) { fieldUsages[field] = fUsage } - // index metadata, e.g. columnAttrs + // index metadata indexMetaBytes, err := directoryUsage(indexPath, false) if err != nil { return indexUsage, 0, errors.Wrapf(err, "getting disk usage for index metadata (%s)", index) @@ -691,7 +691,7 @@ func (f *TxFactory) fieldUsage(indexPath string, fld *Field) (FieldUsage, error) keysBytes = 0 } - // field metadata, e.g. rowAttrs + // field metadata fieldPath := path.Join(indexPath, FieldsDir, field) metaBytes, err := directoryUsage(fieldPath, false) // this includes keys if err != nil { diff --git a/view.go b/view.go index 38aefb9b6..8d8367896 100644 --- a/view.go +++ b/view.go @@ -60,9 +60,8 @@ type view struct { // Fragments by shard. fragments map[uint64]*fragment - broadcaster broadcaster - stats stats.StatsClient - rowAttrStore AttrStore + broadcaster broadcaster + stats stats.StatsClient knownShards *roaring.Bitmap knownShardsCopied uint32 @@ -148,7 +147,6 @@ func (v *view) openWithShardSet(ss *shardSet) error { for shard := range shards { frag := v.newFragment(shard) frags = append(frags, frag) - frag.RowAttrStore = v.rowAttrStore v.fragments[frag.shard] = frag } @@ -333,7 +331,6 @@ func (v *view) CreateFragmentIfNotExists(shard uint64) (*fragment, error) { if err := frag.Open(); err != nil { return nil, errors.Wrap(err, "opening fragment") } - frag.RowAttrStore = v.rowAttrStore v.fragments[shard] = frag v.addKnownShard(shard) diff --git a/view_internal_test.go b/view_internal_test.go index 283f877a6..f4774a545 100644 --- a/view_internal_test.go +++ b/view_internal_test.go @@ -55,9 +55,6 @@ func mustOpenView(tb testing.TB, index, field, name string) *view { if err := v.openEmpty(); err != nil { PanicOn(err) } - v.rowAttrStore = &memAttrStore{ - store: make(map[uint64]map[string]interface{}), - } return v }