mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-07 11:27:50 +00:00
Merge pull request #297 from yuce/276-timestamp
Implements 276: Moved timestamp from HTTP query to PQL
This commit is contained in:
commit
3620931dce
6 changed files with 126 additions and 123 deletions
18
executor.go
18
executor.go
|
|
@ -490,6 +490,16 @@ func (e *Executor) executeSetBit(ctx context.Context, db string, c *pql.Call, op
|
|||
return false, errors.New("SetBit() profileID required")
|
||||
}
|
||||
|
||||
var timestamp *time.Time
|
||||
sTimestamp, ok := c.Args["timestamp"].(string)
|
||||
if ok {
|
||||
t, err := time.Parse("2006-01-02T15:04:05", sTimestamp)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("invalid date: %s", sTimestamp)
|
||||
}
|
||||
timestamp = &t
|
||||
}
|
||||
|
||||
slice := profileID / SliceWidth
|
||||
ret := false
|
||||
|
||||
|
|
@ -500,7 +510,7 @@ func (e *Executor) executeSetBit(ctx context.Context, db string, c *pql.Call, op
|
|||
if err != nil {
|
||||
return false, fmt.Errorf("db: %s", err)
|
||||
}
|
||||
val, err := db.SetBit(frame, id, profileID, opt.Timestamp)
|
||||
val, err := db.SetBit(frame, id, profileID, timestamp)
|
||||
if err != nil {
|
||||
return false, err
|
||||
} else if val {
|
||||
|
|
@ -711,9 +721,6 @@ func (e *Executor) exec(ctx context.Context, node *Node, db string, q *pql.Query
|
|||
Slices: slices,
|
||||
Remote: true,
|
||||
}
|
||||
if opt.Timestamp != nil {
|
||||
pbreq.Timestamp = opt.Timestamp.UnixNano()
|
||||
}
|
||||
buf, err := proto.Marshal(pbreq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -960,8 +967,7 @@ type mapResponse struct {
|
|||
|
||||
// ExecOptions represents an execution context for a single Execute() call.
|
||||
type ExecOptions struct {
|
||||
Timestamp *time.Time
|
||||
Remote bool
|
||||
Remote bool
|
||||
}
|
||||
|
||||
// decodeError returns an error representation of s if s is non-blank.
|
||||
|
|
|
|||
|
|
@ -384,6 +384,54 @@ func TestExecutor_Execute_Remote_SetBit(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// Ensure a remote query can set bits on multiple nodes.
|
||||
func TestExecutor_Execute_Remote_SetBit_With_Timestamp(t *testing.T) {
|
||||
c := NewCluster(2)
|
||||
c.ReplicaN = 2
|
||||
|
||||
// Create secondary server and update second cluster node.
|
||||
s := NewServer()
|
||||
defer s.Close()
|
||||
c.Nodes[1].Host = s.Host()
|
||||
|
||||
// Mock secondary server's executor to verify arguments.
|
||||
var remoteCalled bool
|
||||
s.Handler.Executor.ExecuteFn = func(ctx context.Context, db string, query *pql.Query, slices []uint64, opt *pilosa.ExecOptions) ([]interface{}, error) {
|
||||
if db != `d` {
|
||||
t.Fatalf("unexpected db: %s", db)
|
||||
} else if query.String() != `SetBit(frame="f", id=10, profileID=2, timestamp="2016-12-11T10:09:07")` {
|
||||
t.Fatalf("unexpected query: %s", query.String())
|
||||
}
|
||||
remoteCalled = true
|
||||
return []interface{}{nil}, nil
|
||||
}
|
||||
|
||||
// Create local executor data.
|
||||
idx := MustOpenIndex()
|
||||
defer idx.Close()
|
||||
idx.CreateDBIfNotExists("d")
|
||||
oldQuantum := idx.DB("d").TimeQuantum()
|
||||
defer func() {
|
||||
// restore db quantum
|
||||
idx.DB("d").SetTimeQuantum(oldQuantum)
|
||||
}()
|
||||
// need to set the quantum otherwise SetBit fails silently
|
||||
idx.DB("d").SetTimeQuantum("Y")
|
||||
|
||||
e := NewExecutor(idx.Index, c)
|
||||
if _, err := e.Execute(context.Background(), "d", MustParse(`SetBit(id=10, frame=f, profileID=2, timestamp="2016-12-11T10:09:07")`), nil, nil); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// Verify that one bit is set on both node's index.
|
||||
if n := idx.MustCreateFragmentIfNotExists("d", "f_2016", 0).Bitmap(10).Count(); n != 1 {
|
||||
t.Fatalf("unexpected local count: %d", n)
|
||||
}
|
||||
if !remoteCalled {
|
||||
t.Fatalf("expected remote execution")
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure a remote query can return a top-n query.
|
||||
func TestExecutor_Execute_Remote_TopN(t *testing.T) {
|
||||
c := NewCluster(2)
|
||||
|
|
|
|||
37
handler.go
37
handler.go
|
|
@ -229,8 +229,7 @@ func (h *Handler) handlePostQuery(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
// Build execution options.
|
||||
opt := &ExecOptions{
|
||||
Timestamp: req.Timestamp,
|
||||
Remote: req.Remote,
|
||||
Remote: req.Remote,
|
||||
}
|
||||
|
||||
// Parse query string.
|
||||
|
|
@ -629,21 +628,6 @@ func (h *Handler) readURLQueryRequest(r *http.Request) (*QueryRequest, error) {
|
|||
return nil, errors.New("invalid slice argument")
|
||||
}
|
||||
|
||||
// Parse timestamp, if available.
|
||||
var timestamp *time.Time
|
||||
if v := q.Get("timestamp"); v != "" {
|
||||
layout := "2006-01-02 15:04:05"
|
||||
if strings.Contains(v, "T") {
|
||||
layout = "2006-01-02T15:04:05"
|
||||
}
|
||||
|
||||
t, err := time.Parse(layout, v)
|
||||
if err != nil {
|
||||
return nil, errors.New("invalid timestamp")
|
||||
}
|
||||
timestamp = &t
|
||||
}
|
||||
|
||||
// Parse time granularity.
|
||||
quantum := TimeQuantum("YMDH")
|
||||
if s := q.Get("time_granularity"); s != "" {
|
||||
|
|
@ -655,12 +639,11 @@ func (h *Handler) readURLQueryRequest(r *http.Request) (*QueryRequest, error) {
|
|||
}
|
||||
|
||||
return &QueryRequest{
|
||||
DB: q.Get("db"),
|
||||
Query: query,
|
||||
Slices: slices,
|
||||
Profiles: q.Get("profiles") == "true",
|
||||
Timestamp: timestamp,
|
||||
Quantum: quantum,
|
||||
DB: q.Get("db"),
|
||||
Query: query,
|
||||
Slices: slices,
|
||||
Profiles: q.Get("profiles") == "true",
|
||||
Quantum: quantum,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
@ -1072,9 +1055,6 @@ type QueryRequest struct {
|
|||
// Return profile attributes, if true.
|
||||
Profiles bool
|
||||
|
||||
// Timestamp passed into the query.
|
||||
Timestamp *time.Time
|
||||
|
||||
// Time granularity to use with the timestamp.
|
||||
Quantum TimeQuantum
|
||||
|
||||
|
|
@ -1093,11 +1073,6 @@ func decodeQueryRequest(pb *internal.QueryRequest) *QueryRequest {
|
|||
Remote: pb.Remote,
|
||||
}
|
||||
|
||||
if pb.Timestamp != 0 {
|
||||
t := time.Unix(0, pb.Timestamp)
|
||||
req.Timestamp = &t
|
||||
}
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -149,13 +149,12 @@ func (m *AttrMap) GetAttrs() []*Attr {
|
|||
}
|
||||
|
||||
type QueryRequest struct {
|
||||
DB string `protobuf:"bytes,1,opt,name=DB,proto3" json:"DB,omitempty"`
|
||||
Query string `protobuf:"bytes,2,opt,name=Query,proto3" json:"Query,omitempty"`
|
||||
Slices []uint64 `protobuf:"varint,3,rep,packed,name=Slices" json:"Slices,omitempty"`
|
||||
Profiles bool `protobuf:"varint,4,opt,name=Profiles,proto3" json:"Profiles,omitempty"`
|
||||
Timestamp int64 `protobuf:"varint,5,opt,name=Timestamp,proto3" json:"Timestamp,omitempty"`
|
||||
Quantum string `protobuf:"bytes,6,opt,name=Quantum,proto3" json:"Quantum,omitempty"`
|
||||
Remote bool `protobuf:"varint,7,opt,name=Remote,proto3" json:"Remote,omitempty"`
|
||||
DB string `protobuf:"bytes,1,opt,name=DB,proto3" json:"DB,omitempty"`
|
||||
Query string `protobuf:"bytes,2,opt,name=Query,proto3" json:"Query,omitempty"`
|
||||
Slices []uint64 `protobuf:"varint,3,rep,packed,name=Slices" json:"Slices,omitempty"`
|
||||
Profiles bool `protobuf:"varint,4,opt,name=Profiles,proto3" json:"Profiles,omitempty"`
|
||||
Quantum string `protobuf:"bytes,5,opt,name=Quantum,proto3" json:"Quantum,omitempty"`
|
||||
Remote bool `protobuf:"varint,6,opt,name=Remote,proto3" json:"Remote,omitempty"`
|
||||
}
|
||||
|
||||
func (m *QueryRequest) Reset() { *m = QueryRequest{} }
|
||||
|
|
@ -628,19 +627,14 @@ func (m *QueryRequest) MarshalTo(dAtA []byte) (int, error) {
|
|||
}
|
||||
i++
|
||||
}
|
||||
if m.Timestamp != 0 {
|
||||
dAtA[i] = 0x28
|
||||
i++
|
||||
i = encodeVarintInternal(dAtA, i, uint64(m.Timestamp))
|
||||
}
|
||||
if len(m.Quantum) > 0 {
|
||||
dAtA[i] = 0x32
|
||||
dAtA[i] = 0x2a
|
||||
i++
|
||||
i = encodeVarintInternal(dAtA, i, uint64(len(m.Quantum)))
|
||||
i += copy(dAtA[i:], m.Quantum)
|
||||
}
|
||||
if m.Remote {
|
||||
dAtA[i] = 0x38
|
||||
dAtA[i] = 0x30
|
||||
i++
|
||||
if m.Remote {
|
||||
dAtA[i] = 1
|
||||
|
|
@ -1191,9 +1185,6 @@ func (m *QueryRequest) Size() (n int) {
|
|||
if m.Profiles {
|
||||
n += 2
|
||||
}
|
||||
if m.Timestamp != 0 {
|
||||
n += 1 + sovInternal(uint64(m.Timestamp))
|
||||
}
|
||||
l = len(m.Quantum)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovInternal(uint64(l))
|
||||
|
|
@ -2389,25 +2380,6 @@ func (m *QueryRequest) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
m.Profiles = bool(v != 0)
|
||||
case 5:
|
||||
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 ErrIntOverflowInternal
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.Timestamp |= (int64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 6:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Quantum", wireType)
|
||||
}
|
||||
|
|
@ -2436,7 +2408,7 @@ func (m *QueryRequest) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
m.Quantum = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 7:
|
||||
case 6:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Remote", wireType)
|
||||
}
|
||||
|
|
@ -3859,50 +3831,49 @@ var (
|
|||
func init() { proto.RegisterFile("internal.proto", fileDescriptorInternal) }
|
||||
|
||||
var fileDescriptorInternal = []byte{
|
||||
// 706 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x55, 0xcd, 0x6a, 0x14, 0x4f,
|
||||
0x10, 0xff, 0xf7, 0xce, 0xcc, 0x7e, 0xd4, 0x26, 0xcb, 0xa6, 0xd9, 0xbf, 0x0c, 0x41, 0x96, 0xa1,
|
||||
0x51, 0x19, 0x05, 0x13, 0x88, 0x17, 0x11, 0x41, 0x9c, 0x6c, 0xc4, 0x45, 0x12, 0x92, 0x4e, 0xf4,
|
||||
0xe6, 0x61, 0x4c, 0xda, 0x64, 0xc8, 0x7c, 0xd9, 0xd3, 0x23, 0xee, 0xd1, 0x83, 0x17, 0x9f, 0x40,
|
||||
0xf0, 0x09, 0x7c, 0x03, 0x1f, 0xc1, 0xa3, 0x8f, 0x20, 0xf1, 0x45, 0xa4, 0x3f, 0xe6, 0x23, 0x11,
|
||||
0x63, 0x0e, 0xde, 0xa6, 0x7e, 0xd5, 0xd5, 0x55, 0xbf, 0xfa, 0x55, 0xf5, 0xc0, 0x28, 0x4a, 0x05,
|
||||
0xe3, 0x69, 0x18, 0xaf, 0xe5, 0x3c, 0x13, 0x19, 0xee, 0x57, 0x36, 0xb9, 0x05, 0x9d, 0x59, 0x80,
|
||||
0x3d, 0x18, 0x1e, 0x44, 0x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0x45, 0x0c, 0x37, 0xc6, 0x4d, 0xb0, 0xc6, 0x69, 0xb5, 0x40, 0x4b, 0x80, 0x76, 0xcc, 0x60,
|
||||
0xa0, 0x1d, 0x29, 0x96, 0x5c, 0x8a, 0x2a, 0x67, 0x4b, 0x2c, 0x09, 0x53, 0xed, 0x94, 0x3d, 0xda,
|
||||
0x3c, 0x09, 0xd3, 0x63, 0x76, 0x64, 0x9a, 0x5b, 0x99, 0xe4, 0x0b, 0x82, 0xe5, 0x79, 0x92, 0x67,
|
||||
0x5c, 0x5c, 0xa2, 0xa3, 0xda, 0xf2, 0x4a, 0x47, 0xbd, 0xf2, 0x13, 0x70, 0x94, 0x72, 0x6a, 0x0e,
|
||||
0x6d, 0xaa, 0x0d, 0x35, 0x63, 0x66, 0xb7, 0xa4, 0x8c, 0x52, 0xe0, 0x06, 0xc0, 0x53, 0x80, 0x7a,
|
||||
0xb9, 0x0a, 0xd7, 0x51, 0xee, 0x16, 0x22, 0xfd, 0xb5, 0xac, 0x85, 0xdb, 0xf5, 0x2c, 0xdf, 0xa2,
|
||||
0x2d, 0x84, 0x10, 0x18, 0x55, 0xa5, 0xfe, 0x49, 0x37, 0x72, 0x04, 0xe3, 0x20, 0xce, 0x0e, 0x4f,
|
||||
0x67, 0xa1, 0x08, 0xff, 0x05, 0xa3, 0x09, 0x38, 0xea, 0x3e, 0xb3, 0x4f, 0xda, 0x20, 0x7b, 0xb0,
|
||||
0xd2, 0xca, 0x62, 0x8a, 0x39, 0x47, 0x1e, 0x5d, 0x4e, 0xbe, 0x73, 0x91, 0x3c, 0xb9, 0x09, 0xce,
|
||||
0x66, 0x78, 0x78, 0xf2, 0x97, 0x6b, 0xc8, 0x67, 0x04, 0x2b, 0xdb, 0xe1, 0x3b, 0xbd, 0x35, 0x75,
|
||||
0xea, 0xa7, 0x30, 0xa8, 0x41, 0xb3, 0xb6, 0x77, 0x9a, 0x49, 0xf8, 0xed, 0x7c, 0x83, 0x6c, 0xa5,
|
||||
0x82, 0x2f, 0x68, 0x13, 0xbc, 0xfa, 0x10, 0x46, 0xe7, 0x9d, 0xb2, 0xc7, 0xa7, 0xcd, 0xeb, 0x74,
|
||||
0xaa, 0x9f, 0xdb, 0xb7, 0xea, 0x15, 0x31, 0xcf, 0xad, 0x32, 0x1e, 0x74, 0xee, 0xa3, 0x60, 0xfc,
|
||||
0xed, 0x6c, 0x8a, 0xbe, 0x9f, 0x4d, 0xd1, 0x8f, 0xb3, 0x29, 0xfa, 0xf4, 0x73, 0xfa, 0xdf, 0xab,
|
||||
0xae, 0xfa, 0xb9, 0xdc, 0xfb, 0x15, 0x00, 0x00, 0xff, 0xff, 0xe9, 0x7d, 0x09, 0xe4, 0x6e, 0x06,
|
||||
0x00, 0x00,
|
||||
// 696 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x55, 0xcb, 0x6a, 0x14, 0x41,
|
||||
0x14, 0xb5, 0xa6, 0xbb, 0xe7, 0x71, 0x27, 0x19, 0x26, 0xc5, 0x28, 0x4d, 0x90, 0xa1, 0x29, 0x54,
|
||||
0x5a, 0xc1, 0x04, 0xe2, 0x46, 0x44, 0x10, 0x3b, 0x13, 0x71, 0x90, 0x84, 0xa4, 0x12, 0xdd, 0xb9,
|
||||
0x68, 0x93, 0x32, 0x69, 0xd2, 0x2f, 0xab, 0xab, 0xc5, 0x59, 0xba, 0x70, 0xe3, 0x17, 0x88, 0x7e,
|
||||
0x81, 0x7f, 0xe2, 0xd2, 0x4f, 0x90, 0xf8, 0x23, 0x52, 0x8f, 0x7e, 0x44, 0x31, 0x66, 0xe1, 0xae,
|
||||
0xef, 0xb9, 0x75, 0x6f, 0x9d, 0x73, 0x1f, 0xd5, 0x30, 0x8a, 0x52, 0xc1, 0x78, 0x1a, 0xc6, 0x6b,
|
||||
0x39, 0xcf, 0x44, 0x86, 0xfb, 0x95, 0x4d, 0x6e, 0x41, 0x67, 0x16, 0x60, 0x0f, 0x86, 0x07, 0x51,
|
||||
0xc2, 0xf6, 0xca, 0x30, 0x15, 0x65, 0xe2, 0x22, 0x0f, 0xf9, 0x03, 0xda, 0x86, 0xc8, 0x6d, 0x70,
|
||||
0x9e, 0xf0, 0x30, 0x61, 0x97, 0x38, 0x1a, 0x40, 0x37, 0x88, 0x44, 0x12, 0xe6, 0x18, 0x83, 0x1d,
|
||||
0x44, 0xa2, 0x70, 0x91, 0x67, 0xf9, 0x36, 0x55, 0xdf, 0xf8, 0x06, 0x38, 0x8f, 0x85, 0xe0, 0x85,
|
||||
0xdb, 0xf1, 0x2c, 0x7f, 0xb8, 0x31, 0x5a, 0xab, 0xa9, 0x49, 0x98, 0x6a, 0x27, 0x59, 0x03, 0x7b,
|
||||
0x37, 0x8c, 0x38, 0x1e, 0x83, 0xf5, 0x8c, 0x2d, 0xd4, 0x2d, 0x36, 0x95, 0x9f, 0x78, 0x02, 0xce,
|
||||
0x66, 0x56, 0xa6, 0xc2, 0xed, 0x28, 0x4c, 0x1b, 0xe4, 0x25, 0x58, 0x41, 0x24, 0xf0, 0x2a, 0xf4,
|
||||
0xf5, 0xd5, 0xf3, 0x99, 0x89, 0xa9, 0x6d, 0x7c, 0x1d, 0x06, 0xbb, 0x3c, 0x7b, 0x1d, 0xc5, 0x6c,
|
||||
0x3e, 0x33, 0xc1, 0x0d, 0x20, 0xbd, 0x52, 0x43, 0x21, 0xc2, 0x24, 0x77, 0x2d, 0x0f, 0xf9, 0x16,
|
||||
0x6d, 0x00, 0xf2, 0x08, 0x7a, 0xe6, 0x28, 0x1e, 0x41, 0xa7, 0x4e, 0xde, 0x99, 0xcf, 0x2e, 0xa9,
|
||||
0xe7, 0x23, 0x02, 0x5b, 0x7e, 0xb5, 0x05, 0x0d, 0xb4, 0x20, 0x0c, 0xf6, 0xc1, 0x22, 0x67, 0x86,
|
||||
0x92, 0xfa, 0x96, 0x45, 0xde, 0x17, 0x3c, 0x4a, 0x8f, 0x5f, 0x84, 0x71, 0xc9, 0x14, 0x9f, 0x01,
|
||||
0x6d, 0x43, 0x92, 0xef, 0xf3, 0x28, 0x15, 0xda, 0x6f, 0x6b, 0x35, 0x35, 0x20, 0xbd, 0x41, 0x96,
|
||||
0xc5, 0xda, 0xeb, 0x78, 0xc8, 0xef, 0xd3, 0x06, 0x20, 0xeb, 0xd0, 0x93, 0x5c, 0xb6, 0xc3, 0xbc,
|
||||
0x61, 0x8f, 0x2e, 0x62, 0xff, 0x19, 0xc1, 0xd2, 0x5e, 0xc9, 0xf8, 0x82, 0xb2, 0x37, 0x25, 0x2b,
|
||||
0x84, 0x2c, 0xc2, 0x2c, 0x30, 0x22, 0xe4, 0xfc, 0x4c, 0xc0, 0x51, 0x7e, 0x25, 0x62, 0x40, 0xb5,
|
||||
0x81, 0xaf, 0x41, 0x77, 0x3f, 0x8e, 0x0e, 0x59, 0xe1, 0x5a, 0x6a, 0x00, 0x8c, 0x25, 0xbb, 0x64,
|
||||
0xaa, 0x59, 0x28, 0xea, 0x7d, 0x5a, 0xdb, 0xd8, 0x85, 0x5e, 0x35, 0x5a, 0x8e, 0xca, 0x55, 0x99,
|
||||
0x32, 0x1b, 0x65, 0x49, 0x26, 0x98, 0xdb, 0x55, 0x31, 0xc6, 0x22, 0xef, 0x11, 0x2c, 0x1b, 0x72,
|
||||
0x45, 0x9e, 0xa5, 0x05, 0x93, 0x35, 0xde, 0xe2, 0xbc, 0xaa, 0xf1, 0x16, 0xe7, 0x78, 0x1d, 0x7a,
|
||||
0x94, 0x15, 0x65, 0x2c, 0xaa, 0x36, 0x5d, 0x6d, 0x84, 0x56, 0xb1, 0x65, 0x2c, 0x68, 0x75, 0x0a,
|
||||
0xdf, 0x6d, 0x51, 0xb4, 0x54, 0xc4, 0x4a, 0x13, 0x61, 0x3c, 0x0d, 0x6b, 0xf2, 0x01, 0xc1, 0xb0,
|
||||
0x95, 0x07, 0xfb, 0xd5, 0x0a, 0x28, 0x12, 0xc3, 0x8d, 0x71, 0x13, 0xac, 0x71, 0x5a, 0xad, 0xc8,
|
||||
0x12, 0xa0, 0x1d, 0xd3, 0x7a, 0xb4, 0x23, 0xdb, 0x21, 0xc7, 0xbe, 0xba, 0xb3, 0xd5, 0x0e, 0x09,
|
||||
0x53, 0xed, 0x94, 0x35, 0xda, 0x3c, 0x09, 0xd3, 0x63, 0x76, 0x64, 0xca, 0x57, 0x99, 0xe4, 0x2b,
|
||||
0x82, 0xe5, 0x79, 0x92, 0x67, 0x5c, 0x5c, 0xd0, 0x29, 0xb5, 0xc7, 0x55, 0xa7, 0xf4, 0x52, 0x4f,
|
||||
0xc0, 0x51, 0xbd, 0x51, 0x93, 0x66, 0x53, 0x6d, 0xa8, 0x29, 0x32, 0xdb, 0x23, 0x1b, 0x25, 0x5b,
|
||||
0xd8, 0x00, 0x78, 0x0a, 0x50, 0xaf, 0x4f, 0xe1, 0x3a, 0xca, 0xdd, 0x42, 0xa4, 0xbf, 0x5e, 0xa0,
|
||||
0xc2, 0xed, 0x7a, 0x96, 0x6f, 0xd1, 0x16, 0x42, 0x08, 0x8c, 0x2a, 0xaa, 0x7f, 0xeb, 0x1b, 0x39,
|
||||
0x82, 0x71, 0x10, 0x67, 0x87, 0xa7, 0xb3, 0x50, 0x84, 0xff, 0x43, 0xd1, 0x04, 0x1c, 0x95, 0xcf,
|
||||
0x6c, 0x8c, 0x36, 0xc8, 0x1e, 0xac, 0xb4, 0x6e, 0x31, 0x64, 0xce, 0x89, 0x47, 0x17, 0x8b, 0xef,
|
||||
0xfc, 0x2e, 0x9e, 0xdc, 0x04, 0x67, 0x33, 0x3c, 0x3c, 0xf9, 0x47, 0x1a, 0xf2, 0x05, 0xc1, 0xca,
|
||||
0x76, 0xf8, 0x4e, 0xef, 0x45, 0x7d, 0xf5, 0x53, 0x18, 0xd4, 0xa0, 0x59, 0xcc, 0x3b, 0xcd, 0x24,
|
||||
0xfc, 0x71, 0xbe, 0x41, 0xb6, 0x52, 0xc1, 0x17, 0xb4, 0x09, 0x5e, 0x7d, 0x08, 0xa3, 0xf3, 0x4e,
|
||||
0x59, 0xe3, 0xd3, 0xe6, 0xfd, 0x39, 0xd5, 0x0f, 0xea, 0x5b, 0xf5, 0x4e, 0x98, 0x07, 0x55, 0x19,
|
||||
0x0f, 0x3a, 0xf7, 0x51, 0x30, 0xfe, 0x76, 0x36, 0x45, 0xdf, 0xcf, 0xa6, 0xe8, 0xc7, 0xd9, 0x14,
|
||||
0x7d, 0xfa, 0x39, 0xbd, 0xf2, 0xaa, 0xab, 0x7e, 0x1f, 0xf7, 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff,
|
||||
0x04, 0xa0, 0xe3, 0x0c, 0x50, 0x06, 0x00, 0x00,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,9 +48,8 @@ message QueryRequest {
|
|||
string Query = 2;
|
||||
repeated uint64 Slices = 3;
|
||||
bool Profiles = 4;
|
||||
int64 Timestamp = 5;
|
||||
string Quantum = 6;
|
||||
bool Remote = 7;
|
||||
string Quantum = 5;
|
||||
bool Remote = 6;
|
||||
}
|
||||
|
||||
message QueryResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import (
|
|||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Query represents a PQL query.
|
||||
|
|
@ -98,6 +99,9 @@ func (c *Call) String() string {
|
|||
fmt.Fprintf(&buf, "%v=%s", key, joinInterfaceSlice(v))
|
||||
case []uint64:
|
||||
fmt.Fprintf(&buf, "%v=%s", key, joinUint64Slice(v))
|
||||
case time.Time:
|
||||
layout := "2006-01-02T15:04:05"
|
||||
fmt.Fprintf(&buf, "%v=\"%s\"", key, v.Format(layout))
|
||||
default:
|
||||
fmt.Fprintf(&buf, "%v=%v", key, v)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue