diff --git a/encoding/proto/proto.go b/encoding/proto/proto.go index f796f2f3e..d40db1fb9 100644 --- a/encoding/proto/proto.go +++ b/encoding/proto/proto.go @@ -1147,8 +1147,13 @@ func decodeGroupCounts(a []*internal.GroupCount) []pilosa.GroupCount { 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 + fr := a[i] + other[i].Field = fr.Field + if fr.RowKey == "" { + other[i].RowID = fr.RowID + } else { + other[i].RowKey = fr.RowKey + } } return other } @@ -1226,9 +1231,17 @@ func encodeGroupCounts(counts []pilosa.GroupCount) []*internal.GroupCount { 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, + fr := a[i] + if fr.RowKey == "" { + other[i] = &internal.FieldRow{ + Field: fr.Field, + RowID: fr.RowID, + } + } else { + other[i] = &internal.FieldRow{ + Field: fr.Field, + RowKey: fr.RowKey, + } } } return other diff --git a/executor.go b/executor.go index eea9a76a2..8d29cd900 100644 --- a/executor.go +++ b/executor.go @@ -1000,7 +1000,7 @@ func (fr FieldRow) MarshalJSON() ([]byte, error) { } func (fr FieldRow) String() string { - return fmt.Sprintf("%s.%d", fr.Field, fr.RowID) + return fmt.Sprintf("%s.%d.%s", fr.Field, fr.RowID, fr.RowKey) } type GroupCount struct { diff --git a/executor_test.go b/executor_test.go index 8ac7008ab..c37a0de88 100644 --- a/executor_test.go +++ b/executor_test.go @@ -1907,7 +1907,7 @@ Set(4500001, fn=4) {Group: []pilosa.FieldRow{{Field: "f", RowID: 10}}, Count: 4}, } results := res.Results[0].([]pilosa.GroupCount) - checkGroupBy(t, expected, results) + test.CheckGroupBy(t, expected, results) } }) } @@ -2902,7 +2902,7 @@ func TestExecutor_Execute_GroupBy(t *testing.T) { } results := c.Query(t, "i", `GroupBy(Rows(field=general), Rows(field=sub))`).Results[0].([]pilosa.GroupCount) - checkGroupBy(t, expected, results) + test.CheckGroupBy(t, expected, results) }) t.Run("Filter", func(t *testing.T) { @@ -2912,7 +2912,7 @@ func TestExecutor_Execute_GroupBy(t *testing.T) { } results := c.Query(t, "i", `GroupBy(Rows(field=general), Rows(field=sub), filter=Row(general=10))`).Results[0].([]pilosa.GroupCount) - checkGroupBy(t, expected, results) + test.CheckGroupBy(t, expected, results) }) t.Run("check field offset no limit", func(t *testing.T) { @@ -2922,7 +2922,7 @@ func TestExecutor_Execute_GroupBy(t *testing.T) { } results := c.Query(t, "i", `GroupBy(Rows(field=general, previous=10))`).Results[0].([]pilosa.GroupCount) - checkGroupBy(t, expected, results) + test.CheckGroupBy(t, expected, results) }) t.Run("check field offset limit", func(t *testing.T) { @@ -2931,7 +2931,7 @@ func TestExecutor_Execute_GroupBy(t *testing.T) { } results := c.Query(t, "i", `GroupBy(Rows(field=general, previous=10), limit=1)`).Results[0].([]pilosa.GroupCount) - checkGroupBy(t, expected, results) + test.CheckGroupBy(t, expected, results) }) @@ -2952,7 +2952,7 @@ func TestExecutor_Execute_GroupBy(t *testing.T) { } results := c.Query(t, "i", `GroupBy(Rows(field=a), Rows(field=b), limit=1)`).Results[0].([]pilosa.GroupCount) - checkGroupBy(t, expected, results) + test.CheckGroupBy(t, expected, results) }) // set the same bits in a single shard in three fields @@ -2985,7 +2985,7 @@ func TestExecutor_Execute_GroupBy(t *testing.T) { {Group: []pilosa.FieldRow{{Field: "wa", RowID: 0}, {Field: "wb", RowID: 1}, {Field: "wc", RowID: 0}}, Count: 1}, {Group: []pilosa.FieldRow{{Field: "wa", RowID: 0}, {Field: "wb", RowID: 1}, {Field: "wc", RowID: 1}}, Count: 1}, } - checkGroupBy(t, expected, results) + test.CheckGroupBy(t, expected, results) }) t.Run("test previous is last result", func(t *testing.T) { @@ -3000,7 +3000,7 @@ func TestExecutor_Execute_GroupBy(t *testing.T) { expected := []pilosa.GroupCount{ {Group: []pilosa.FieldRow{{Field: "wa", RowID: 1}, {Field: "wb", RowID: 0}, {Field: "wc", RowID: 0}}, Count: 1}, } - checkGroupBy(t, expected, results) + test.CheckGroupBy(t, expected, results) }) // test multiple shards with distinct results (different rows) and same @@ -3028,7 +3028,7 @@ func TestExecutor_Execute_GroupBy(t *testing.T) { {Group: []pilosa.FieldRow{{Field: "ma", RowID: 1}, {Field: "mb", RowID: 3}}, Count: 1}, {Group: []pilosa.FieldRow{{Field: "ma", RowID: 2}, {Field: "mb", RowID: 0}}, Count: 1}, } - checkGroupBy(t, expected, results) + test.CheckGroupBy(t, expected, results) }) t.Run("distinct rows in different shards with row limit", func(t *testing.T) { @@ -3039,7 +3039,7 @@ func TestExecutor_Execute_GroupBy(t *testing.T) { {Group: []pilosa.FieldRow{{Field: "ma", RowID: 2}, {Field: "mb", RowID: 0}}, Count: 1}, {Group: []pilosa.FieldRow{{Field: "ma", RowID: 3}, {Field: "mb", RowID: 1}}, Count: 1}, } - checkGroupBy(t, expected, results) + test.CheckGroupBy(t, expected, results) }) t.Run("distinct rows in different shards with column arg", func(t *testing.T) { @@ -3050,7 +3050,7 @@ func TestExecutor_Execute_GroupBy(t *testing.T) { {Group: []pilosa.FieldRow{{Field: "ma", RowID: 3}, {Field: "mb", RowID: 1}}, Count: 1}, {Group: []pilosa.FieldRow{{Field: "ma", RowID: 3}, {Field: "mb", RowID: 3}}, Count: 1}, } - checkGroupBy(t, expected, results) + test.CheckGroupBy(t, expected, results) }) c.CreateField(t, "i", pilosa.IndexOptions{}, "na") @@ -3075,7 +3075,7 @@ func TestExecutor_Execute_GroupBy(t *testing.T) { {Group: []pilosa.FieldRow{{Field: "na", RowID: 1}, {Field: "nb", RowID: 0}}, Count: 2}, {Group: []pilosa.FieldRow{{Field: "na", RowID: 1}, {Field: "nb", RowID: 1}}, Count: 2}, } - checkGroupBy(t, expected, results) + test.CheckGroupBy(t, expected, results) }) @@ -3120,8 +3120,43 @@ func TestExecutor_Execute_GroupBy(t *testing.T) { } expected[63].Count = 5 - checkGroupBy(t, expected, totalResults) + test.CheckGroupBy(t, expected, totalResults) }) + + // test row keys + c.CreateField(t, "i", pilosa.IndexOptions{}, "generalk", pilosa.OptFieldKeys()) + c.CreateField(t, "i", pilosa.IndexOptions{}, "subk", pilosa.OptFieldKeys()) + c.Query(t, "i", ` + Set(0, generalk="ten") + Set(1, generalk="ten") + Set(1001, generalk="ten") + Set(2, generalk="eleven") + Set(1002, generalk="eleven") + Set(2, generalk="twelve") + Set(1002, generalk="twelve") + + Set(0, subk="one-hundred") + Set(1, subk="one-hundred") + Set(3, subk="one-hundred") + Set(1001, subk="one-hundred") + Set(2, subk="one-hundred-ten") + Set(0, subk="one-hundred-ten") + `) + + t.Run("test row keys", func(t *testing.T) { + // the execututor returns row IDs when the field has keys, so they should be included in the target. + expected := []pilosa.GroupCount{ + {Group: []pilosa.FieldRow{{Field: "generalk", RowID: 1, RowKey: "ten"}, {Field: "subk", RowID: 1, RowKey: "one-hundred"}}, Count: 3}, + {Group: []pilosa.FieldRow{{Field: "generalk", RowID: 1, RowKey: "ten"}, {Field: "subk", RowID: 2, RowKey: "one-hundred-ten"}}, Count: 1}, + {Group: []pilosa.FieldRow{{Field: "generalk", RowID: 2, RowKey: "eleven"}, {Field: "subk", RowID: 2, RowKey: "one-hundred-ten"}}, Count: 1}, + {Group: []pilosa.FieldRow{{Field: "generalk", RowID: 3, RowKey: "twelve"}, {Field: "subk", RowID: 2, RowKey: "one-hundred-ten"}}, Count: 1}, + } + + results := c.Query(t, "i", `GroupBy(Rows(field="generalk"), Rows(field="subk"))`).Results[0].([]pilosa.GroupCount) + test.CheckGroupBy(t, expected, results) + + }) + } for size := range []int{1, 3} { t.Run(fmt.Sprintf("%d_nodes", size), func(t *testing.T) { @@ -3184,17 +3219,6 @@ func BenchmarkGroupBy(b *testing.B) { } -func checkGroupBy(t *testing.T, expected, results []pilosa.GroupCount) { - if len(results) != len(expected) { - t.Fatalf("number of groupings mismatch:\n got:%+v\nwant:%+v\n", results, expected) - } - for i, result := range results { - if !reflect.DeepEqual(expected[i], result) { - t.Fatalf("unexpected result at %d: \n got:%+v\nwant:%+v\n", i, result, expected[i]) - } - } -} - func runCallTest(t *testing.T, writeQuery string, readQueries []string, indexOptions *pilosa.IndexOptions, fieldOption ...pilosa.FieldOption) []pilosa.QueryResponse { if indexOptions == nil { indexOptions = &pilosa.IndexOptions{} diff --git a/internal/public.pb.go b/internal/public.pb.go index c7378399f..5cd86a833 100644 --- a/internal/public.pb.go +++ b/internal/public.pb.go @@ -35,7 +35,7 @@ func (m *Row) Reset() { *m = Row{} } func (m *Row) String() string { return proto.CompactTextString(m) } func (*Row) ProtoMessage() {} func (*Row) Descriptor() ([]byte, []int) { - return fileDescriptor_public_7d901ba8e84abe50, []int{0} + return fileDescriptor_public_f65cfea24ac19f54, []int{0} } func (m *Row) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -97,7 +97,7 @@ func (m *RowIdentifiers) Reset() { *m = RowIdentifiers{} } func (m *RowIdentifiers) String() string { return proto.CompactTextString(m) } func (*RowIdentifiers) ProtoMessage() {} func (*RowIdentifiers) Descriptor() ([]byte, []int) { - return fileDescriptor_public_7d901ba8e84abe50, []int{1} + return fileDescriptor_public_f65cfea24ac19f54, []int{1} } func (m *RowIdentifiers) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -153,7 +153,7 @@ func (m *Pair) Reset() { *m = Pair{} } func (m *Pair) String() string { return proto.CompactTextString(m) } func (*Pair) ProtoMessage() {} func (*Pair) Descriptor() ([]byte, []int) { - return fileDescriptor_public_7d901ba8e84abe50, []int{2} + return fileDescriptor_public_f65cfea24ac19f54, []int{2} } func (m *Pair) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -206,6 +206,7 @@ func (m *Pair) GetCount() uint64 { 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"` + RowKey string `protobuf:"bytes,3,opt,name=RowKey,proto3" json:"RowKey,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -215,7 +216,7 @@ func (m *FieldRow) Reset() { *m = FieldRow{} } func (m *FieldRow) String() string { return proto.CompactTextString(m) } func (*FieldRow) ProtoMessage() {} func (*FieldRow) Descriptor() ([]byte, []int) { - return fileDescriptor_public_7d901ba8e84abe50, []int{3} + return fileDescriptor_public_f65cfea24ac19f54, []int{3} } func (m *FieldRow) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -258,6 +259,13 @@ func (m *FieldRow) GetRowID() uint64 { return 0 } +func (m *FieldRow) GetRowKey() string { + if m != nil { + return m.RowKey + } + return "" +} + 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"` @@ -270,7 +278,7 @@ func (m *GroupCount) Reset() { *m = GroupCount{} } func (m *GroupCount) String() string { return proto.CompactTextString(m) } func (*GroupCount) ProtoMessage() {} func (*GroupCount) Descriptor() ([]byte, []int) { - return fileDescriptor_public_7d901ba8e84abe50, []int{4} + return fileDescriptor_public_f65cfea24ac19f54, []int{4} } func (m *GroupCount) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -325,7 +333,7 @@ func (m *ValCount) Reset() { *m = ValCount{} } func (m *ValCount) String() string { return proto.CompactTextString(m) } func (*ValCount) ProtoMessage() {} func (*ValCount) Descriptor() ([]byte, []int) { - return fileDescriptor_public_7d901ba8e84abe50, []int{5} + return fileDescriptor_public_f65cfea24ac19f54, []int{5} } func (m *ValCount) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -368,69 +376,6 @@ func (m *ValCount) GetCount() int64 { return 0 } -type Bit struct { - RowID uint64 `protobuf:"varint,1,opt,name=RowID,proto3" json:"RowID,omitempty"` - ColumnID uint64 `protobuf:"varint,2,opt,name=ColumnID,proto3" json:"ColumnID,omitempty"` - Timestamp int64 `protobuf:"varint,3,opt,name=Timestamp,proto3" json:"Timestamp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Bit) Reset() { *m = Bit{} } -func (m *Bit) String() string { return proto.CompactTextString(m) } -func (*Bit) ProtoMessage() {} -func (*Bit) Descriptor() ([]byte, []int) { - return fileDescriptor_public_7d901ba8e84abe50, []int{6} -} -func (m *Bit) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Bit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Bit.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (dst *Bit) XXX_Merge(src proto.Message) { - xxx_messageInfo_Bit.Merge(dst, src) -} -func (m *Bit) XXX_Size() int { - return m.Size() -} -func (m *Bit) XXX_DiscardUnknown() { - xxx_messageInfo_Bit.DiscardUnknown(m) -} - -var xxx_messageInfo_Bit proto.InternalMessageInfo - -func (m *Bit) GetRowID() uint64 { - if m != nil { - return m.RowID - } - return 0 -} - -func (m *Bit) GetColumnID() uint64 { - if m != nil { - return m.ColumnID - } - return 0 -} - -func (m *Bit) GetTimestamp() int64 { - if m != nil { - return m.Timestamp - } - 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"` @@ -444,7 +389,7 @@ 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_public_7d901ba8e84abe50, []int{7} + return fileDescriptor_public_f65cfea24ac19f54, []int{6} } func (m *ColumnAttrSet) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -510,7 +455,7 @@ 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_public_7d901ba8e84abe50, []int{8} + return fileDescriptor_public_f65cfea24ac19f54, []int{7} } func (m *Attr) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -592,7 +537,7 @@ 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_public_7d901ba8e84abe50, []int{9} + return fileDescriptor_public_f65cfea24ac19f54, []int{8} } func (m *AttrMap) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -644,7 +589,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_public_7d901ba8e84abe50, []int{10} + return fileDescriptor_public_f65cfea24ac19f54, []int{9} } func (m *QueryRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -728,7 +673,7 @@ 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_public_7d901ba8e84abe50, []int{11} + return fileDescriptor_public_f65cfea24ac19f54, []int{10} } func (m *QueryResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -797,7 +742,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_public_7d901ba8e84abe50, []int{12} + return fileDescriptor_public_f65cfea24ac19f54, []int{11} } func (m *QueryResult) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -907,7 +852,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_public_7d901ba8e84abe50, []int{13} + return fileDescriptor_public_f65cfea24ac19f54, []int{12} } func (m *ImportRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1008,7 +953,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_public_7d901ba8e84abe50, []int{14} + return fileDescriptor_public_f65cfea24ac19f54, []int{13} } func (m *ImportValueRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1092,7 +1037,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_public_7d901ba8e84abe50, []int{15} + return fileDescriptor_public_f65cfea24ac19f54, []int{14} } func (m *TranslateKeysRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1153,7 +1098,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_public_7d901ba8e84abe50, []int{16} + return fileDescriptor_public_f65cfea24ac19f54, []int{15} } func (m *TranslateKeysResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1201,7 +1146,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_public_7d901ba8e84abe50, []int{17} + return fileDescriptor_public_f65cfea24ac19f54, []int{16} } func (m *ImportRoaringRequestView) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1256,7 +1201,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_public_7d901ba8e84abe50, []int{18} + return fileDescriptor_public_f65cfea24ac19f54, []int{17} } func (m *ImportRoaringRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1306,7 +1251,6 @@ func init() { 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") proto.RegisterType((*Attr)(nil), "internal.Attr") proto.RegisterType((*AttrMap)(nil), "internal.AttrMap") @@ -1501,6 +1445,12 @@ func (m *FieldRow) MarshalTo(dAtA []byte) (int, error) { i++ i = encodeVarintPublic(dAtA, i, uint64(m.RowID)) } + if len(m.RowKey) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintPublic(dAtA, i, uint64(len(m.RowKey))) + i += copy(dAtA[i:], m.RowKey) + } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) } @@ -1576,42 +1526,6 @@ func (m *ValCount) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *Bit) 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 *Bit) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RowID != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintPublic(dAtA, i, uint64(m.RowID)) - } - if m.ColumnID != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintPublic(dAtA, i, uint64(m.ColumnID)) - } - if m.Timestamp != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintPublic(dAtA, i, uint64(m.Timestamp)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - func (m *ColumnAttrSet) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2465,6 +2379,10 @@ func (m *FieldRow) Size() (n int) { if m.RowID != 0 { n += 1 + sovPublic(uint64(m.RowID)) } + l = len(m.RowKey) + if l > 0 { + n += 1 + l + sovPublic(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2510,27 +2428,6 @@ func (m *ValCount) Size() (n int) { return n } -func (m *Bit) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RowID != 0 { - n += 1 + sovPublic(uint64(m.RowID)) - } - if m.ColumnID != 0 { - n += 1 + sovPublic(uint64(m.ColumnID)) - } - if m.Timestamp != 0 { - n += 1 + sovPublic(uint64(m.Timestamp)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - func (m *ColumnAttrSet) Size() (n int) { if m == nil { return 0 @@ -3451,6 +3348,35 @@ func (m *FieldRow) Unmarshal(dAtA []byte) error { break } } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RowKey", 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.RowKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPublic(dAtA[iNdEx:]) @@ -3663,114 +3589,6 @@ func (m *ValCount) Unmarshal(dAtA []byte) error { } return nil } -func (m *Bit) 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: Bit: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Bit: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RowID", wireType) - } - m.RowID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RowID |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ColumnID", wireType) - } - m.ColumnID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ColumnID |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) - } - m.Timestamp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Timestamp |= (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) > 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 *ColumnAttrSet) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -6167,65 +5985,63 @@ var ( ErrIntOverflowPublic = fmt.Errorf("proto: integer overflow") ) -func init() { proto.RegisterFile("public.proto", fileDescriptor_public_7d901ba8e84abe50) } +func init() { proto.RegisterFile("public.proto", fileDescriptor_public_f65cfea24ac19f54) } -var fileDescriptor_public_7d901ba8e84abe50 = []byte{ - // 902 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xdf, 0x8e, 0xdb, 0xc4, - 0x17, 0xfe, 0x4d, 0xec, 0x24, 0xce, 0xc9, 0x26, 0xbf, 0x6a, 0x94, 0x16, 0x0b, 0x55, 0x21, 0xb2, - 0x10, 0x32, 0x37, 0x5b, 0x29, 0x48, 0x55, 0xaf, 0xf8, 0xb3, 0xdd, 0x2d, 0x8a, 0x0a, 0x2b, 0x98, - 0x5d, 0x82, 0xb8, 0x9c, 0x36, 0xd3, 0xd6, 0x92, 0xe3, 0x09, 0xf6, 0x98, 0x74, 0x9f, 0x83, 0x1b, - 0x1e, 0x81, 0x0b, 0x1e, 0xa4, 0x97, 0x88, 0x27, 0x80, 0xe5, 0x45, 0xd0, 0x39, 0xe3, 0xc9, 0x38, - 0xd9, 0xa5, 0x42, 0x88, 0xbb, 0xf9, 0xce, 0x99, 0x73, 0xfc, 0x7d, 0x73, 0xfe, 0x24, 0x70, 0xb4, - 0xa9, 0x9f, 0xe5, 0xd9, 0xf3, 0xe3, 0x4d, 0xa9, 0x8d, 0xe6, 0x51, 0x56, 0x18, 0x55, 0x16, 0x32, - 0x4f, 0xbe, 0x83, 0x40, 0xe8, 0x2d, 0x8f, 0xa1, 0xff, 0x58, 0xe7, 0xf5, 0xba, 0xa8, 0x62, 0x36, - 0x0b, 0xd2, 0x50, 0x38, 0xc8, 0xdf, 0x87, 0xee, 0x67, 0xc6, 0x94, 0x55, 0xdc, 0x99, 0x05, 0xe9, - 0x70, 0x3e, 0x3e, 0x76, 0xa1, 0xc7, 0x68, 0x16, 0xd6, 0xc9, 0x39, 0x84, 0x4f, 0xd5, 0x55, 0x15, - 0x07, 0xb3, 0x20, 0x1d, 0x08, 0x3a, 0x27, 0x8f, 0x60, 0x2c, 0xf4, 0x76, 0xb1, 0x52, 0x85, 0xc9, - 0x5e, 0x64, 0xca, 0xde, 0x12, 0x7a, 0xeb, 0x3e, 0x41, 0xe7, 0x5d, 0x64, 0xa7, 0x15, 0xf9, 0x31, - 0x84, 0x5f, 0xc9, 0xac, 0xe4, 0x63, 0xe8, 0x2c, 0x4e, 0x63, 0x36, 0x63, 0x69, 0x28, 0x3a, 0x8b, - 0x53, 0x3e, 0x81, 0xee, 0x63, 0x5d, 0x17, 0x26, 0xee, 0x90, 0xc9, 0x02, 0x7e, 0x07, 0x82, 0xa7, - 0xea, 0x2a, 0x0e, 0x66, 0x2c, 0x1d, 0x08, 0x3c, 0x26, 0x0f, 0x21, 0x7a, 0x92, 0xa9, 0x7c, 0x85, - 0xca, 0x26, 0xd0, 0xa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 0xaa, 0x15, - 0xf5, 0x53, 0x24, 0x1c, 0xe4, 0xc7, 0x7e, 0x3e, 0xa9, 0x00, 0x7b, 0x23, 0xee, 0x3c, 0xc2, 0xcf, - 0xb0, 0x6b, 0x68, 0xac, 0xc5, 0xa8, 0x69, 0x68, 0x2c, 0x21, 0xce, 0x26, 0x3e, 0x3c, 0x15, 0xdf, - 0x22, 0xfe, 0x10, 0x86, 0x7e, 0x93, 0x54, 0x71, 0x44, 0x0c, 0x27, 0x3e, 0xbd, 0x77, 0x8a, 0xf6, - 0x45, 0xfe, 0xe9, 0xe1, 0xce, 0x8c, 0x07, 0xc4, 0x2c, 0xde, 0x7b, 0x8d, 0x96, 0x5f, 0x1c, 0xdc, - 0x4f, 0xfe, 0x60, 0x30, 0x5a, 0xac, 0x37, 0xba, 0x34, 0xad, 0xb6, 0x5d, 0x14, 0x2b, 0xf5, 0xda, - 0xb5, 0x2d, 0x01, 0xbf, 0x17, 0x3b, 0x07, 0x7b, 0x91, 0xda, 0x97, 0xda, 0x35, 0x14, 0x16, 0xb4, - 0x54, 0x86, 0x7b, 0x2a, 0xef, 0xc3, 0xc0, 0x2d, 0xa0, 0x2a, 0xee, 0x92, 0xcb, 0x1b, 0x70, 0x20, - 0x77, 0x1b, 0x08, 0x3b, 0x38, 0x48, 0x03, 0xd1, 0xb2, 0x60, 0x65, 0x84, 0xde, 0xd2, 0xf2, 0xef, - 0xd3, 0xf2, 0x77, 0x10, 0x23, 0x6d, 0x1a, 0x72, 0x46, 0xe4, 0x6c, 0x59, 0x92, 0x5f, 0x18, 0x70, - 0xab, 0x91, 0x46, 0xfb, 0xbf, 0x13, 0xfa, 0x76, 0x41, 0xf7, 0xa0, 0x47, 0xdf, 0x73, 0x62, 0x1a, - 0x74, 0x40, 0xb7, 0x7f, 0x83, 0xee, 0x12, 0x26, 0x97, 0xa5, 0x2c, 0xaa, 0x5c, 0x1a, 0x85, 0x86, - 0x7f, 0xc3, 0xf7, 0xb6, 0x1f, 0xd8, 0x0f, 0xe1, 0xee, 0x41, 0x5e, 0x3f, 0xdc, 0x28, 0x20, 0x20, - 0x01, 0x78, 0x4c, 0x4e, 0x20, 0x6e, 0x9a, 0x42, 0x4b, 0x5c, 0xb6, 0x0d, 0x85, 0x65, 0xa6, 0xb6, - 0x98, 0xfa, 0x5c, 0xae, 0x55, 0xc3, 0x82, 0xce, 0x68, 0x3b, 0x95, 0x46, 0x12, 0x87, 0x23, 0x41, - 0xe7, 0xe4, 0x05, 0x4c, 0x6e, 0xcb, 0x41, 0xbf, 0x64, 0xb9, 0x92, 0x76, 0x99, 0x44, 0xc2, 0x02, - 0xfe, 0x08, 0xba, 0x3f, 0x64, 0x6a, 0xeb, 0x96, 0x49, 0xe2, 0x1b, 0xf8, 0xef, 0x88, 0x08, 0x1b, - 0x70, 0x72, 0xe7, 0xcd, 0xf5, 0x94, 0xfd, 0x7a, 0x3d, 0x65, 0xbf, 0x5f, 0x4f, 0xd9, 0x4f, 0x7f, - 0x4e, 0xff, 0xf7, 0xac, 0x47, 0xff, 0x5a, 0x3e, 0xfa, 0x2b, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x8e, - 0x85, 0x07, 0xc5, 0x08, 0x00, 0x00, +var fileDescriptor_public_f65cfea24ac19f54 = []byte{ + // 880 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcd, 0x8e, 0x1b, 0x45, + 0x10, 0xa6, 0x3d, 0x63, 0x7b, 0x5c, 0x5e, 0x9b, 0xa8, 0xe5, 0x84, 0x11, 0x8a, 0x8c, 0x35, 0x42, + 0x68, 0xb8, 0x6c, 0x24, 0x23, 0xa1, 0x9c, 0xf8, 0xd9, 0x78, 0x83, 0xac, 0xc0, 0x0a, 0x6a, 0x57, + 0x46, 0x1c, 0x3b, 0x71, 0x27, 0x19, 0x69, 0x3c, 0x6d, 0x66, 0x7a, 0x70, 0xf6, 0x39, 0x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, 0xdb, 0x26, 0x85, 0x55, 0x26, 0x77, 0x26, 0xf4, 0x99, 0xd8, 0xc8, 0x26, + 0x0b, 0x92, 0x8d, 0x6e, 0x21, 0xb4, 0xa0, 0x1c, 0x8e, 0x90, 0xe4, 0xe4, 0x39, 0x4c, 0x6e, 0x8b, + 0x41, 0x3f, 0x39, 0xb9, 0x14, 0xf6, 0x98, 0x44, 0x68, 0x01, 0x7f, 0x08, 0xdd, 0x9f, 0x32, 0xb9, + 0x73, 0xc7, 0x24, 0xf1, 0x03, 0xfc, 0x6f, 0x89, 0xa0, 0x75, 0x38, 0xb9, 0xf3, 0xfa, 0x6a, 0xca, + 0x7e, 0xbf, 0x9a, 0xb2, 0x3f, 0xaf, 0xa6, 0xec, 0x97, 0xbf, 0xa7, 0xef, 0x3c, 0xed, 0xd1, 0xdf, + 0x8e, 0x4f, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0x9f, 0x87, 0xba, 0x9b, 0x86, 0x08, 0x00, 0x00, } diff --git a/internal/public.proto b/internal/public.proto index d44dd2108..592874b95 100644 --- a/internal/public.proto +++ b/internal/public.proto @@ -22,6 +22,7 @@ message Pair { message FieldRow{ string Field = 1; uint64 RowID = 2; + string RowKey = 3; } message GroupCount{ @@ -34,12 +35,6 @@ message ValCount { int64 Count = 2; } -message Bit { - uint64 RowID = 1; - uint64 ColumnID = 2; - int64 Timestamp = 3; -} - message ColumnAttrSet { uint64 ID = 1; string Key = 3; diff --git a/server/server_test.go b/server/server_test.go index 044ae4720..a2fb5b5d7 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -30,14 +30,13 @@ import ( "testing/quick" "time" - "golang.org/x/sync/errgroup" - "github.com/pelletier/go-toml" "github.com/pilosa/pilosa" "github.com/pilosa/pilosa/http" "github.com/pilosa/pilosa/roaring" "github.com/pilosa/pilosa/server" "github.com/pilosa/pilosa/test" + "golang.org/x/sync/errgroup" ) var runStress bool @@ -248,6 +247,59 @@ func TestMain_SetColumnAttrs(t *testing.T) { } } +func TestMain_GroupBy(t *testing.T) { + m := test.MustRunCommand() + 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) + } + if err := client.CreateFieldWithOptions(context.Background(), "i", "generalk", pilosa.FieldOptions{Keys: true}); err != nil { + t.Fatal(err) + } + if err := client.CreateFieldWithOptions(context.Background(), "i", "subk", pilosa.FieldOptions{Keys: true}); err != nil { + t.Fatal(err) + } + + query := ` + Set(0, generalk="ten") + Set(1, generalk="ten") + Set(1001, generalk="ten") + Set(2, generalk="eleven") + Set(1002, generalk="eleven") + Set(2, generalk="twelve") + Set(1002, generalk="twelve") + + Set(0, subk="one-hundred") + Set(1, subk="one-hundred") + Set(3, subk="one-hundred") + Set(1001, subk="one-hundred") + Set(2, subk="one-hundred-ten") + Set(0, subk="one-hundred-ten") + ` + + // Set columns on row. + if _, err := m.Query("i", "", query); err != nil { + t.Fatal(err) + } + + expected := []pilosa.GroupCount{ + {Group: []pilosa.FieldRow{{Field: "generalk", RowKey: "ten"}, {Field: "subk", RowKey: "one-hundred"}}, Count: 3}, + {Group: []pilosa.FieldRow{{Field: "generalk", RowKey: "ten"}, {Field: "subk", RowKey: "one-hundred-ten"}}, Count: 1}, + {Group: []pilosa.FieldRow{{Field: "generalk", RowKey: "eleven"}, {Field: "subk", RowKey: "one-hundred-ten"}}, Count: 1}, + {Group: []pilosa.FieldRow{{Field: "generalk", RowKey: "twelve"}, {Field: "subk", RowKey: "one-hundred-ten"}}, Count: 1}, + } + + // Query row. + if res, err := m.QueryProtobuf("i", `GroupBy(Rows(field="generalk"), Rows(field="subk"))`); err != nil { + t.Fatal(err) + } else { + test.CheckGroupBy(t, expected, res.Results[0].([]pilosa.GroupCount)) + } +} + // Ensure the host can be parsed. func TestConfig_Parse_Host(t *testing.T) { if c, err := ParseConfig(`bind = "local"`); err != nil { diff --git a/test/pilosa.go b/test/pilosa.go index e3858f5e0..31e93bb1d 100644 --- a/test/pilosa.go +++ b/test/pilosa.go @@ -22,12 +22,14 @@ import ( gohttp "net/http" "os" "path" + "reflect" "strconv" "strings" "testing" "time" "github.com/pilosa/pilosa" + "github.com/pilosa/pilosa/encoding/proto" "github.com/pilosa/pilosa/http" "github.com/pilosa/pilosa/server" "github.com/pkg/errors" @@ -185,6 +187,49 @@ func (m *Command) Query(index, rawQuery, query string) (string, error) { return resp.Body, nil } +func (m *Command) QueryProtobuf(indexName string, query string) (*pilosa.QueryResponse, error) { + var ser proto.Serializer + queryReq := &pilosa.QueryRequest{ + Index: indexName, + Query: query, + } + body, err := ser.Marshal(queryReq) + if err != nil { + return nil, err + } + + req, err := gohttp.NewRequest( + "POST", + fmt.Sprintf("%s/index/%s/query", m.URL(), indexName), + bytes.NewReader(body), + ) + if err != nil { + return nil, err + } + + req.Header.Set("Content-Type", "application/x-protobuf") + req.Header.Set("Accept", "application/x-protobuf") + + resp, err := gohttp.DefaultClient.Do(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + buf, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + response := &pilosa.QueryResponse{} + err = ser.Unmarshal(buf, response) + if err != nil { + return nil, err + } + + return response, nil +} + // RecalculateCaches is deprecated. Use MustRecalculateCaches. func (m *Command) RecalculateCaches() error { resp := MustDo("POST", fmt.Sprintf("%s/recalculate-caches", m.URL()), "") @@ -380,6 +425,17 @@ func MustDo(method, urlStr string, body string) *httpResponse { return &httpResponse{Response: resp, Body: string(buf)} } +func CheckGroupBy(t *testing.T, expected, results []pilosa.GroupCount) { + if len(results) != len(expected) { + t.Fatalf("number of groupings mismatch:\n got:%+v\nwant:%+v\n", results, expected) + } + for i, result := range results { + if !reflect.DeepEqual(expected[i], result) { + t.Fatalf("unexpected result at %d: \n got:%+v\nwant:%+v\n", i, result, expected[i]) + } + } +} + // httpResponse is a wrapper for http.Response that holds the Body as a string. type httpResponse struct { *gohttp.Response