diff --git a/encoding/proto/proto.go b/encoding/proto/proto.go index e133de7fc..b6d78799a 100644 --- a/encoding/proto/proto.go +++ b/encoding/proto/proto.go @@ -363,9 +363,12 @@ func encodeQueryResponse(m *pilosa.QueryResponse) *internal.QueryResponse { case pilosa.RowIDs: pb.Results[i].Type = queryResultTypeRowIDs pb.Results[i].RowIDs = result - case pilosa.GroupByCounts: - pb.Results[i].Type = queryResultTypeGroupByCounts - pb.Results[i].GroupByCounts = encodeGroupByCount(result) + case []pilosa.GroupCount: + pb.Results[i].Type = queryResultTypeGroupCounts + pb.Results[i].GroupCounts = encodeGroupCounts(result) + case pilosa.RowIdentifiers: + pb.Results[i].Type = queryResultTypeRowIdentifiers + pb.Results[i].RowIdentifiers = encodeRowIdentifiers(result) case nil: pb.Results[i].Type = queryResultTypeNil } @@ -898,7 +901,6 @@ func decodeQueryResponse(pb *internal.QueryResponse, m *pilosa.QueryResponse) { } m.Results = make([]interface{}, len(pb.Results)) decodeQueryResults(pb.Results, m.Results) - } func decodeColumnAttrSets(pb []*internal.ColumnAttrSet, m []*pilosa.ColumnAttrSet) { @@ -929,7 +931,8 @@ const ( queryResultTypeUint64 queryResultTypeBool queryResultTypeRowIDs - queryResultTypeGroupByCounts + queryResultTypeGroupCounts + queryResultTypeRowIdentifiers ) func decodeQueryResult(pb *internal.QueryResult) interface{} { @@ -946,8 +949,8 @@ func decodeQueryResult(pb *internal.QueryResult) interface{} { return pb.Changed case queryResultTypeNil: return nil - case queryResultTypeGroupByCounts: - return decodeGroupByCounts(pb.GroupByCounts) + case queryResultTypeGroupCounts: + return decodeGroupCounts(pb.GroupCounts) } panic(fmt.Sprintf("unknown type: %d", pb.Type)) } @@ -998,12 +1001,24 @@ func decodeAttr(attr *internal.Attr) (key string, value interface{}) { } } -func decodeGroupByCounts(a []*internal.GroupLine) pilosa.GroupByCounts { - gbc := make(pilosa.GroupByCounts, 0) +func decodeGroupCounts(a []*internal.GroupCount) []pilosa.GroupCount { + other := make([]pilosa.GroupCount, len(a)) for i := range a { - gbc = append(gbc, pilosa.GroupLine{a[i].Groups, a[i].Total}) + other[i] = pilosa.GroupCount{ + decodeFieldRows(a[i].Group), + a[i].Count, + } } - return gbc + return other +} + +func decodeFieldRows(a []*internal.FieldRow) []pilosa.FieldRow { + other := make([]pilosa.FieldRow, len(a)) + for i := range a { + other[i].Field = a[i].Field + other[i].RowID = a[i].RowID + } + return other } func decodePairs(a []*internal.Pair) []pilosa.Pair { @@ -1057,14 +1072,36 @@ func encodeRow(r *pilosa.Row) *internal.Row { } } -func encodeGroupByCount(counts pilosa.GroupByCounts) []*internal.GroupLine { - result := make([]*internal.GroupLine, len(counts)) +func encodeRowIdentifiers(r pilosa.RowIdentifiers) *internal.RowIdentifiers { + return &internal.RowIdentifiers{ + Rows: r.Rows, + Keys: r.Keys, + //Attrs: encodeAttrs(r.Attrs), + } +} + +func encodeGroupCounts(counts []pilosa.GroupCount) []*internal.GroupCount { + result := make([]*internal.GroupCount, len(counts)) for i := range counts { - result[i] = &internal.GroupLine{Groups: counts[i].Groups, Total: counts[i].Total} + result[i] = &internal.GroupCount{ + Group: encodeFieldRows(counts[i].Group), + Count: counts[i].Count, + } } return result } +func encodeFieldRows(a []pilosa.FieldRow) []*internal.FieldRow { + other := make([]*internal.FieldRow, len(a)) + for i := range a { + other[i] = &internal.FieldRow{ + Field: a[i].Field, + RowID: a[i].RowID, + } + } + return other +} + func encodePairs(a pilosa.Pairs) []*internal.Pair { other := make([]*internal.Pair, len(a)) for i := range a { diff --git a/executor.go b/executor.go index 56ab05269..858c88d9e 100644 --- a/executor.go +++ b/executor.go @@ -196,9 +196,9 @@ func (e *executor) executeCall(ctx context.Context, index string, c *pql.Call, s case "TopN": e.Holder.Stats.CountWithCustomTags(c.Name, 1, 1.0, []string{indexTag}) return e.executeTopN(ctx, index, c, shards, opt) - case "Rows": + case "RowIDs": e.Holder.Stats.CountWithCustomTags(c.Name, 1, 1.0, []string{indexTag}) - return e.executeRows(ctx, index, c, shards, opt) + return e.executeRowIDs(ctx, index, c, shards, opt) case "GroupBy": e.Holder.Stats.CountWithCustomTags(c.Name, 1, 1.0, []string{indexTag}) return e.executeGroupBy(ctx, index, c, shards, opt) @@ -722,9 +722,23 @@ func (e *executor) executeDifferenceShard(ctx context.Context, index string, c * return other, nil } +// RowIdentifiers is a return type for a list of +// row ids or row keys. The names `Rows` and `Keys` +// are meant to follow the same convention as the +// Row query which returns `Columns` and `Keys`. +// TODO: Rename this to something better. Anything. +type RowIdentifiers struct { + Rows []uint64 `json:"rows"` + Keys []string `json:"keys,omitempty"` +} + +// RowIDs is a query return type for just uint64 row ids. +// It should only be used internally (since RowIdentifiers +// is the external return type), but it is exported because +// the proto package needs access to it. type RowIDs []uint64 -func (r RowIDs) Merge(other RowIDs) RowIDs { +func (r RowIDs) merge(other RowIDs) RowIDs { i, j := 0, 0 result := make(RowIDs, 0) for i < len(r) && j < len(other) { @@ -751,22 +765,24 @@ func (r RowIDs) Merge(other RowIDs) RowIDs { } return result } -func (e *executor) executeGroupBy(ctx context.Context, index string, c *pql.Call, shards []uint64, opt *execOptions) (GroupByCounts, error) { + +func (e *executor) executeGroupBy(ctx context.Context, index string, c *pql.Call, shards []uint64, opt *execOptions) ([]GroupCount, error) { // Execute calls in bulk on each remote node and merge. mapFn := func(shard uint64) (interface{}, error) { return e.executeGroupByShard(ctx, index, c, shard) } // Merge returned results at coordinating node. reduceFn := func(prev, v interface{}) interface{} { - other, _ := prev.(GroupByCounts) - return other.Merge(v.(GroupByCounts)) + other, _ := prev.([]GroupCount) + return mergeGroupCounts(other, v.([]GroupCount)) } // Get full result set. other, err := e.mapReduce(ctx, index, shards, c, opt, mapFn, reduceFn) if err != nil { return nil, err } - results, _ := other.(GroupByCounts) + results, _ := other.([]GroupCount) + // Apply offset. if offset, hasOffset, err := c.UintArg("offset"); err != nil { return nil, err @@ -786,55 +802,53 @@ func (e *executor) executeGroupBy(ctx context.Context, index string, c *pql.Call return results, nil } +// FieldRow is used to distinguish rows in a group by result. +type FieldRow struct { + Field string `json:"field"` + RowID uint64 `json:"rowID"` + RowKey string `json:"rowKey,omitempty"` +} + +func (fr FieldRow) String() string { + return fmt.Sprintf("%s.%d", fr.Field, fr.RowID) +} + +// TODO: we shouldn't need to string this +func uniqueGroupString(fr []FieldRow) string { + s := []string{} + for _, f := range fr { + s = append(s, f.String()) + } + return strings.Join(s, "-") +} + // gbi is a groupBy item. type gbi struct { row *Row - fieldKey string - rowID uint64 + fieldRow FieldRow } -type GroupLine struct { - Groups []string - Total uint64 -} -type GroupByCounts []GroupLine -func (gbc GroupByCounts) Merge(other GroupByCounts) GroupByCounts { - m := make(map[string]struct { - i int - total uint64 - }) - for i := range gbc { - m[strings.Join(gbc[i].Groups, "-")] = struct { - i int - total uint64 - }{total: gbc[i].Total, i: i} +type GroupCount struct { + Group []FieldRow `json:"group"` + Count uint64 `json:"count"` +} + +func mergeGroupCounts(gc, other []GroupCount) []GroupCount { + m := make(map[string]int) + for i := range gc { + m[uniqueGroupString(gc[i].Group)] = i } for i := range other { - key := strings.Join(other[i].Groups, "-") - o, found := m[key] - if found { - gbc[o.i].Total += other[i].Total + if idx, found := m[uniqueGroupString(other[i].Group)]; found { + gc[idx].Count += other[i].Count } else { - gbc = append(gbc, other[i]) + gc = append(gc, other[i]) } } - return gbc + return gc } -func makeGroup(parts []gbi) GroupLine { - var other *Row - line := GroupLine{} - for i, o := range parts { - if i == 0 { - other = o.row - } else { - other = other.Intersect(o.row) - } - line.Groups = append(line.Groups, o.fieldKey) - } - line.Total = other.Count() - return line -} -func (e *executor) executeGroupByShard(ctx context.Context, index string, c *pql.Call, shard uint64) (GroupByCounts, error) { + +func (e *executor) executeGroupByShard(ctx context.Context, index string, c *pql.Call, shard uint64) ([]GroupCount, error) { // Fetch index. idx := e.Holder.Index(index) if idx == nil { @@ -866,8 +880,9 @@ func (e *executor) executeGroupByShard(ctx context.Context, index string, c *pql return nil, errors.Wrap(ErrFieldNotFound, fmt.Sprintf("executeGroupBy: %s", fieldDirective.(string))) } } - results := make(GroupByCounts, 0) - var work listOfGBILists + + results := make([]GroupCount, 0) + var work [][]gbi for _, fieldDirective := range fieldDirectives.([]interface{}) { fieldName := getFieldName(fieldDirective.(string)) // Fetch fragment. @@ -880,54 +895,51 @@ func (e *executor) executeGroupByShard(ctx context.Context, index string, c *pql if err != nil { return nil, err } - set := make(gbiList, 0) + + set := make([]gbi, 0) for _, rowID := range frag.rowsWithFilter(filter) { set = append(set, gbi{ - row: frag.row(rowID), - rowID: rowID, - fieldKey: fmt.Sprintf("%s.%d", fieldName, rowID), + row: frag.row(rowID), + fieldRow: FieldRow{ + Field: fieldName, + RowID: rowID, + }, }) } work = append(work, set) } for _, group := range product(work) { - group.gl.Total = group.row.Count() - if group.gl.Total > 0 { - results = append(results, group.gl) + group.gCnt.Count = group.row.Count() + if group.gCnt.Count > 0 { + results = append(results, group.gCnt) } } return results, nil } -type gbiList []gbi -type listOfGBILists []gbiList - -// pi is a product process item. -type pi struct { - row *Row - gl GroupLine +// ppi is a product process item. +type ppi struct { + row *Row + gCnt GroupCount } -type piList []pi -// product generates the cartiesian product of the input -// using tail recursion -func product(input listOfGBILists) piList { - res := make(piList, 0) - if len(input) == 0 { //base return empty list - res = append(res, pi{gl: GroupLine{Groups: make([]string, 0)}}) - } else { - res = productHelper(input, res) +// product generates the cartesian product of the input +// using tail recursion. +func product(input [][]gbi) []ppi { + if len(input) == 0 { // base return empty list + return []ppi{ + {gCnt: GroupCount{Group: make([]FieldRow, 0)}}, + } } - return res -} -func productHelper(lists listOfGBILists, res piList) piList { - head := lists[0] //take first element of the list - tail := product(lists[1:]) //invoke product on remaining element + + res := make([]ppi, 0) + head := input[0] // take first element of the list + tail := product(input[1:]) // invoke product on remaining element for h := range head { // for each head - for t := range tail { //iterate over the tail - s := pi{gl: GroupLine{Groups: make([]string, 0)}} - s.gl.Groups = append([]string{head[h].fieldKey}, tail[t].gl.Groups...) //had to insert at the front to match input order - if tail[t].row != nil { //first time around nothing to intersect + for t := range tail { // iterate over the tail + s := ppi{gCnt: GroupCount{Group: make([]FieldRow, 0)}} + s.gCnt.Group = append([]FieldRow{head[h].fieldRow}, tail[t].gCnt.Group...) // had to insert at the front to match input order + if tail[t].row != nil { // first time around nothing to intersect s.row = head[h].row.Intersect(tail[t].row) } else { s.row = head[h].row @@ -937,15 +949,16 @@ func productHelper(lists listOfGBILists, res piList) piList { } return res } -func (e *executor) executeRows(ctx context.Context, index string, c *pql.Call, shards []uint64, opt *execOptions) (RowIDs, error) { + +func (e *executor) executeRowIDs(ctx context.Context, index string, c *pql.Call, shards []uint64, opt *execOptions) (RowIDs, error) { // Execute calls in bulk on each remote node and merge. mapFn := func(shard uint64) (interface{}, error) { - return e.executeRowsShard(ctx, index, c, shard) + return e.executeRowIDsShard(ctx, index, c, shard) } // Merge returned results at coordinating node. reduceFn := func(prev, v interface{}) interface{} { other, _ := prev.(RowIDs) - return other.Merge(v.(RowIDs)) + return other.merge(v.(RowIDs)) } // Get full result set. other, err := e.mapReduce(ctx, index, shards, c, opt, mapFn, reduceFn) @@ -971,7 +984,8 @@ func (e *executor) executeRows(ctx context.Context, index string, c *pql.Call, s } return results, nil } -func (e *executor) executeRowsShard(ctx context.Context, index string, c *pql.Call, shard uint64) (RowIDs, error) { + +func (e *executor) executeRowIDsShard(ctx context.Context, index string, c *pql.Call, shard uint64) (RowIDs, error) { // Fetch index. idx := e.Holder.Index(index) if idx == nil { @@ -980,7 +994,7 @@ func (e *executor) executeRowsShard(ctx context.Context, index string, c *pql.Ca // Fetch field name from argument. fieldName, ok := c.Args["field"].(string) if !ok { - return nil, errors.New("Rows() argument required: field") + return nil, errors.New("RowIDs() argument required: field") } // Fetch field. f := e.Holder.Field(index, fieldName) @@ -2087,7 +2101,62 @@ func (e *executor) translateResult(index string, idx *Index, call *pql.Call, res return other, nil } } + + case []GroupCount: + other := make([]GroupCount, 0) + for _, gl := range result { + + group := make([]FieldRow, len(gl.Group)) + for i, g := range gl.Group { + group[i] = g + + // TODO: It may be useful to cache this field lookup. + field := idx.Field(g.Field) + if field == nil { + return nil, ErrFieldNotFound + } + if field.keys() { + key, err := e.TranslateStore.TranslateRowToString(index, g.Field, g.RowID) + if err != nil { + return nil, err + } + group[i].RowKey = key + } + } + + other = append(other, GroupCount{ + Group: group, + Count: gl.Count, + }) + } + return other, nil + + case RowIDs: + other := RowIdentifiers{} + + fieldName := callArgString(call, "field") + if fieldName == "" { + return nil, ErrFieldNotFound + } + + if field := idx.Field(fieldName); field == nil { + return nil, ErrFieldNotFound + } else if field.keys() { + other.Keys = make([]string, len(result)) + for i, id := range result { + key, err := e.TranslateStore.TranslateRowToString(index, fieldName, id) + if err != nil { + return nil, err + } + other.Keys[i] = key + } + } else { + other.Rows = result + } + + return other, nil } + return result, nil } @@ -2136,7 +2205,7 @@ func needsShards(calls []*pql.Call) bool { switch call.Name { case "Clear", "Set", "SetRowAttrs", "SetColumnAttrs": continue - case "Count", "TopN", "Rows": + case "Count", "TopN", "RowIDs": return true // default catches Bitmap calls default: diff --git a/executor_test.go b/executor_test.go index 84e00936d..c6ae4d9ab 100644 --- a/executor_test.go +++ b/executor_test.go @@ -1233,12 +1233,12 @@ Set(4500001, fn=4) }); err != nil { t.Fatalf("GroupBy querying: %v", err) } else { - expected := pilosa.GroupByCounts{ - {Groups: []string{"f.10"}, Total: 4}, - {Groups: []string{"f.7"}, Total: 1}, + expected := []pilosa.GroupCount{ + {Group: []pilosa.FieldRow{{Field: "f", RowID: 10}}, Count: 4}, + {Group: []pilosa.FieldRow{{Field: "f", RowID: 7}}, Count: 1}, } - results := res.Results[0].(pilosa.GroupByCounts) - checkGroupBy(expected, results, t) + results := res.Results[0].([]pilosa.GroupCount) + checkGroupBy(t, expected, results) } }) } @@ -1639,7 +1639,7 @@ func benchmarkExistence(nn bool, b *testing.B) { func BenchmarkExecutor_Existence_True(b *testing.B) { benchmarkExistence(true, b) } func BenchmarkExecutor_Existence_False(b *testing.B) { benchmarkExistence(false, b) } -func TestExecutor_Execute_Rows(t *testing.T) { +func TestExecutor_Execute_RowIDs(t *testing.T) { c := test.MustRunCluster(t, 1) defer c.Close() hldr := test.Holder{Holder: c[0].Server.Holder()} @@ -1649,24 +1649,28 @@ func TestExecutor_Execute_Rows(t *testing.T) { hldr.SetBit("i", "general", 11, ShardWidth+2) hldr.SetBit("i", "general", 12, 2) hldr.SetBit("i", "general", 12, ShardWidth+2) - if res, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Rows(field=general)`}); err != nil { + + if res, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `RowIDs(field=general)`}); err != nil { t.Fatal(err) - } else if columns := res.Results[0].(pilosa.RowIDs); !reflect.DeepEqual(columns, pilosa.RowIDs{10, 11, 12}) { + } else if columns := res.Results[0].(pilosa.RowIdentifiers); !reflect.DeepEqual(columns, pilosa.RowIdentifiers{Rows: []uint64{10, 11, 12}}) { t.Fatalf("unexpected columns: %+v", columns) } - if res, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Rows(field=general, limit=2)`}); err != nil { + + if res, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `RowIDs(field=general, limit=2)`}); err != nil { t.Fatal(err) - } else if columns := res.Results[0].(pilosa.RowIDs); !reflect.DeepEqual(columns, pilosa.RowIDs{10, 11}) { + } else if columns := res.Results[0].(pilosa.RowIdentifiers); !reflect.DeepEqual(columns, pilosa.RowIdentifiers{Rows: []uint64{10, 11}}) { t.Fatalf("unexpected columns: %+v", columns) } - if res, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Rows(field=general, offset=1,limit=2)`}); err != nil { + + if res, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `RowIDs(field=general, offset=1,limit=2)`}); err != nil { t.Fatal(err) - } else if columns := res.Results[0].(pilosa.RowIDs); !reflect.DeepEqual(columns, pilosa.RowIDs{11, 12}) { + } else if columns := res.Results[0].(pilosa.RowIdentifiers); !reflect.DeepEqual(columns, pilosa.RowIdentifiers{Rows: []uint64{11, 12}}) { t.Fatalf("unexpected columns: %+v", columns) } - if res, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Rows(field=general, column=2)`}); err != nil { + + if res, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `RowIDs(field=general, column=2)`}); err != nil { t.Fatal(err) - } else if columns := res.Results[0].(pilosa.RowIDs); !reflect.DeepEqual(columns, pilosa.RowIDs{11, 12}) { + } else if columns := res.Results[0].(pilosa.RowIdentifiers); !reflect.DeepEqual(columns, pilosa.RowIdentifiers{Rows: []uint64{11, 12}}) { t.Fatalf("unexpected columns: %+v", columns) } } @@ -1681,17 +1685,15 @@ func TestExecutor_Execute_GroupBy(t *testing.T) { hldr.SetBit("i", "general", 11, ShardWidth+2) hldr.SetBit("i", "general", 12, 2) hldr.SetBit("i", "general", 12, ShardWidth+2) - hldr.SetBit("i", "sub", 10, 0) - hldr.SetBit("i", "sub", 10, 1) - hldr.SetBit("i", "sub", 10, 3) - hldr.SetBit("i", "sub", 11, 2) - hldr.SetBit("i", "sub", 11, 0) - expected := pilosa.GroupByCounts{ - {Groups: []string{"general.10", "sub.11"}, Total: 1}, - {Groups: []string{"general.11", "sub.11"}, Total: 1}, - {Groups: []string{"general.12", "sub.11"}, Total: 1}, - {Groups: []string{"general.10", "sub.10"}, Total: 2}, - } + + hldr.SetBit("i", "sub", 100, 0) + hldr.SetBit("i", "sub", 100, 1) + hldr.SetBit("i", "sub", 100, 3) + hldr.SetBit("i", "sub", 100, ShardWidth+1) + + hldr.SetBit("i", "sub", 110, 2) + hldr.SetBit("i", "sub", 110, 0) + t.Run("No Field List Arguments", func(t *testing.T) { if _, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `GroupBy()`}); err != nil { if errors.Cause(err) != pilosa.ErrFieldsArgumentRequired { @@ -1714,42 +1716,54 @@ func TestExecutor_Execute_GroupBy(t *testing.T) { } }) t.Run("Basic", func(t *testing.T) { + expected := []pilosa.GroupCount{ + {Group: []pilosa.FieldRow{{Field: "general", RowID: 10}, {Field: "sub", RowID: 110}}, Count: 1}, + {Group: []pilosa.FieldRow{{Field: "general", RowID: 11}, {Field: "sub", RowID: 110}}, Count: 1}, + {Group: []pilosa.FieldRow{{Field: "general", RowID: 12}, {Field: "sub", RowID: 110}}, Count: 1}, + {Group: []pilosa.FieldRow{{Field: "general", RowID: 10}, {Field: "sub", RowID: 100}}, Count: 3}, + } + if res, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `GroupBy(fields=[general,sub])`}); err != nil { t.Fatal(err) } else { - results := res.Results[0].(pilosa.GroupByCounts) - checkGroupBy(expected, results, t) + results := res.Results[0].([]pilosa.GroupCount) + checkGroupBy(t, expected, results) } }) - expected = pilosa.GroupByCounts{ - {Groups: []string{"general.11"}, Total: 2}, - {Groups: []string{"general.12"}, Total: 2}, - } + t.Run("check field offset no limit", func(t *testing.T) { + expected := []pilosa.GroupCount{ + {Group: []pilosa.FieldRow{{Field: "general", RowID: 11}}, Count: 2}, + {Group: []pilosa.FieldRow{{Field: "general", RowID: 12}}, Count: 2}, + } + if res, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `GroupBy(fields=[general:11:])`}); err != nil { t.Fatal(err) } else { - results := res.Results[0].(pilosa.GroupByCounts) - checkGroupBy(expected, results, t) + results := res.Results[0].([]pilosa.GroupCount) + checkGroupBy(t, expected, results) } }) - expected = pilosa.GroupByCounts{ - {Groups: []string{"general.11"}, Total: 2}, - } + t.Run("check field offset limit", func(t *testing.T) { + expected := []pilosa.GroupCount{ + {Group: []pilosa.FieldRow{{Field: "general", RowID: 11}}, Count: 2}, + } + if res, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `GroupBy(fields=[general:11:1])`}); err != nil { t.Fatal(err) } else { - results := res.Results[0].(pilosa.GroupByCounts) - checkGroupBy(expected, results, t) + results := res.Results[0].([]pilosa.GroupCount) + checkGroupBy(t, expected, results) } }) } -func checkGroupBy(expected, results pilosa.GroupByCounts, t *testing.T) { - notIn := func(item pilosa.GroupLine, expected pilosa.GroupByCounts) bool { + +func checkGroupBy(t *testing.T, expected, results []pilosa.GroupCount) { + notIn := func(item pilosa.GroupCount, expected []pilosa.GroupCount) bool { for i := range expected { - if item.Total == expected[i].Total { - if reflect.DeepEqual(item.Groups, expected[i].Groups) { + if item.Count == expected[i].Count { + if reflect.DeepEqual(item.Group, expected[i].Group) { return false } } diff --git a/internal/public.pb.go b/internal/public.pb.go index 8139d3a28..bfa0b3be1 100644 --- a/internal/public.pb.go +++ b/internal/public.pb.go @@ -9,8 +9,10 @@ It has these top-level messages: Row + RowIdentifiers Pair - GroupLine + FieldRow + GroupCount ValCount Bit ColumnAttrSet @@ -75,6 +77,30 @@ func (m *Row) GetAttrs() []*Attr { return nil } +type RowIdentifiers struct { + Rows []uint64 `protobuf:"varint,1,rep,packed,name=Rows" json:"Rows,omitempty"` + Keys []string `protobuf:"bytes,2,rep,name=Keys" json:"Keys,omitempty"` +} + +func (m *RowIdentifiers) Reset() { *m = RowIdentifiers{} } +func (m *RowIdentifiers) String() string { return proto.CompactTextString(m) } +func (*RowIdentifiers) ProtoMessage() {} +func (*RowIdentifiers) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{1} } + +func (m *RowIdentifiers) GetRows() []uint64 { + if m != nil { + return m.Rows + } + return nil +} + +func (m *RowIdentifiers) GetKeys() []string { + if m != nil { + return m.Keys + } + return nil +} + type Pair 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"` @@ -84,7 +110,7 @@ type Pair struct { func (m *Pair) Reset() { *m = Pair{} } func (m *Pair) String() string { return proto.CompactTextString(m) } func (*Pair) ProtoMessage() {} -func (*Pair) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{1} } +func (*Pair) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{2} } func (m *Pair) GetID() uint64 { if m != nil { @@ -107,26 +133,50 @@ func (m *Pair) GetCount() uint64 { return 0 } -type GroupLine struct { - Groups []string `protobuf:"bytes,1,rep,name=Groups" json:"Groups,omitempty"` - Total uint64 `protobuf:"varint,2,opt,name=Total,proto3" json:"Total,omitempty"` +type FieldRow struct { + Field string `protobuf:"bytes,1,opt,name=Field,proto3" json:"Field,omitempty"` + RowID uint64 `protobuf:"varint,2,opt,name=RowID,proto3" json:"RowID,omitempty"` } -func (m *GroupLine) Reset() { *m = GroupLine{} } -func (m *GroupLine) String() string { return proto.CompactTextString(m) } -func (*GroupLine) ProtoMessage() {} -func (*GroupLine) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{2} } +func (m *FieldRow) Reset() { *m = FieldRow{} } +func (m *FieldRow) String() string { return proto.CompactTextString(m) } +func (*FieldRow) ProtoMessage() {} +func (*FieldRow) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{3} } -func (m *GroupLine) GetGroups() []string { +func (m *FieldRow) GetField() string { if m != nil { - return m.Groups + return m.Field + } + return "" +} + +func (m *FieldRow) GetRowID() uint64 { + if m != nil { + return m.RowID + } + return 0 +} + +type GroupCount struct { + Group []*FieldRow `protobuf:"bytes,1,rep,name=Group" json:"Group,omitempty"` + Count uint64 `protobuf:"varint,2,opt,name=Count,proto3" json:"Count,omitempty"` +} + +func (m *GroupCount) Reset() { *m = GroupCount{} } +func (m *GroupCount) String() string { return proto.CompactTextString(m) } +func (*GroupCount) ProtoMessage() {} +func (*GroupCount) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{4} } + +func (m *GroupCount) GetGroup() []*FieldRow { + if m != nil { + return m.Group } return nil } -func (m *GroupLine) GetTotal() uint64 { +func (m *GroupCount) GetCount() uint64 { if m != nil { - return m.Total + return m.Count } return 0 } @@ -139,7 +189,7 @@ type ValCount struct { func (m *ValCount) Reset() { *m = ValCount{} } func (m *ValCount) String() string { return proto.CompactTextString(m) } func (*ValCount) ProtoMessage() {} -func (*ValCount) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{3} } +func (*ValCount) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{5} } func (m *ValCount) GetVal() int64 { if m != nil { @@ -164,7 +214,7 @@ type Bit struct { func (m *Bit) Reset() { *m = Bit{} } func (m *Bit) String() string { return proto.CompactTextString(m) } func (*Bit) ProtoMessage() {} -func (*Bit) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{4} } +func (*Bit) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{6} } func (m *Bit) GetRowID() uint64 { if m != nil { @@ -196,7 +246,7 @@ type ColumnAttrSet struct { func (m *ColumnAttrSet) Reset() { *m = ColumnAttrSet{} } func (m *ColumnAttrSet) String() string { return proto.CompactTextString(m) } func (*ColumnAttrSet) ProtoMessage() {} -func (*ColumnAttrSet) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{5} } +func (*ColumnAttrSet) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{7} } func (m *ColumnAttrSet) GetID() uint64 { if m != nil { @@ -231,7 +281,7 @@ type Attr struct { func (m *Attr) Reset() { *m = Attr{} } func (m *Attr) String() string { return proto.CompactTextString(m) } func (*Attr) ProtoMessage() {} -func (*Attr) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{6} } +func (*Attr) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{8} } func (m *Attr) GetKey() string { if m != nil { @@ -282,7 +332,7 @@ type AttrMap struct { func (m *AttrMap) Reset() { *m = AttrMap{} } func (m *AttrMap) String() string { return proto.CompactTextString(m) } func (*AttrMap) ProtoMessage() {} -func (*AttrMap) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{7} } +func (*AttrMap) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{9} } func (m *AttrMap) GetAttrs() []*Attr { if m != nil { @@ -303,7 +353,7 @@ type QueryRequest struct { func (m *QueryRequest) Reset() { *m = QueryRequest{} } func (m *QueryRequest) String() string { return proto.CompactTextString(m) } func (*QueryRequest) ProtoMessage() {} -func (*QueryRequest) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{8} } +func (*QueryRequest) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{10} } func (m *QueryRequest) GetQuery() string { if m != nil { @@ -356,7 +406,7 @@ type QueryResponse struct { func (m *QueryResponse) Reset() { *m = QueryResponse{} } func (m *QueryResponse) String() string { return proto.CompactTextString(m) } func (*QueryResponse) ProtoMessage() {} -func (*QueryResponse) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{9} } +func (*QueryResponse) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{11} } func (m *QueryResponse) GetErr() string { if m != nil { @@ -380,20 +430,21 @@ func (m *QueryResponse) GetColumnAttrSets() []*ColumnAttrSet { } type QueryResult struct { - Type uint32 `protobuf:"varint,6,opt,name=Type,proto3" json:"Type,omitempty"` - Row *Row `protobuf:"bytes,1,opt,name=Row" json:"Row,omitempty"` - N uint64 `protobuf:"varint,2,opt,name=N,proto3" json:"N,omitempty"` - Pairs []*Pair `protobuf:"bytes,3,rep,name=Pairs" json:"Pairs,omitempty"` - Changed bool `protobuf:"varint,4,opt,name=Changed,proto3" json:"Changed,omitempty"` - ValCount *ValCount `protobuf:"bytes,5,opt,name=ValCount" json:"ValCount,omitempty"` - RowIDs []uint64 `protobuf:"varint,7,rep,packed,name=RowIDs" json:"RowIDs,omitempty"` - GroupByCounts []*GroupLine `protobuf:"bytes,8,rep,name=GroupByCounts" json:"GroupByCounts,omitempty"` + Type uint32 `protobuf:"varint,6,opt,name=Type,proto3" json:"Type,omitempty"` + Row *Row `protobuf:"bytes,1,opt,name=Row" json:"Row,omitempty"` + N uint64 `protobuf:"varint,2,opt,name=N,proto3" json:"N,omitempty"` + Pairs []*Pair `protobuf:"bytes,3,rep,name=Pairs" json:"Pairs,omitempty"` + Changed bool `protobuf:"varint,4,opt,name=Changed,proto3" json:"Changed,omitempty"` + ValCount *ValCount `protobuf:"bytes,5,opt,name=ValCount" json:"ValCount,omitempty"` + RowIDs []uint64 `protobuf:"varint,7,rep,packed,name=RowIDs" json:"RowIDs,omitempty"` + GroupCounts []*GroupCount `protobuf:"bytes,8,rep,name=GroupCounts" json:"GroupCounts,omitempty"` + RowIdentifiers *RowIdentifiers `protobuf:"bytes,9,opt,name=RowIdentifiers" json:"RowIdentifiers,omitempty"` } func (m *QueryResult) Reset() { *m = QueryResult{} } func (m *QueryResult) String() string { return proto.CompactTextString(m) } func (*QueryResult) ProtoMessage() {} -func (*QueryResult) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{10} } +func (*QueryResult) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{12} } func (m *QueryResult) GetType() uint32 { if m != nil { @@ -444,9 +495,16 @@ func (m *QueryResult) GetRowIDs() []uint64 { return nil } -func (m *QueryResult) GetGroupByCounts() []*GroupLine { +func (m *QueryResult) GetGroupCounts() []*GroupCount { if m != nil { - return m.GroupByCounts + return m.GroupCounts + } + return nil +} + +func (m *QueryResult) GetRowIdentifiers() *RowIdentifiers { + if m != nil { + return m.RowIdentifiers } return nil } @@ -465,7 +523,7 @@ type ImportRequest struct { func (m *ImportRequest) Reset() { *m = ImportRequest{} } func (m *ImportRequest) String() string { return proto.CompactTextString(m) } func (*ImportRequest) ProtoMessage() {} -func (*ImportRequest) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{11} } +func (*ImportRequest) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{13} } func (m *ImportRequest) GetIndex() string { if m != nil { @@ -535,7 +593,7 @@ type ImportValueRequest struct { func (m *ImportValueRequest) Reset() { *m = ImportValueRequest{} } func (m *ImportValueRequest) String() string { return proto.CompactTextString(m) } func (*ImportValueRequest) ProtoMessage() {} -func (*ImportValueRequest) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{12} } +func (*ImportValueRequest) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{14} } func (m *ImportValueRequest) GetIndex() string { if m != nil { @@ -581,8 +639,10 @@ func (m *ImportValueRequest) GetValues() []int64 { func init() { proto.RegisterType((*Row)(nil), "internal.Row") + proto.RegisterType((*RowIdentifiers)(nil), "internal.RowIdentifiers") proto.RegisterType((*Pair)(nil), "internal.Pair") - proto.RegisterType((*GroupLine)(nil), "internal.GroupLine") + proto.RegisterType((*FieldRow)(nil), "internal.FieldRow") + proto.RegisterType((*GroupCount)(nil), "internal.GroupCount") proto.RegisterType((*ValCount)(nil), "internal.ValCount") proto.RegisterType((*Bit)(nil), "internal.Bit") proto.RegisterType((*ColumnAttrSet)(nil), "internal.ColumnAttrSet") @@ -656,6 +716,56 @@ func (m *Row) MarshalTo(dAtA []byte) (int, error) { return i, nil } +func (m *RowIdentifiers) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RowIdentifiers) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Rows) > 0 { + dAtA4 := make([]byte, len(m.Rows)*10) + var j3 int + for _, num := range m.Rows { + for num >= 1<<7 { + dAtA4[j3] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j3++ + } + dAtA4[j3] = uint8(num) + j3++ + } + dAtA[i] = 0xa + i++ + i = encodeVarintPublic(dAtA, i, uint64(j3)) + i += copy(dAtA[i:], dAtA4[:j3]) + } + if len(m.Keys) > 0 { + for _, s := range m.Keys { + dAtA[i] = 0x12 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + return i, nil +} + func (m *Pair) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -690,7 +800,7 @@ func (m *Pair) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *GroupLine) Marshal() (dAtA []byte, err error) { +func (m *FieldRow) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -700,30 +810,56 @@ func (m *GroupLine) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *GroupLine) MarshalTo(dAtA []byte) (int, error) { +func (m *FieldRow) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int _ = l - if len(m.Groups) > 0 { - for _, s := range m.Groups { - dAtA[i] = 0xa - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) - } + if len(m.Field) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintPublic(dAtA, i, uint64(len(m.Field))) + i += copy(dAtA[i:], m.Field) } - if m.Total != 0 { + if m.RowID != 0 { dAtA[i] = 0x10 i++ - i = encodeVarintPublic(dAtA, i, uint64(m.Total)) + i = encodeVarintPublic(dAtA, i, uint64(m.RowID)) + } + return i, nil +} + +func (m *GroupCount) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GroupCount) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Group) > 0 { + for _, msg := range m.Group { + dAtA[i] = 0xa + i++ + i = encodeVarintPublic(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.Count != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintPublic(dAtA, i, uint64(m.Count)) } return i, nil } @@ -938,21 +1074,21 @@ func (m *QueryRequest) MarshalTo(dAtA []byte) (int, error) { i += copy(dAtA[i:], m.Query) } if len(m.Shards) > 0 { - dAtA4 := make([]byte, len(m.Shards)*10) - var j3 int + dAtA6 := make([]byte, len(m.Shards)*10) + var j5 int for _, num := range m.Shards { for num >= 1<<7 { - dAtA4[j3] = uint8(uint64(num)&0x7f | 0x80) + dAtA6[j5] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j3++ + j5++ } - dAtA4[j3] = uint8(num) - j3++ + dAtA6[j5] = uint8(num) + j5++ } dAtA[i] = 0x12 i++ - i = encodeVarintPublic(dAtA, i, uint64(j3)) - i += copy(dAtA[i:], dAtA4[:j3]) + i = encodeVarintPublic(dAtA, i, uint64(j5)) + i += copy(dAtA[i:], dAtA6[:j5]) } if m.ColumnAttrs { dAtA[i] = 0x18 @@ -1064,11 +1200,11 @@ func (m *QueryResult) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintPublic(dAtA, i, uint64(m.Row.Size())) - n5, err := m.Row.MarshalTo(dAtA[i:]) + n7, err := m.Row.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n5 + i += n7 } if m.N != 0 { dAtA[i] = 0x10 @@ -1101,11 +1237,11 @@ func (m *QueryResult) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x2a i++ i = encodeVarintPublic(dAtA, i, uint64(m.ValCount.Size())) - n6, err := m.ValCount.MarshalTo(dAtA[i:]) + n8, err := m.ValCount.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n6 + i += n8 } if m.Type != 0 { dAtA[i] = 0x30 @@ -1113,24 +1249,24 @@ func (m *QueryResult) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintPublic(dAtA, i, uint64(m.Type)) } if len(m.RowIDs) > 0 { - dAtA8 := make([]byte, len(m.RowIDs)*10) - var j7 int + dAtA10 := make([]byte, len(m.RowIDs)*10) + var j9 int for _, num := range m.RowIDs { for num >= 1<<7 { - dAtA8[j7] = uint8(uint64(num)&0x7f | 0x80) + dAtA10[j9] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j7++ + j9++ } - dAtA8[j7] = uint8(num) - j7++ + dAtA10[j9] = uint8(num) + j9++ } dAtA[i] = 0x3a i++ - i = encodeVarintPublic(dAtA, i, uint64(j7)) - i += copy(dAtA[i:], dAtA8[:j7]) + i = encodeVarintPublic(dAtA, i, uint64(j9)) + i += copy(dAtA[i:], dAtA10[:j9]) } - if len(m.GroupByCounts) > 0 { - for _, msg := range m.GroupByCounts { + if len(m.GroupCounts) > 0 { + for _, msg := range m.GroupCounts { dAtA[i] = 0x42 i++ i = encodeVarintPublic(dAtA, i, uint64(msg.Size())) @@ -1141,6 +1277,16 @@ func (m *QueryResult) MarshalTo(dAtA []byte) (int, error) { i += n } } + if m.RowIdentifiers != nil { + dAtA[i] = 0x4a + i++ + i = encodeVarintPublic(dAtA, i, uint64(m.RowIdentifiers.Size())) + n11, err := m.RowIdentifiers.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n11 + } return i, nil } @@ -1177,56 +1323,56 @@ func (m *ImportRequest) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintPublic(dAtA, i, uint64(m.Shard)) } if len(m.RowIDs) > 0 { - dAtA10 := make([]byte, len(m.RowIDs)*10) - var j9 int + dAtA13 := make([]byte, len(m.RowIDs)*10) + var j12 int for _, num := range m.RowIDs { for num >= 1<<7 { - dAtA10[j9] = uint8(uint64(num)&0x7f | 0x80) + dAtA13[j12] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j9++ + j12++ } - dAtA10[j9] = uint8(num) - j9++ + dAtA13[j12] = uint8(num) + j12++ } dAtA[i] = 0x22 i++ - i = encodeVarintPublic(dAtA, i, uint64(j9)) - i += copy(dAtA[i:], dAtA10[:j9]) + i = encodeVarintPublic(dAtA, i, uint64(j12)) + i += copy(dAtA[i:], dAtA13[:j12]) } if len(m.ColumnIDs) > 0 { - dAtA12 := make([]byte, len(m.ColumnIDs)*10) - var j11 int + dAtA15 := make([]byte, len(m.ColumnIDs)*10) + var j14 int for _, num := range m.ColumnIDs { for num >= 1<<7 { - dAtA12[j11] = uint8(uint64(num)&0x7f | 0x80) + dAtA15[j14] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j11++ + j14++ } - dAtA12[j11] = uint8(num) - j11++ + dAtA15[j14] = uint8(num) + j14++ } dAtA[i] = 0x2a i++ - i = encodeVarintPublic(dAtA, i, uint64(j11)) - i += copy(dAtA[i:], dAtA12[:j11]) + i = encodeVarintPublic(dAtA, i, uint64(j14)) + i += copy(dAtA[i:], dAtA15[:j14]) } if len(m.Timestamps) > 0 { - dAtA14 := make([]byte, len(m.Timestamps)*10) - var j13 int + dAtA17 := make([]byte, len(m.Timestamps)*10) + var j16 int for _, num1 := range m.Timestamps { num := uint64(num1) for num >= 1<<7 { - dAtA14[j13] = uint8(uint64(num)&0x7f | 0x80) + dAtA17[j16] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j13++ + j16++ } - dAtA14[j13] = uint8(num) - j13++ + dAtA17[j16] = uint8(num) + j16++ } dAtA[i] = 0x32 i++ - i = encodeVarintPublic(dAtA, i, uint64(j13)) - i += copy(dAtA[i:], dAtA14[:j13]) + i = encodeVarintPublic(dAtA, i, uint64(j16)) + i += copy(dAtA[i:], dAtA17[:j16]) } if len(m.RowKeys) > 0 { for _, s := range m.RowKeys { @@ -1294,39 +1440,39 @@ func (m *ImportValueRequest) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintPublic(dAtA, i, uint64(m.Shard)) } if len(m.ColumnIDs) > 0 { - dAtA16 := make([]byte, len(m.ColumnIDs)*10) - var j15 int + dAtA19 := make([]byte, len(m.ColumnIDs)*10) + var j18 int for _, num := range m.ColumnIDs { for num >= 1<<7 { - dAtA16[j15] = uint8(uint64(num)&0x7f | 0x80) + dAtA19[j18] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j15++ + j18++ } - dAtA16[j15] = uint8(num) - j15++ + dAtA19[j18] = uint8(num) + j18++ } dAtA[i] = 0x2a i++ - i = encodeVarintPublic(dAtA, i, uint64(j15)) - i += copy(dAtA[i:], dAtA16[:j15]) + i = encodeVarintPublic(dAtA, i, uint64(j18)) + i += copy(dAtA[i:], dAtA19[:j18]) } if len(m.Values) > 0 { - dAtA18 := make([]byte, len(m.Values)*10) - var j17 int + dAtA21 := make([]byte, len(m.Values)*10) + var j20 int for _, num1 := range m.Values { num := uint64(num1) for num >= 1<<7 { - dAtA18[j17] = uint8(uint64(num)&0x7f | 0x80) + dAtA21[j20] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j17++ + j20++ } - dAtA18[j17] = uint8(num) - j17++ + dAtA21[j20] = uint8(num) + j20++ } dAtA[i] = 0x32 i++ - i = encodeVarintPublic(dAtA, i, uint64(j17)) - i += copy(dAtA[i:], dAtA18[:j17]) + i = encodeVarintPublic(dAtA, i, uint64(j20)) + i += copy(dAtA[i:], dAtA21[:j20]) } if len(m.ColumnKeys) > 0 { for _, s := range m.ColumnKeys { @@ -1380,6 +1526,25 @@ func (m *Row) Size() (n int) { return n } +func (m *RowIdentifiers) Size() (n int) { + var l int + _ = l + if len(m.Rows) > 0 { + l = 0 + for _, e := range m.Rows { + l += sovPublic(uint64(e)) + } + n += 1 + sovPublic(uint64(l)) + l + } + if len(m.Keys) > 0 { + for _, s := range m.Keys { + l = len(s) + n += 1 + l + sovPublic(uint64(l)) + } + } + return n +} + func (m *Pair) Size() (n int) { var l int _ = l @@ -1396,17 +1561,30 @@ func (m *Pair) Size() (n int) { return n } -func (m *GroupLine) Size() (n int) { +func (m *FieldRow) Size() (n int) { var l int _ = l - if len(m.Groups) > 0 { - for _, s := range m.Groups { - l = len(s) + l = len(m.Field) + if l > 0 { + n += 1 + l + sovPublic(uint64(l)) + } + if m.RowID != 0 { + n += 1 + sovPublic(uint64(m.RowID)) + } + return n +} + +func (m *GroupCount) Size() (n int) { + var l int + _ = l + if len(m.Group) > 0 { + for _, e := range m.Group { + l = e.Size() n += 1 + l + sovPublic(uint64(l)) } } - if m.Total != 0 { - n += 1 + sovPublic(uint64(m.Total)) + if m.Count != 0 { + n += 1 + sovPublic(uint64(m.Count)) } return n } @@ -1579,12 +1757,16 @@ func (m *QueryResult) Size() (n int) { } n += 1 + sovPublic(uint64(l)) + l } - if len(m.GroupByCounts) > 0 { - for _, e := range m.GroupByCounts { + if len(m.GroupCounts) > 0 { + for _, e := range m.GroupCounts { l = e.Size() n += 1 + l + sovPublic(uint64(l)) } } + if m.RowIdentifiers != nil { + l = m.RowIdentifiers.Size() + n += 1 + l + sovPublic(uint64(l)) + } return n } @@ -1860,6 +2042,147 @@ func (m *Row) Unmarshal(dAtA []byte) error { } return nil } +func (m *RowIdentifiers) 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: RowIdentifiers: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RowIdentifiers: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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.Rows = append(m.Rows, 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 > l { + return io.ErrUnexpectedEOF + } + 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.Rows = append(m.Rows, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field Rows", wireType) + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Keys", 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 > l { + return io.ErrUnexpectedEOF + } + m.Keys = append(m.Keys, 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) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *Pair) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1977,7 +2300,7 @@ func (m *Pair) Unmarshal(dAtA []byte) error { } return nil } -func (m *GroupLine) Unmarshal(dAtA []byte) error { +func (m *FieldRow) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2000,15 +2323,15 @@ func (m *GroupLine) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GroupLine: wiretype end group for non-group") + return fmt.Errorf("proto: FieldRow: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GroupLine: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: FieldRow: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Groups", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Field", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2033,13 +2356,13 @@ func (m *GroupLine) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Groups = append(m.Groups, string(dAtA[iNdEx:postIndex])) + m.Field = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RowID", wireType) } - m.Total = 0 + m.RowID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPublic @@ -2049,7 +2372,107 @@ func (m *GroupLine) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Total |= (uint64(b) & 0x7F) << shift + m.RowID |= (uint64(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) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GroupCount) 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: GroupCount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GroupCount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Group", 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 > l { + return io.ErrUnexpectedEOF + } + m.Group = append(m.Group, &FieldRow{}) + if err := m.Group[len(m.Group)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) + } + m.Count = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPublic + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Count |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } @@ -3267,7 +3690,7 @@ func (m *QueryResult) Unmarshal(dAtA []byte) error { } case 8: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GroupByCounts", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field GroupCounts", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3291,8 +3714,41 @@ func (m *QueryResult) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.GroupByCounts = append(m.GroupByCounts, &GroupLine{}) - if err := m.GroupByCounts[len(m.GroupByCounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.GroupCounts = append(m.GroupCounts, &GroupCount{}) + if err := m.GroupCounts[len(m.GroupCounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RowIdentifiers", 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 > l { + return io.ErrUnexpectedEOF + } + if m.RowIdentifiers == nil { + m.RowIdentifiers = &RowIdentifiers{} + } + if err := m.RowIdentifiers.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4076,53 +4532,56 @@ var ( func init() { proto.RegisterFile("public.proto", fileDescriptorPublic) } var fileDescriptorPublic = []byte{ - // 760 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcd, 0x6e, 0xd3, 0x4a, - 0x14, 0xbe, 0x13, 0x3b, 0x89, 0x73, 0xd2, 0xe4, 0x56, 0x73, 0xef, 0xed, 0xb5, 0x50, 0x15, 0x2c, - 0x0b, 0x21, 0xaf, 0x52, 0x29, 0xac, 0xba, 0x01, 0x91, 0xfe, 0xa0, 0xa8, 0x50, 0xc1, 0xb4, 0x14, - 0xb1, 0x74, 0x9b, 0x51, 0x6b, 0xc9, 0xf1, 0x18, 0x7b, 0xac, 0x34, 0xcf, 0xd1, 0x0d, 0x8f, 0xc0, - 0x82, 0x07, 0xe9, 0x92, 0x47, 0x80, 0xf2, 0x22, 0x68, 0xce, 0x78, 0x62, 0x27, 0x95, 0x2a, 0x16, - 0xec, 0xfc, 0x7d, 0x67, 0xe6, 0xcc, 0xf9, 0xce, 0x9f, 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c, 0x78, 0x3c, - 0xc5, 0x84, 0x74, 0x98, 0x06, 0x8a, 0xc5, 0xfe, 0xc3, 0x7e, 0xb3, 0x99, 0x06, 0xb5, 0x30, 0xed, - 0x95, 0x30, 0xb7, 0xa1, 0x63, 0x36, 0x48, 0xee, 0x36, 0xd1, 0x54, 0x11, 0x6a, 0xa2, 0x96, 0x2b, - 0x44, 0xb5, 0xa0, 0x15, 0x58, 0xac, 0xc6, 0xa8, 0xd4, 0x32, 0x31, 0xc7, 0x95, 0xdb, 0xc6, 0x7d, - 0x68, 0xa0, 0xba, 0xa9, 0xdd, 0xa0, 0xd1, 0x41, 0x63, 0x8d, 0xf1, 0xbf, 0x12, 0xa0, 0x5a, 0x23, - 0xce, 0xe6, 0x9f, 0x13, 0xfa, 0xb0, 0xa0, 0x2d, 0x68, 0xe1, 0x7b, 0x46, 0x4c, 0x89, 0xd6, 0xc2, - 0x6d, 0xaf, 0x87, 0x3b, 0xde, 0xbc, 0xbd, 0x1b, 0x90, 0x6f, 0x77, 0x03, 0xf2, 0xfd, 0x6e, 0x40, - 0x3e, 0xff, 0x1c, 0xfc, 0x75, 0xde, 0xc2, 0x5f, 0xd8, 0xb3, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, - 0x22, 0x44, 0x8c, 0x98, 0xd2, 0x06, 0x00, 0x00, + // 804 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcb, 0x6e, 0xdb, 0x46, + 0x14, 0xed, 0x88, 0x94, 0x44, 0x5d, 0x59, 0xaa, 0x31, 0x70, 0x5d, 0xa2, 0x30, 0x54, 0x82, 0x28, + 0x0a, 0xae, 0x64, 0x40, 0x05, 0x8c, 0xae, 0xfa, 0xf0, 0xab, 0x10, 0xdc, 0x1a, 0xcd, 0xd8, 0x71, + 0x90, 0x25, 0x6d, 0x4d, 0x6c, 0x02, 0x14, 0x87, 0xe1, 0x03, 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f, 0x3e, 0x07, 0x00, 0x00, 0xff, 0xff, 0xa6, 0x62, 0xa8, 0x25, + 0x96, 0x07, 0x00, 0x00, } diff --git a/internal/public.proto b/internal/public.proto index f3f362fd1..a102f1088 100644 --- a/internal/public.proto +++ b/internal/public.proto @@ -8,15 +8,26 @@ message Row { repeated Attr Attrs = 2; } +message RowIdentifiers { + repeated uint64 Rows = 1; + repeated string Keys = 2; + //repeated Attr Attrs = 3; +} + message Pair { uint64 ID = 1; string Key = 3; uint64 Count = 2; } -message GroupLine{ - repeated string Groups = 1; - uint64 Total=2; +message FieldRow{ + string Field = 1; + uint64 RowID = 2; +} + +message GroupCount{ + repeated FieldRow Group = 1; + uint64 Count = 2; } message ValCount { @@ -72,7 +83,8 @@ message QueryResult { bool Changed = 4; ValCount ValCount = 5; repeated uint64 RowIDs = 7; - repeated GroupLine GroupByCounts = 8; + repeated GroupCount GroupCounts = 8; + RowIdentifiers RowIdentifiers = 9; } message ImportRequest {