diff --git a/encoding/proto/proto.go b/encoding/proto/proto.go index 1631e47dd..ec3e3c950 100644 --- a/encoding/proto/proto.go +++ b/encoding/proto/proto.go @@ -1453,6 +1453,8 @@ func (s Serializer) decodeRow(pr *internal.Row) *pilosa.Row { } r.Attrs = s.decodeAttrs(pr.Attrs) r.Keys = pr.Keys + r.Index = pr.Index + r.Field = pr.Field return r } @@ -1700,6 +1702,8 @@ func (s Serializer) encodeRow(r *pilosa.Row) *internal.Row { ir := &internal.Row{ Keys: r.Keys, Attrs: s.encodeAttrs(r.Attrs), + Index: r.Index, + Field: r.Field, } if s.RoaringRows { ir.Roaring = r.Roaring() diff --git a/executor.go b/executor.go index ae52457c7..1910d42e8 100644 --- a/executor.go +++ b/executor.go @@ -361,7 +361,7 @@ func (e *executor) readColumnAttrSets(index *Index, ids []uint64) ([]*ColumnAttr } // handlePreCalls traverses the call tree looking for calls that need -// precomputed values. Right now, that's just Distinct. +// 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 { if c.Name == "Precomputed" { idx := c.Args["valueidx"].(int64) @@ -1080,8 +1080,9 @@ func (e *executor) executeSum(ctx context.Context, qcx *Qcx, index string, c *pq return other, nil } -// executeDistinct executes a Distinct call on a field. -func (e *executor) executeDistinct(ctx context.Context, qcx *Qcx, index string, c *pql.Call, shards []uint64, opt *execOptions) (SignedRow, error) { +// executeDistinct executes a Distinct call on a field. It returns a +// SignedRow for int fields and a *Row for set/mutex/time fields. +func (e *executor) executeDistinct(ctx context.Context, qcx *Qcx, index string, c *pql.Call, shards []uint64, opt *execOptions) (interface{}, error) { span, ctx := tracing.StartSpanFromContext(ctx, "Executor.executeDistinct") defer span.Finish() @@ -1099,21 +1100,31 @@ func (e *executor) executeDistinct(ctx context.Context, qcx *Qcx, index string, // Merge returned results at coordinating node. reduceFn := func(ctx context.Context, prev, v interface{}) interface{} { - other, _ := prev.(SignedRow) if err := ctx.Err(); err != nil { return err } - return other.union(v.(SignedRow)) + switch other := prev.(type) { + case SignedRow: + return other.union(v.(SignedRow)) + case *Row: + return other.Union(v.(*Row)) + case nil: + return v + default: + return errors.Errorf("unexpected return type from executeDistinctShard: %+v %T", other, other) + } } result, err := e.mapReduce(ctx, index, shards, c, opt, mapFn, reduceFn) if err != nil { - return SignedRow{}, err + return nil, err } - other, _ := result.(SignedRow) - other.field = field - return other, nil + if other, ok := result.(SignedRow); ok { + other.field = field + } + + return result, nil } // executeMin executes a Min() call. @@ -1302,7 +1313,7 @@ func (e *executor) executeBitmapCall(ctx context.Context, qcx *Qcx, index string reduceFn := func(ctx context.Context, prev, v interface{}) interface{} { other, _ := prev.(*Row) if other == nil { - + // TODO... what's going on on the following line other = NewRow() // bug! this row ends up containing Badger Txn data that should be accessed outside the Txn. } if err := ctx.Err(); err != nil { @@ -1398,14 +1409,23 @@ func (e *executor) executeBitmapCallShard(ctx context.Context, qcx *Qcx, index s // executeDistinctShard executes a Distinct call on a single shard, yielding // a SignedRow of the values found. -func (e *executor) executeDistinctShard(ctx context.Context, qcx *Qcx, index string, fieldName string, c *pql.Call, shard uint64) (result SignedRow, err error) { +func (e *executor) executeDistinctShard(ctx context.Context, qcx *Qcx, index string, fieldName string, c *pql.Call, shard uint64) (result interface{}, err error) { span, ctx := tracing.StartSpanFromContext(ctx, "Executor.executeDistinctShard") defer span.Finish() idx := e.Holder.Index(index) field := e.Holder.Field(index, fieldName) if field == nil { - return SignedRow{}, ErrFieldNotFound + return nil, ErrFieldNotFound + } + bsig := field.bsiGroup(fieldName) + if bsig == nil { + result = &Row{ + Index: index, + Field: fieldName, + } + } else { + result = SignedRow{} } var filter *Row @@ -1427,28 +1447,27 @@ func (e *executor) executeDistinctShard(ctx context.Context, qcx *Qcx, index str // can go ahead and save time by returning the empty results, // because the filter excluded everything. if filterBitmap == nil || !filterBitmap.Any() { - return SignedRow{}, nil + return result, nil } } - bsig := field.bsiGroup(fieldName) if bsig == nil { return executeDistinctShardSet(ctx, qcx, idx, fieldName, shard, filterBitmap) } return executeDistinctShardBSI(ctx, qcx, idx, fieldName, shard, bsig, filterBitmap) } -func executeDistinctShardSet(ctx context.Context, qcx *Qcx, idx *Index, fieldName string, shard uint64, filterBitmap *roaring.Bitmap) (result SignedRow, err0 error) { +func executeDistinctShardSet(ctx context.Context, qcx *Qcx, idx *Index, fieldName string, shard uint64, filterBitmap *roaring.Bitmap) (result *Row, err0 error) { index := idx.Name() tx, finisher, err := qcx.GetTx(Txo{Write: !writable, Index: idx, Shard: shard}) if err != nil { - return SignedRow{}, err + return nil, err } defer finisher(&err0) fragData, _, err := tx.ContainerIterator(index, fieldName, "standard", shard, 0) if err != nil { - return SignedRow{}, errors.Wrap(err, "getting fragment data") + return nil, errors.Wrap(err, "getting fragment data") } defer fragData.Close() // We can't grab the containers "for each row" from the set-type field, @@ -1486,20 +1505,22 @@ func executeDistinctShardSet(ctx context.Context, qcx *Qcx, idx *Index, fieldNam if roaring.IntersectionAny(c, filter[k%(1<= 0; i-- { - val, err := toNegInt64(negs[i]) - if err != nil { - return errors.Wrap(err, "converting uint64 to int64 (negative)") - } + if s.Neg != nil { + negs := s.Neg.Columns() + for i := len(negs) - 1; i >= 0; i-- { + val, err := toNegInt64(negs[i]) + if err != nil { + return errors.Wrap(err, "converting uint64 to int64 (negative)") + } - if err := callback(&pb.RowResponse{ - Headers: ci, - Columns: []*pb.ColumnResponse{ - &pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_Int64Val{Int64Val: val}}, - }, - }); err != nil { - return errors.Wrap(err, "calling callback") + if err := callback(&pb.RowResponse{ + Headers: ci, + Columns: []*pb.ColumnResponse{ + &pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_Int64Val{Int64Val: val}}, + }, + }); err != nil { + return errors.Wrap(err, "calling callback") + } + ci = nil } - ci = nil } - for _, id := range s.Pos.Columns() { - val, err := toInt64(id) - if err != nil { - return errors.Wrap(err, "converting uint64 to int64 (positive)") - } + if s.Pos != nil { + for _, id := range s.Pos.Columns() { + val, err := toInt64(id) + if err != nil { + return errors.Wrap(err, "converting uint64 to int64 (positive)") + } - if err := callback(&pb.RowResponse{ - Headers: ci, - Columns: []*pb.ColumnResponse{ - &pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_Int64Val{Int64Val: val}}, - }, - }); err != nil { - return errors.Wrap(err, "calling callback") + if err := callback(&pb.RowResponse{ + Headers: ci, + Columns: []*pb.ColumnResponse{ + &pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_Int64Val{Int64Val: val}}, + }, + }); err != nil { + return errors.Wrap(err, "calling callback") + } + ci = nil } - ci = nil } return nil } diff --git a/executor_test.go b/executor_test.go index 11a774014..a20d60495 100644 --- a/executor_test.go +++ b/executor_test.go @@ -17,9 +17,11 @@ package pilosa_test import ( "bytes" "context" + "encoding/csv" "encoding/json" "flag" "fmt" + "io" "io/ioutil" "math" "math/rand" @@ -37,6 +39,7 @@ import ( "github.com/pilosa/pilosa/v2/boltdb" "github.com/pilosa/pilosa/v2/http" "github.com/pilosa/pilosa/v2/pql" + "github.com/pilosa/pilosa/v2/proto" "github.com/pilosa/pilosa/v2/server" "github.com/pilosa/pilosa/v2/test" "github.com/pilosa/pilosa/v2/testhook" @@ -5434,9 +5437,9 @@ func TestExecutor_ForeignIndex(t *testing.T) { if !sameStringSlice(distinct.Pos.Keys, []string{"one", "two", "twenty-one"}) { t.Fatalf("unexpected keys: %v", distinct.Pos.Keys) } - distinct = c.Query(t, "child", `Distinct(index="child", field="parent_set_id")`).Results[0].(pilosa.SignedRow) - if !sameStringSlice(distinct.Pos.Keys, []string{"one", "two", "twenty-one"}) { - t.Fatalf("unexpected keys: %v", distinct.Pos.Keys) + row := c.Query(t, "child", `Distinct(index="child", field="parent_set_id")`).Results[0].(*pilosa.Row) + if !sameStringSlice(row.Keys, []string{"one", "two", "twenty-one"}) { + t.Fatalf("unexpected keys: %v", row.Keys) } eq := c.Query(t, "child", `Row(parent_id=="one")`).Results[0].(*pilosa.Row) @@ -6512,7 +6515,6 @@ func TestExecutor_BareDistinct(t *testing.T) { c.CreateField(t, "i", pilosa.IndexOptions{}, "ints", pilosa.OptFieldTypeInt(0, math.MaxInt64), ) - c.CreateField(t, "i", pilosa.IndexOptions{}, "set") c.CreateField(t, "i", pilosa.IndexOptions{}, "filter") // Populate integer data. @@ -6521,17 +6523,13 @@ func TestExecutor_BareDistinct(t *testing.T) { Set(%d, ints=2) `, ShardWidth)) c.Query(t, "i", fmt.Sprintf(` - Set(0, set=1) - Set(1, set=2) - Set(%d, set=2) Set(0, filter=1) Set(%d, filter=1) - `, 65537, 65537)) + `, 65537)) for _, pql := range []string{ `Distinct(field="ints")`, `Distinct(index="i", field="ints")`, - `Distinct(Row(filter=1), field="set")`, } { exp := []uint64{1, 2} res := c.Query(t, "i", pql).Results[0].(pilosa.SignedRow) @@ -6742,3 +6740,281 @@ func TestMissingKeyRegression(t *testing.T) { }) } } + +// TestVariousQueries has originally been written to test out a +// variety of scenarios with Distinct, but it's structure is more +// general purpose. My vision is to eventually have any test which +// needs to test a single query be in here, and have a robust enough +// test data set loaded at the start which covers what we want to +// test. +// +// I'd also like to have it automatically run a matrix of scenarios +// (single and multi-node clusters, different endpoints for the +// queries (HTTP, GRPC, Postgres), etc.). +func TestVariousQueries(t *testing.T) { + c := test.MustRunCluster(t, 3) + defer c.Close() + + // Create and populate "likenums" similar to "likes", but without keys on the field. + c.CreateField(t, "users", pilosa.IndexOptions{Keys: true, TrackExistence: true}, "likenums") + c.ImportIDKey(t, "users", "likenums", []test.KeyID{ + {ID: 1, Key: "userA"}, + {ID: 2, Key: "userB"}, + {ID: 3, Key: "userC"}, + {ID: 4, Key: "userD"}, + {ID: 5, Key: "userE"}, + {ID: 6, Key: "userF"}, + {ID: 7, Key: "userA"}, + {ID: 7, Key: "userB"}, + {ID: 7, Key: "userC"}, + {ID: 7, Key: "userD"}, + {ID: 7, Key: "userE"}, + {ID: 7, Key: "userF"}, + }) + + // Create and populate "likes" field. + c.CreateField(t, "users", pilosa.IndexOptions{Keys: true, TrackExistence: true}, "likes", pilosa.OptFieldKeys()) + c.ImportKeyKey(t, "users", "likes", [][2]string{ + {"molecula", "userA"}, + {"pilosa", "userB"}, + {"pangolin", "userC"}, + {"zebra", "userD"}, + {"toucan", "userE"}, + {"dog", "userF"}, + {"icecream", "userA"}, + {"icecream", "userB"}, + {"icecream", "userC"}, + {"icecream", "userD"}, + {"icecream", "userE"}, + {"icecream", "userF"}, + }) + + // Create and populate "affinity" int field with negative, positive, zero and null values. + c.CreateField(t, "users", pilosa.IndexOptions{Keys: true, TrackExistence: true}, "affinity", pilosa.OptFieldTypeInt(-1000, 1000)) + c.ImportIntKey(t, "users", "affinity", []test.IntKey{ + {Val: 10, Key: "userA"}, + {Val: -10, Key: "userB"}, + {Val: 5, Key: "userC"}, + {Val: -5, Key: "userD"}, + {Val: 0, Key: "userE"}, + }) + + tests := []struct { + query string + qrVerifier func(t *testing.T, resp pilosa.QueryResponse) + csvVerifier string + }{ + { + query: "Count(All())", + qrVerifier: func(t *testing.T, resp pilosa.QueryResponse) { + if resp.Results[0].(uint64) != 6 { + t.Errorf("expected 6, got %+v", resp.Results[0]) + } + }, + csvVerifier: "6\n", + }, + { + query: "Count(Distinct(field=likenums))", + qrVerifier: func(t *testing.T, resp pilosa.QueryResponse) { + if resp.Results[0].(uint64) != 7 { + t.Errorf("wrong count: %+v", resp.Results[0]) + } + }, + csvVerifier: "7\n", + }, + { + query: "Distinct(field=likenums)", + qrVerifier: func(t *testing.T, resp pilosa.QueryResponse) { + if !reflect.DeepEqual(resp.Results[0].(*pilosa.Row).Columns(), []uint64{1, 2, 3, 4, 5, 6, 7}) { + t.Errorf("wrong values: %+v %+v", resp.Results[0].(*pilosa.Row).Columns(), resp.Results[0].(*pilosa.Row)) + } + }, + csvVerifier: "1\n2\n3\n4\n5\n6\n7\n", + }, + { + query: "Count(Distinct(field=likes))", + qrVerifier: func(t *testing.T, resp pilosa.QueryResponse) { + if resp.Results[0].(uint64) != 7 { + t.Errorf("wrong count: %+v", resp.Results[0]) + } + }, + csvVerifier: "7\n", + }, + { + query: "Distinct(field=affinity)", + qrVerifier: func(t *testing.T, resp pilosa.QueryResponse) { + if !reflect.DeepEqual(resp.Results[0].(pilosa.SignedRow).Pos.Columns(), []uint64{0, 5, 10}) { + t.Errorf("wrong positive records: %+v", resp.Results[0].(pilosa.SignedRow).Pos.Columns()) + } + if !reflect.DeepEqual(resp.Results[0].(pilosa.SignedRow).Neg.Columns(), []uint64{5, 10}) { + t.Errorf("wrong negative records: %+v", resp.Results[0].(pilosa.SignedRow).Neg.Columns()) + } + }, + csvVerifier: "-10\n-5\n0\n5\n10\n", + }, + { + query: "Distinct(Row(affinity>=0),field=affinity)", + qrVerifier: func(t *testing.T, resp pilosa.QueryResponse) { + if !reflect.DeepEqual(resp.Results[0].(pilosa.SignedRow).Pos.Columns(), []uint64{0, 5, 10}) { + t.Errorf("wrong positive records: %+v", resp.Results[0].(pilosa.SignedRow).Pos.Columns()) + } + if !reflect.DeepEqual(resp.Results[0].(pilosa.SignedRow).Neg.Columns(), []uint64{}) { + t.Errorf("wrong negative records: %+v", resp.Results[0].(pilosa.SignedRow).Neg.Columns()) + } + }, + csvVerifier: "0\n5\n10\n", + }, + { + query: "Count(Distinct(Row(affinity>=0),field=affinity))", + qrVerifier: func(t *testing.T, resp pilosa.QueryResponse) { + if resp.Results[0].(uint64) != 3 { + t.Errorf("wrong number of values: %+v", resp.Results[0]) + } + }, + csvVerifier: "3\n", + }, + + // Handling this case properly will require changing the way + // that precomputed data is stored on Call objects. Currently + // if a Distinct is at all nested (e.g. within a Count) it + // gets handled by executor.handlePreCalls which assumes that + // only the positive values are worthwhile. + // + // { + // query: "Count(Distinct(field=affinity))", + // verifier: func(t *testing.T, resp pilosa.QueryResponse) { + // if resp.Results[0].(uint64) != 5 { + // t.Errorf("wrong number of values: %+v", resp.Results[0]) + // } + // }, + // }, + { + query: "Distinct(Row(affinity<0),field=likes)", + qrVerifier: func(t *testing.T, resp pilosa.QueryResponse) { + if !reflect.DeepEqual(resp.Results[0].(*pilosa.Row).Keys, []string{"pilosa", "zebra", "icecream"}) { + t.Errorf("wrong values: %+v", resp.Results[0]) + } + }, + csvVerifier: "pilosa\nzebra\nicecream\n", + }, + { + query: "Distinct(Row(affinity>0),field=likes)", + qrVerifier: func(t *testing.T, resp pilosa.QueryResponse) { + if !reflect.DeepEqual(resp.Results[0].(*pilosa.Row).Keys, []string{"molecula", "pangolin", "icecream"}) { + t.Errorf("wrong values: %+v", resp.Results[0]) + } + }, + csvVerifier: "molecula\npangolin\nicecream\n", + }, + { + query: "Distinct(Row(likenums=1),field=likes)", + qrVerifier: func(t *testing.T, resp pilosa.QueryResponse) { + if !reflect.DeepEqual(resp.Results[0].(*pilosa.Row).Keys, []string{"molecula", "icecream"}) { + t.Errorf("wrong values: %+v", resp.Results[0]) + } + }, + csvVerifier: "molecula\nicecream\n", + }, + { + query: "Distinct(field=likes)", + qrVerifier: func(t *testing.T, resp pilosa.QueryResponse) { + if !reflect.DeepEqual(resp.Results[0].(*pilosa.Row).Keys, []string{"molecula", "pilosa", "pangolin", "zebra", "toucan", "dog", "icecream"}) { + t.Errorf("wrong values: %+v", resp.Results[0]) + } + }, + csvVerifier: "molecula\npilosa\npangolin\nzebra\ntoucan\ndog\nicecream\n", + }, + { + query: "Distinct(All(),field=likes)", + qrVerifier: func(t *testing.T, resp pilosa.QueryResponse) { + if !reflect.DeepEqual(resp.Results[0].(*pilosa.Row).Keys, []string{"molecula", "pilosa", "pangolin", "zebra", "toucan", "dog", "icecream"}) { + t.Errorf("wrong values: %+v", resp.Results[0]) + } + }, + csvVerifier: "molecula\npilosa\npangolin\nzebra\ntoucan\ndog\nicecream\n", + }, + { + query: "Distinct(field=likes )", + qrVerifier: func(t *testing.T, resp pilosa.QueryResponse) { + if !reflect.DeepEqual(resp.Results[0].(*pilosa.Row).Keys, []string{"molecula", "pilosa", "pangolin", "zebra", "toucan", "dog", "icecream"}) { + t.Errorf("wrong values: %+v", resp.Results[0]) + } + }, + csvVerifier: "molecula\npilosa\npangolin\nzebra\ntoucan\ndog\nicecream\n", + }, + } + + for i, tst := range tests { + t.Run(fmt.Sprintf("%d-%s", i, tst.query), func(t *testing.T) { + resp := c.Query(t, "users", tst.query) + tr := c.QueryGRPC(t, "users", tst.query) + if tst.qrVerifier != nil { + tst.qrVerifier(t, resp) + } + csvString, err := tableResponseToCSVString(tr) + if err != nil { + t.Fatal(err) + } + // verify everything after header + got := csvString[strings.Index(csvString, "\n")+1:] + if got != tst.csvVerifier { + t.Errorf("expected '%s', got '%s'", tst.csvVerifier, got) + } + + // TODO: add HTTP and Postgres and ability to convert + // those results to CSV to run through CSV verifier + }) + } +} + +// tableResponseToCSV converts a generic TableResponse to a CSV format +// and writes it to the writer. +func tableResponseToCSV(m *proto.TableResponse, w io.Writer) error { + writer := csv.NewWriter(w) + record := make([]string, len(m.Headers)) + for i, h := range m.Headers { + record[i] = h.Name + } + err := writer.Write(record) + if err != nil { + return errors.Wrap(err, "writing header") + } + for i, row := range m.Rows { + record = record[:0] + for colIndex, col := range row.Columns { + switch m.Headers[colIndex].Datatype { + case "[]string": + record = append(record, fmt.Sprintf("%v", col.GetStringArrayVal())) + case "[]uint64": + record = append(record, fmt.Sprintf("%v", col.GetUint64ArrayVal())) + case "string": + record = append(record, fmt.Sprintf("%v", col.GetStringVal())) + case "uint64": + record = append(record, fmt.Sprintf("%v", col.GetUint64Val())) + case "decimal": + record = append(record, fmt.Sprintf("%v", col.GetDecimalVal().String())) + case "bool": + record = append(record, fmt.Sprintf("%v", col.GetBoolVal())) + case "int64": + record = append(record, fmt.Sprintf("%v", col.GetInt64Val())) + } + } + err := writer.Write(record) + if err != nil { + return errors.Wrapf(err, "writing row %d", i) + } + } + writer.Flush() + return errors.Wrap(writer.Error(), "writing or flushing CSV") +} + +// tableResponseToCSVString converts a generic TableResponse to a CSV format +// and returns it as a string. +func tableResponseToCSVString(m *proto.TableResponse) (string, error) { + buf := &bytes.Buffer{} + err := tableResponseToCSV(m, buf) + if err != nil { + return "", errors.Wrap(err, "writing tableResponse CSV to bytes.Buffer") + } + return buf.String(), nil +} diff --git a/internal/public.pb.go b/internal/public.pb.go index b3038896d..b334a48e3 100644 --- a/internal/public.pb.go +++ b/internal/public.pb.go @@ -28,6 +28,8 @@ type Row struct { 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"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -94,6 +96,20 @@ func (m *Row) GetRoaring() []byte { return nil } +func (m *Row) GetIndex() string { + if m != nil { + return m.Index + } + return "" +} + +func (m *Row) GetField() string { + if m != nil { + return m.Field + } + return "" +} + type RowMatrix struct { Rows []*Row `protobuf:"bytes,1,rep,name=Rows,proto3" json:"Rows,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -2667,113 +2683,113 @@ func init() { func init() { proto.RegisterFile("public.proto", fileDescriptor_413a91106d7bcce8) } var fileDescriptor_413a91106d7bcce8 = []byte{ - // 1682 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0x4f, 0x6f, 0xdb, 0xca, - 0x11, 0x37, 0x45, 0xca, 0x92, 0x46, 0xb2, 0xe3, 0xb7, 0xd1, 0x7b, 0x25, 0x52, 0xc7, 0x4f, 0x25, - 0xdc, 0x3e, 0xb5, 0x28, 0x1c, 0x38, 0x4d, 0x82, 0x5c, 0xda, 0xc6,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7f, 0x19, 0x2f, - 0xa6, 0xa9, 0xc4, 0x90, 0x4b, 0xc2, 0x3b, 0x82, 0x16, 0xee, 0x97, 0x81, 0x7b, 0xd2, 0x58, 0x56, - 0x56, 0x46, 0x3f, 0x41, 0x2e, 0x97, 0x07, 0x75, 0xa1, 0x4e, 0xca, 0x19, 0x12, 0x92, 0xf0, 0x8e, + // 1694 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0x4f, 0x73, 0x1b, 0x4b, + 0x11, 0xf7, 0x6a, 0x57, 0x96, 0xd4, 0x92, 0x1d, 0xbf, 0x89, 0xde, 0x63, 0x2b, 0x38, 0x7e, 0x62, + 0xcb, 0xf0, 0x04, 0x45, 0x39, 0xe5, 0x90, 0xa4, 0x72, 0x01, 0x62, 0x47, 0x0e, 0xde, 0x0a, 0x36, + 0x61, 0xe4, 0x72, 0x6e, 0x54, 0xad, 0xa5, 0xc1, 0xd9, 0x62, 0xa5, 0x15, 0xab, 0x55, 0x64, 0x5f, + 0xa8, 0xe2, 0x33, 0xe4, 0xc2, 0x8d, 0x2b, 0x27, 0x3e, 0x04, 0x17, 0x38, 0x72, 0xa4, 0x8a, 0x0b, + 0x15, 0xf8, 0x16, 0x5c, 0xa8, 0xee, 0xd9, 0xd9, 0x99, 0x5d, 0xad, 0x1d, 0x57, 0x8a, 0xdb, 0xf4, + 0x9f, 0xe9, 0xe9, 0xfe, 0x75, 0x4f, 0x4f, 0xef, 0x42, 0x67, 0xb6, 0xb8, 0x88, 0xc2, 0xd1, 0xde, + 0x2c, 0x89, 0xd3, 0x98, 0x35, 0xc3, 0x69, 0x2a, 0x92, 0x69, 0x10, 0x79, 0x7f, 0xb4, 0xc0, 0xe6, + 0xf1, 0x92, 0xb9, 0xd0, 0x78, 0x19, 0x47, 0x8b, 0xc9, 0x74, 0xee, 0x5a, 0x3d, 0xbb, 0xef, 0x70, + 0x45, 0x32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xdc, 0xfa, 0xdb, 0xc7, 0x1d, 0xeb, 0xef, 0x1f, 0x77, + 0xac, 0x7f, 0x7d, 0xdc, 0xb1, 0xfe, 0xf0, 0xef, 0x9d, 0xb5, 0x8b, 0x75, 0xfa, 0x07, 0xf6, 0xa3, + 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x2d, 0xb9, 0x97, 0xfb, 0x13, 0x13, 0x00, 0x00, } func (m *Row) Marshal() (dAtA []byte, err error) { @@ -2800,6 +2816,20 @@ func (m *Row) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if len(m.Field) > 0 { + i -= len(m.Field) + copy(dAtA[i:], m.Field) + i = encodeVarintPublic(dAtA, i, uint64(len(m.Field))) + i-- + dAtA[i] = 0x32 + } + 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] = 0x2a + } if len(m.Roaring) > 0 { i -= len(m.Roaring) copy(dAtA[i:], m.Roaring) @@ -5183,6 +5213,14 @@ func (m *Row) Size() (n int) { if l > 0 { n += 1 + l + sovPublic(uint64(l)) } + l = len(m.Index) + if l > 0 { + n += 1 + l + sovPublic(uint64(l)) + } + l = len(m.Field) + if l > 0 { + n += 1 + l + sovPublic(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -6457,6 +6495,70 @@ func (m *Row) Unmarshal(dAtA []byte) error { m.Roaring = []byte{} } iNdEx = postIndex + case 5: + 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 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Field", 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.Field = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPublic(dAtA[iNdEx:]) diff --git a/internal/public.proto b/internal/public.proto index 6d6a56d70..9e3b4241e 100644 --- a/internal/public.proto +++ b/internal/public.proto @@ -7,6 +7,8 @@ message Row { repeated string Keys = 3; repeated Attr Attrs = 2; bytes Roaring = 4; + string Index = 5; + string Field = 6; } message RowMatrix { diff --git a/row.go b/row.go index 9170926a7..46a0ec478 100644 --- a/row.go +++ b/row.go @@ -33,6 +33,15 @@ type Row struct { // Attributes associated with the row. Attrs map[string]interface{} + + // Index tells what index this row is from - needed for key translation. + Index string + + // Field tells what field this row is from if it's a "vertical" + // row. It may be the result of a Distinct query or Rows + // query. Knowing the index and field, we can figure out how to + // interpret the row data. + Field string } // NewRow returns a new instance of Row. @@ -61,6 +70,8 @@ func (r *Row) Clone() (clone *Row) { clone = &Row{ Keys: keyClone, Attrs: attrClone, + Index: r.Index, + Field: r.Field, } for _, seg := range r.segments { @@ -322,7 +333,7 @@ func (r *Row) Union(others ...*Row) *Row { output = append(output, *toProcess[0].Union(toProcess[1:]...)) } } - return &Row{segments: output} + return &Row{Index: r.Index, Field: r.Field, segments: output} } // Difference returns the diff of r and other. diff --git a/rrtx.go b/rrtx.go index 0cfb5fba9..6113067c4 100644 --- a/rrtx.go +++ b/rrtx.go @@ -30,6 +30,7 @@ import ( rbfcfg "github.com/pilosa/pilosa/v2/rbf/cfg" "github.com/pilosa/pilosa/v2/roaring" txkey "github.com/pilosa/pilosa/v2/short_txkey" + //txkey "github.com/pilosa/pilosa/v2/txkey" "github.com/pkg/errors" ) @@ -372,13 +373,13 @@ func (tx *RoaringTx) getFragment(index, field, view string, shard uint64) (*frag v := f.view(view) if v == nil { - return nil, errors.Errorf("view not found: %q", view) + return nil, errors.Wrapf(ViewNotFound, "getting %s", view) } frag := v.Fragment(shard) if frag == nil { - return nil, fmt.Errorf("fragment not found: %q / %q / %d", field, view, shard) + return nil, errors.Wrapf(FragmentNotFound, "field:%q, view:%q, shard:%d", field, view, shard) } // Note: we cannot cache frag into tx.fragment. @@ -388,6 +389,9 @@ func (tx *RoaringTx) getFragment(index, field, view string, shard uint64) (*frag return frag, nil } +const ViewNotFound = Error("view not found") +const FragmentNotFound = Error("fragment not found") + func (tx *RoaringTx) bitmap(index, field, view string, shard uint64) (*roaring.Bitmap, error) { frag, err := tx.getFragment(index, field, view, shard) if err != nil { diff --git a/server.go b/server.go index 89d197fef..2fb74e560 100644 --- a/server.go +++ b/server.go @@ -499,6 +499,10 @@ func (s *Server) InternalClient() InternalClient { return s.defaultClient } +func (s *Server) GRPCURI() URI { + return s.grpcURI +} + // UpAndDown brings the server up minimally and shuts it down // again; basically, it exists for testing holder open and close. func (s *Server) UpAndDown() error { diff --git a/test/cluster.go b/test/cluster.go index 5dfb4edfb..6bdfc8153 100644 --- a/test/cluster.go +++ b/test/cluster.go @@ -18,6 +18,7 @@ import ( "context" "fmt" "io/ioutil" + "math" "path" "strconv" "strings" @@ -25,6 +26,8 @@ import ( "time" "github.com/pilosa/pilosa/v2" + "github.com/pilosa/pilosa/v2/api/client" + "github.com/pilosa/pilosa/v2/proto" "github.com/pilosa/pilosa/v2/server" "github.com/pkg/errors" ) @@ -52,6 +55,39 @@ func (c *Cluster) Query(t testing.TB, index, query string) pilosa.QueryResponse return c.Nodes[0].QueryAPI(t, &pilosa.QueryRequest{Index: index, Query: query}) } +// QueryHTTP executes a PQL query through the HTTP endpoint. It fails +// the test for explicit errors, but returns an error which has the +// response body if the HTTP call returns a non-OK status. +func (c *Cluster) QueryHTTP(t testing.TB, index, query string) (string, error) { + t.Helper() + if len(c.Nodes) == 0 { + t.Fatal("must have at least one node in cluster to query") + } + + return c.Nodes[0].Query(t, index, "", query) +} + +// QueryGRPC executes a PQL query through the GRPC endpoint. It fails the +// test if there is an error. +func (c *Cluster) QueryGRPC(t testing.TB, index, query string) *proto.TableResponse { + t.Helper() + if len(c.Nodes) == 0 { + t.Fatal("must have at least one node in cluster to query") + } + + grpcClient, err := client.NewGRPCClient([]string{fmt.Sprintf("%s:%d", c.Nodes[0].Server.GRPCURI().Host, c.Nodes[0].Server.GRPCURI().Port)}, nil) + if err != nil { + t.Fatalf("getting GRPC client: %v", err) + } + + tableResp, err := grpcClient.QueryUnary(context.Background(), index, query) + if err != nil { + t.Fatalf("querying unary: %v", err) + } + + return tableResp +} + func (c *Cluster) GetNode(n int) *Command { return c.Nodes[n] } @@ -108,6 +144,77 @@ func (c *Cluster) ImportBits(t testing.TB, index, field string, rowcols [][2]uin } } +// ImportKeyKey imports data into an index where both the index and +// the field are using string keys. +func (c *Cluster) ImportKeyKey(t testing.TB, index, field string, valAndRecKeys [][2]string) { + t.Helper() + importRequest := &pilosa.ImportRequest{ + Index: index, + Field: field, + RowKeys: make([]string, len(valAndRecKeys)), + ColumnKeys: make([]string, len(valAndRecKeys)), + } + for i, vk := range valAndRecKeys { + importRequest.RowKeys[i] = vk[0] + importRequest.ColumnKeys[i] = vk[1] + } + err := c.Nodes[0].API.Import(context.Background(), nil, importRequest) + if err != nil { + t.Fatalf("importing keykey data: %v", err) + } +} + +// IntKey is a string key and a signed integer value. +type IntKey struct { + Val int64 + Key string +} + +// ImportIntKey imports int data into an index which uses string keys. +func (c *Cluster) ImportIntKey(t testing.TB, index, field string, pairs []IntKey) { + t.Helper() + importRequest := &pilosa.ImportValueRequest{ + Index: index, + Field: field, + Shard: math.MaxUint64, + ColumnKeys: make([]string, len(pairs)), + Values: make([]int64, len(pairs)), + } + for i, pair := range pairs { + importRequest.Values[i] = pair.Val + importRequest.ColumnKeys[i] = pair.Key + } + if err := c.Nodes[0].API.ImportValue(context.Background(), nil, importRequest); err != nil { + t.Fatalf("importing IntKey data: %v", err) + } +} + +// KeyID represents a key and an ID for importing data into an index +// and field where one uses string keys and the other does not. +type KeyID struct { + Key string + ID uint64 +} + +//ImportIDKey imports data into an unkeyed set field in a keyed index. +func (c *Cluster) ImportIDKey(t testing.TB, index, field string, pairs []KeyID) { + t.Helper() + importRequest := &pilosa.ImportRequest{ + Index: index, + Field: field, + RowIDs: make([]uint64, len(pairs)), + ColumnKeys: make([]string, len(pairs)), + } + for i, pair := range pairs { + importRequest.RowIDs[i] = pair.ID + importRequest.ColumnKeys[i] = pair.Key + } + err := c.Nodes[0].API.Import(context.Background(), nil, importRequest) + if err != nil { + t.Fatalf("importing IDKey data: %v", err) + } +} + // CreateField creates the index (if necessary) and field specified. func (c *Cluster) CreateField(t testing.TB, index string, iopts pilosa.IndexOptions, field string, fopts ...pilosa.FieldOption) *pilosa.Field { t.Helper() diff --git a/test/pilosa.go b/test/pilosa.go index d7fdf7aaa..264e3f4c9 100644 --- a/test/pilosa.go +++ b/test/pilosa.go @@ -196,7 +196,7 @@ func (m *Command) Client() *http.InternalClient { } // Query executes a query against the program through the HTTP API. -func (m *Command) Query(t *testing.T, index, rawQuery, query string) (string, error) { +func (m *Command) Query(t testing.TB, index, rawQuery, query string) (string, error) { resp := Do(t, "POST", fmt.Sprintf("%s/index/%s/query?%s", m.URL(), index, rawQuery), query) if resp.StatusCode != gohttp.StatusOK { return "", fmt.Errorf("invalid status: %d, body=%s", resp.StatusCode, resp.Body) @@ -285,7 +285,7 @@ func (m *Command) RecalculateCaches(t *testing.T) error { } // Do executes http.Do() with an http.NewRequest(). -func Do(t *testing.T, method, urlStr string, body string) *httpResponse { +func Do(t testing.TB, method, urlStr string, body string) *httpResponse { t.Helper() req, err := gohttp.NewRequest( method,