mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 17:15:56 +00:00
Merge pull request #534 from jaddr2line/inspect-query-v2
Add support for inspecting with a query
This commit is contained in:
commit
62ce26e7b8
4 changed files with 95 additions and 65 deletions
|
|
@ -174,7 +174,7 @@ func (c *GRPCClient) QueryUnary(ctx context.Context, index string, pql string) (
|
|||
|
||||
// Inspect returns a stream of RowResponse for the given index, columns, and filters.
|
||||
// It is intended to mimic something like "select [fields] from table where recordID IN (...)".
|
||||
func (c *GRPCClient) Inspect(ctx context.Context, index string, columnIDs []uint64, columnKeys []string, fieldFilters []string, limit, offset uint64) (pb.StreamClient, error) {
|
||||
func (c *GRPCClient) Inspect(ctx context.Context, index string, columnIDs []uint64, columnKeys []string, query string, fieldFilters []string, limit, offset uint64) (pb.StreamClient, error) {
|
||||
conn := c.Conn()
|
||||
|
||||
if conn == nil {
|
||||
|
|
@ -201,6 +201,7 @@ func (c *GRPCClient) Inspect(ctx context.Context, index string, columnIDs []uint
|
|||
FilterFields: fieldFilters,
|
||||
Limit: limit,
|
||||
Offset: offset,
|
||||
Query: query,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ import (
|
|||
fmt "fmt"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
math "math"
|
||||
)
|
||||
|
||||
|
|
@ -552,6 +550,7 @@ type InspectRequest struct {
|
|||
FilterFields []string `protobuf:"bytes,3,rep,name=filterFields,proto3" json:"filterFields,omitempty"`
|
||||
Limit uint64 `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"`
|
||||
Offset uint64 `protobuf:"varint,5,opt,name=offset,proto3" json:"offset,omitempty"`
|
||||
Query string `protobuf:"bytes,6,opt,name=query,proto3" json:"query,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
|
|
@ -617,6 +616,13 @@ func (m *InspectRequest) GetOffset() uint64 {
|
|||
return 0
|
||||
}
|
||||
|
||||
func (m *InspectRequest) GetQuery() string {
|
||||
if m != nil {
|
||||
return m.Query
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type Uint64Array struct {
|
||||
Vals []uint64 `protobuf:"varint,1,rep,packed,name=vals,proto3" json:"vals,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
|
|
@ -793,59 +799,60 @@ func init() {
|
|||
func init() { proto.RegisterFile("pilosa.proto", fileDescriptor_ef0691a44d1e275c) }
|
||||
|
||||
var fileDescriptor_ef0691a44d1e275c = []byte{
|
||||
// 677 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xed, 0x6e, 0xd3, 0x3c,
|
||||
0x14, 0xae, 0x97, 0xac, 0x6d, 0x4e, 0xf6, 0xf1, 0xbe, 0xde, 0xfb, 0x8e, 0x68, 0x42, 0x10, 0xf2,
|
||||
0x87, 0x20, 0xd0, 0x34, 0x06, 0x03, 0x01, 0xe3, 0xc7, 0x36, 0x40, 0x9d, 0x00, 0xb1, 0x19, 0xb6,
|
||||
0xff, 0x6e, 0xe3, 0x8e, 0x08, 0x37, 0xee, 0xe2, 0x74, 0xa3, 0x37, 0xc0, 0x1d, 0x70, 0x07, 0x70,
|
||||
0x29, 0xdc, 0x17, 0xb2, 0x1d, 0xa7, 0xc9, 0xa4, 0x22, 0xb4, 0x7f, 0x3e, 0xe7, 0x79, 0xce, 0x57,
|
||||
0x1e, 0x1f, 0x07, 0x96, 0xc6, 0x29, 0x17, 0x92, 0x6e, 0x8e, 0x73, 0x51, 0x08, 0xdc, 0x36, 0x56,
|
||||
0xf4, 0x0c, 0x56, 0x8f, 0x27, 0x2c, 0x9f, 0x1e, 0x1d, 0xbf, 0x23, 0xec, 0x7c, 0xc2, 0x64, 0x81,
|
||||
0xff, 0x83, 0xc5, 0x34, 0x4b, 0xd8, 0xd7, 0x00, 0x85, 0x28, 0xf6, 0x88, 0x31, 0xf0, 0x3f, 0xe0,
|
||||
0x8c, 0xcf, 0x79, 0xb0, 0xa0, 0x7d, 0xea, 0x18, 0xbd, 0x00, 0xff, 0x63, 0x41, 0x8b, 0x89, 0x7c,
|
||||
0x9d, 0xe7, 0x22, 0xc7, 0x18, 0xdc, 0x03, 0x91, 0x30, 0x1d, 0xb5, 0x4c, 0xf4, 0x19, 0x07, 0xd0,
|
||||
0x79, 0xcf, 0xa4, 0xa4, 0x67, 0xac, 0x0c, 0xb4, 0x66, 0xf4, 0x03, 0x81, 0x4f, 0xc4, 0x25, 0x61,
|
||||
0x72, 0x2c, 0x32, 0xc9, 0xf0, 0x03, 0xe8, 0x7c, 0x66, 0x34, 0x61, 0xb9, 0x0c, 0x50, 0xe8, 0xc4,
|
||||
0xfe, 0x36, 0xde, 0x2c, 0xfb, 0x3d, 0x10, 0x7c, 0x32, 0xca, 0x0e, 0xb3, 0xa1, 0x20, 0x96, 0x82,
|
||||
0xb7, 0xa0, 0x33, 0xd0, 0x6e, 0x19, 0x2c, 0x68, 0xf6, 0x7a, 0x93, 0x6d, 0xd3, 0x12, 0x4b, 0xc3,
|
||||
0x3b, 0x8d, 0x66, 0x03, 0x27, 0x44, 0xb1, 0xbf, 0xbd, 0x66, 0xa3, 0x6a, 0x10, 0xa9, 0xf3, 0xa2,
|
||||
0xa7, 0xe0, 0x10, 0x71, 0x59, 0xaf, 0x87, 0xfe, 0xaa, 0x5e, 0xf4, 0x1d, 0xc1, 0xf2, 0x27, 0xda,
|
||||
0xe7, 0xec, 0x9a, 0x13, 0xde, 0x06, 0x37, 0x17, 0x97, 0x76, 0x3c, 0xdf, 0x52, 0xd5, 0x27, 0xd3,
|
||||
0xc0, 0x75, 0x07, 0xda, 0x05, 0x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 0xe1, 0x3d, 0x58, 0xb6, 0xdc, 0x93, 0x8c, 0xe6, 0xd3, 0xf9, 0x29, 0xfe, 0xb7,
|
||||
0x40, 0xe3, 0x91, 0x89, 0x5a, 0xf8, 0x39, 0x74, 0x4a, 0x85, 0x71, 0xf5, 0x48, 0x35, 0x25, 0x9f,
|
||||
0x5b, 0xbe, 0xdf, 0xd6, 0xff, 0x86, 0x47, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xce, 0xa2, 0x01,
|
||||
0xb8, 0x2b, 0x06, 0x00, 0x00,
|
||||
// 690 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xdd, 0x6e, 0xd4, 0x3a,
|
||||
0x10, 0x5e, 0x37, 0xe9, 0xee, 0x66, 0xd2, 0x9f, 0x73, 0xdc, 0x73, 0x4a, 0x54, 0x21, 0x08, 0xb9,
|
||||
0x21, 0x08, 0x54, 0x95, 0x42, 0x41, 0x40, 0xb9, 0x68, 0x0b, 0x68, 0x2b, 0x40, 0xb4, 0x86, 0xf6,
|
||||
0xde, 0xbb, 0xf1, 0x96, 0x08, 0x6f, 0xbc, 0x8d, 0xb3, 0x2d, 0xfb, 0x02, 0xbc, 0x01, 0x6f, 0xc0,
|
||||
0x5b, 0x70, 0xcd, 0x7b, 0x21, 0xdb, 0x71, 0x36, 0xa9, 0xb4, 0x08, 0xf5, 0x2e, 0x33, 0xdf, 0x37,
|
||||
0x33, 0x1e, 0x7f, 0x9e, 0x09, 0x2c, 0x8d, 0x53, 0x2e, 0x24, 0xdd, 0x1c, 0xe7, 0xa2, 0x10, 0xb8,
|
||||
0x6d, 0xac, 0xe8, 0x19, 0xac, 0x1e, 0x4f, 0x58, 0x3e, 0x3d, 0x3a, 0x7e, 0x47, 0xd8, 0xf9, 0x84,
|
||||
0xc9, 0x02, 0xff, 0x07, 0x8b, 0x69, 0x96, 0xb0, 0xaf, 0x01, 0x0a, 0x51, 0xec, 0x11, 0x63, 0xe0,
|
||||
0x7f, 0xc0, 0x19, 0x9f, 0xf3, 0x60, 0x41, 0xfb, 0xd4, 0x67, 0xf4, 0x02, 0xfc, 0x8f, 0x05, 0x2d,
|
||||
0x26, 0xf2, 0x75, 0x9e, 0x8b, 0x1c, 0x63, 0x70, 0x0f, 0x44, 0xc2, 0x74, 0xd4, 0x32, 0xd1, 0xdf,
|
||||
0x38, 0x80, 0xce, 0x7b, 0x26, 0x25, 0x3d, 0x63, 0x65, 0xa0, 0x35, 0xa3, 0x1f, 0x08, 0x7c, 0x22,
|
||||
0x2e, 0x09, 0x93, 0x63, 0x91, 0x49, 0x86, 0x1f, 0x40, 0xe7, 0x33, 0xa3, 0x09, 0xcb, 0x65, 0x80,
|
||||
0x42, 0x27, 0xf6, 0xb7, 0xf1, 0x66, 0x79, 0xde, 0x03, 0xc1, 0x27, 0xa3, 0xec, 0x30, 0x1b, 0x0a,
|
||||
0x62, 0x29, 0x78, 0x0b, 0x3a, 0x03, 0xed, 0x96, 0xc1, 0x82, 0x66, 0xaf, 0x37, 0xd9, 0x36, 0x2d,
|
||||
0xb1, 0x34, 0xbc, 0xd3, 0x38, 0x6c, 0xe0, 0x84, 0x28, 0xf6, 0xb7, 0xd7, 0x6c, 0x54, 0x0d, 0x22,
|
||||
0x75, 0x5e, 0xf4, 0x14, 0x1c, 0x22, 0x2e, 0xeb, 0xf5, 0xd0, 0x5f, 0xd5, 0x8b, 0xbe, 0x23, 0x58,
|
||||
0xfe, 0x44, 0xfb, 0x9c, 0x5d, 0xb3, 0xc3, 0xdb, 0xe0, 0xe6, 0xe2, 0xd2, 0xb6, 0xe7, 0x5b, 0xaa,
|
||||
0xba, 0x32, 0x0d, 0x5c, 0xb7, 0xa1, 0x5d, 0x80, 0x59, 0x39, 0xa5, 0x59, 0x46, 0x47, 0xac, 0x54,
|
||||
0x5a, 0x7f, 0xe3, 0x0d, 0xe8, 0x26, 0xb4, 0xa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x07, 0x94, 0x1b, 0x09, 0x1d, 0x62, 0x8c, 0xe8, 0x27, 0x82, 0x95,
|
||||
0xc3, 0x4c, 0x8e, 0xd9, 0xa0, 0xf8, 0xf3, 0xb4, 0xdf, 0xaf, 0x0f, 0x98, 0x3a, 0xdc, 0xbf, 0xf6,
|
||||
0x70, 0x87, 0x89, 0xfc, 0x90, 0xbf, 0x65, 0x53, 0x39, 0x9b, 0xad, 0x08, 0x96, 0x86, 0x29, 0x2f,
|
||||
0x58, 0xfe, 0x26, 0x65, 0x3c, 0x91, 0x81, 0x13, 0x3a, 0xb1, 0x47, 0x1a, 0x3e, 0x55, 0x86, 0xa7,
|
||||
0xa3, 0xb4, 0xd0, 0x32, 0xba, 0xc4, 0x18, 0x78, 0x1d, 0xda, 0x62, 0x38, 0x94, 0xac, 0xd0, 0x0a,
|
||||
0xba, 0xa4, 0xb4, 0x14, 0xfb, 0x5c, 0x6d, 0x25, 0xad, 0x9a, 0x47, 0x8c, 0x11, 0xdd, 0x01, 0xbf,
|
||||
0x26, 0x9b, 0x7a, 0xbc, 0x17, 0x94, 0x9b, 0x69, 0x72, 0x89, 0xfe, 0x56, 0x94, 0x9a, 0x34, 0x0d,
|
||||
0x8a, 0x57, 0x52, 0xce, 0xc0, 0xab, 0x7a, 0xc0, 0x77, 0xc1, 0x49, 0x13, 0xa9, 0x7b, 0x9f, 0xfb,
|
||||
0x38, 0x14, 0x03, 0xdf, 0x03, 0xf7, 0x0b, 0x9b, 0xda, 0xdb, 0x98, 0xf3, 0x0e, 0x34, 0x65, 0xbf,
|
||||
0x0d, 0xae, 0x1a, 0x96, 0xed, 0x5f, 0x08, 0xda, 0x47, 0x9a, 0x86, 0x77, 0xa1, 0x6b, 0xb7, 0x2c,
|
||||
0xbe, 0x61, 0x63, 0xaf, 0xec, 0xdd, 0x8d, 0xb5, 0xfa, 0x90, 0x97, 0xe3, 0x15, 0xb5, 0xb6, 0x10,
|
||||
0xde, 0x83, 0x65, 0xcb, 0x3d, 0xc9, 0x68, 0x3e, 0x9d, 0x9f, 0xe2, 0x7f, 0x0b, 0x34, 0x56, 0x4f,
|
||||
0xd4, 0xc2, 0xcf, 0xa1, 0x53, 0xea, 0x8e, 0xab, 0xd5, 0xd5, 0x7c, 0x08, 0x73, 0xcb, 0xf7, 0xdb,
|
||||
0xfa, 0x8f, 0xf1, 0xe8, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc5, 0x01, 0x62, 0x15, 0x41, 0x06,
|
||||
0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConnInterface
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion6
|
||||
const _ = grpc.SupportPackageIsVersion4
|
||||
|
||||
// PilosaClient is the client API for Pilosa service.
|
||||
//
|
||||
|
|
@ -857,10 +864,10 @@ type PilosaClient interface {
|
|||
}
|
||||
|
||||
type pilosaClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewPilosaClient(cc grpc.ClientConnInterface) PilosaClient {
|
||||
func NewPilosaClient(cc *grpc.ClientConn) PilosaClient {
|
||||
return &pilosaClient{cc}
|
||||
}
|
||||
|
||||
|
|
@ -944,20 +951,6 @@ type PilosaServer interface {
|
|||
Inspect(*InspectRequest, Pilosa_InspectServer) error
|
||||
}
|
||||
|
||||
// UnimplementedPilosaServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedPilosaServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedPilosaServer) QueryPQL(req *QueryPQLRequest, srv Pilosa_QueryPQLServer) error {
|
||||
return status.Errorf(codes.Unimplemented, "method QueryPQL not implemented")
|
||||
}
|
||||
func (*UnimplementedPilosaServer) QueryPQLUnary(ctx context.Context, req *QueryPQLRequest) (*TableResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method QueryPQLUnary not implemented")
|
||||
}
|
||||
func (*UnimplementedPilosaServer) Inspect(req *InspectRequest, srv Pilosa_InspectServer) error {
|
||||
return status.Errorf(codes.Unimplemented, "method Inspect not implemented")
|
||||
}
|
||||
|
||||
func RegisterPilosaServer(s *grpc.Server, srv PilosaServer) {
|
||||
s.RegisterService(&_Pilosa_serviceDesc, srv)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ message InspectRequest {
|
|||
repeated string filterFields = 3;
|
||||
uint64 limit = 4;
|
||||
uint64 offset = 5;
|
||||
string query = 6;
|
||||
}
|
||||
|
||||
message Uint64Array {
|
||||
|
|
|
|||
|
|
@ -294,6 +294,41 @@ func (h *GRPCHandler) Inspect(req *pb.InspectRequest, stream pb.Pilosa_InspectSe
|
|||
}
|
||||
}
|
||||
|
||||
if req.Query != "" {
|
||||
// Execute the query and use it to select columns.
|
||||
if req.Columns.Type != nil {
|
||||
return errors.New("found a list of columns in a query-based inspect call")
|
||||
}
|
||||
query := pilosa.QueryRequest{
|
||||
Index: req.Index,
|
||||
Query: req.Query,
|
||||
}
|
||||
resp, err := h.api.Query(stream.Context(), &query)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "querying for columns with %q", req.Query)
|
||||
}
|
||||
if len(resp.Results) != 1 {
|
||||
return errors.Errorf("expected 1 result for inspect query; got %d from %q", len(resp.Results), req.Query)
|
||||
}
|
||||
row, ok := resp.Results[0].(*pilosa.Row)
|
||||
if !ok {
|
||||
return errors.Errorf("incorrect query result type %T for query %q", resp.Results[0], req.Query)
|
||||
}
|
||||
if len(row.Keys) > 0 {
|
||||
req.Columns.Type = &pb.IdsOrKeys_Keys{
|
||||
Keys: &pb.StringArray{Vals: row.Keys},
|
||||
}
|
||||
} else {
|
||||
req.Columns.Type = &pb.IdsOrKeys_Ids{
|
||||
Ids: &pb.Uint64Array{Vals: row.Columns()},
|
||||
}
|
||||
}
|
||||
if !row.Any() {
|
||||
// No columns were matched.
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
limit := req.Limit
|
||||
if limit == 0 {
|
||||
limit = defaultLimit
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue