diff --git a/Makefile b/Makefile index f47c92740..241480b41 100644 --- a/Makefile +++ b/Makefile @@ -119,6 +119,10 @@ generate-stringer: generate-pql: require-peg cd pql && peg -inline pql.peg && cd .. +# dunno if protoc-gen-gofast is actually needed here +generate-proto-grpc: require-protoc require-protoc-gen-gofast + protoc -I proto proto/pilosa.proto --go_out=plugins=grpc:proto + # `go generate` all needed packages generate: generate-protoc generate-stringer generate-pql diff --git a/pql/pql.peg b/pql/pql.peg index 348396d5a..7c06d451f 100644 --- a/pql/pql.peg +++ b/pql/pql.peg @@ -55,7 +55,7 @@ item <- ( 'null' &(comma / sp close) { p.addVal(nil) } doublequotedstring <- ( '\\"' / '\\\\' / [^"] )* singlequotedstring <- ( '\\\'' / '\\\\' / [^'] )* -fieldExpr <- [[A-Z]] ( [[A-Z]] / [0-9] / '_' / '-' )* +fieldExpr <- ( [[A-Z]] / '_' ) ( [[A-Z]] / [0-9] / '_' / '-' )* field <- { p.addField(buffer[begin:end]) } reserved <- ('_row' / '_col' / '_start' / '_end' / '_timestamp' / '_field') posfield <- { p.addPosStr("_field", buffer[begin:end]) } diff --git a/pql/pql.peg.go b/pql/pql.peg.go index f1ae962fc..183d36379 100644 --- a/pql/pql.peg.go +++ b/pql/pql.peg.go @@ -15,7 +15,7 @@ const endSymbol rune = 1114112 type pegRule uint8 const ( - ruleUnknown pegRule = iota // nolint:varcheck,deadcode,unused + ruleUnknown pegRule = iota ruleCalls ruleCall ruleallargs @@ -2313,7 +2313,7 @@ func (p *PQL) Init() { } return true }, - /* 15 fieldExpr <- <(([a-z] / [A-Z]) ([a-z] / [A-Z] / [0-9] / '_' / '-')*)> */ + /* 15 fieldExpr <- <(([a-z] / [A-Z] / '_') ([a-z] / [A-Z] / [0-9] / '_' / '-')*)> */ func() bool { position219, tokenIndex219 := position, tokenIndex { @@ -2328,53 +2328,60 @@ func (p *PQL) Init() { l222: position, tokenIndex = position221, tokenIndex221 if c := buffer[position]; c < rune('A') || c > rune('Z') { + goto l223 + } + position++ + goto l221 + l223: + position, tokenIndex = position221, tokenIndex221 + if buffer[position] != rune('_') { goto l219 } position++ } l221: - l223: + l224: { - position224, tokenIndex224 := position, tokenIndex + position225, tokenIndex225 := position, tokenIndex { - position225, tokenIndex225 := position, tokenIndex + position226, tokenIndex226 := position, tokenIndex if c := buffer[position]; c < rune('a') || c > rune('z') { - goto l226 - } - position++ - goto l225 - l226: - position, tokenIndex = position225, tokenIndex225 - if c := buffer[position]; c < rune('A') || c > rune('Z') { goto l227 } position++ - goto l225 + goto l226 l227: - position, tokenIndex = position225, tokenIndex225 - if c := buffer[position]; c < rune('0') || c > rune('9') { + position, tokenIndex = position226, tokenIndex226 + if c := buffer[position]; c < rune('A') || c > rune('Z') { goto l228 } position++ - goto l225 + goto l226 l228: - position, tokenIndex = position225, tokenIndex225 - if buffer[position] != rune('_') { + position, tokenIndex = position226, tokenIndex226 + if c := buffer[position]; c < rune('0') || c > rune('9') { goto l229 } position++ - goto l225 + goto l226 l229: - position, tokenIndex = position225, tokenIndex225 + position, tokenIndex = position226, tokenIndex226 + if buffer[position] != rune('_') { + goto l230 + } + position++ + goto l226 + l230: + position, tokenIndex = position226, tokenIndex226 if buffer[position] != rune('-') { - goto l224 + goto l225 } position++ } + l226: + goto l224 l225: - goto l223 - l224: - position, tokenIndex = position224, tokenIndex224 + position, tokenIndex = position225, tokenIndex225 } add(rulefieldExpr, position220) } @@ -2385,419 +2392,419 @@ func (p *PQL) Init() { }, /* 16 field <- <(<(fieldExpr / reserved)> Action49)> */ func() bool { - position230, tokenIndex230 := position, tokenIndex + position231, tokenIndex231 := position, tokenIndex { - position231 := position + position232 := position { - position232 := position + position233 := position { - position233, tokenIndex233 := position, tokenIndex + position234, tokenIndex234 := position, tokenIndex if !_rules[rulefieldExpr]() { - goto l234 + goto l235 } - goto l233 - l234: - position, tokenIndex = position233, tokenIndex233 + goto l234 + l235: + position, tokenIndex = position234, tokenIndex234 { - position235 := position + position236 := position { - position236, tokenIndex236 := position, tokenIndex + position237, tokenIndex237 := position, tokenIndex if buffer[position] != rune('_') { - goto l237 + goto l238 } position++ if buffer[position] != rune('r') { - goto l237 + goto l238 } position++ if buffer[position] != rune('o') { - goto l237 + goto l238 } position++ if buffer[position] != rune('w') { - goto l237 + goto l238 } position++ - goto l236 - l237: - position, tokenIndex = position236, tokenIndex236 + goto l237 + l238: + position, tokenIndex = position237, tokenIndex237 if buffer[position] != rune('_') { - goto l238 + goto l239 } position++ if buffer[position] != rune('c') { - goto l238 + goto l239 } position++ if buffer[position] != rune('o') { - goto l238 + goto l239 } position++ if buffer[position] != rune('l') { - goto l238 + goto l239 } position++ - goto l236 - l238: - position, tokenIndex = position236, tokenIndex236 + goto l237 + l239: + position, tokenIndex = position237, tokenIndex237 if buffer[position] != rune('_') { - goto l239 + goto l240 } position++ if buffer[position] != rune('s') { - goto l239 + goto l240 } position++ if buffer[position] != rune('t') { - goto l239 + goto l240 } position++ if buffer[position] != rune('a') { - goto l239 + goto l240 } position++ if buffer[position] != rune('r') { - goto l239 + goto l240 } position++ if buffer[position] != rune('t') { - goto l239 + goto l240 } position++ - goto l236 - l239: - position, tokenIndex = position236, tokenIndex236 + goto l237 + l240: + position, tokenIndex = position237, tokenIndex237 if buffer[position] != rune('_') { - goto l240 + goto l241 } position++ if buffer[position] != rune('e') { - goto l240 + goto l241 } position++ if buffer[position] != rune('n') { - goto l240 + goto l241 } position++ if buffer[position] != rune('d') { - goto l240 + goto l241 } position++ - goto l236 - l240: - position, tokenIndex = position236, tokenIndex236 + goto l237 + l241: + position, tokenIndex = position237, tokenIndex237 if buffer[position] != rune('_') { - goto l241 + goto l242 } position++ if buffer[position] != rune('t') { - goto l241 + goto l242 } position++ if buffer[position] != rune('i') { - goto l241 + goto l242 } position++ if buffer[position] != rune('m') { - goto l241 + goto l242 } position++ if buffer[position] != rune('e') { - goto l241 + goto l242 } position++ if buffer[position] != rune('s') { - goto l241 + goto l242 } position++ if buffer[position] != rune('t') { - goto l241 + goto l242 } position++ if buffer[position] != rune('a') { - goto l241 + goto l242 } position++ if buffer[position] != rune('m') { - goto l241 + goto l242 } position++ if buffer[position] != rune('p') { - goto l241 + goto l242 } position++ - goto l236 - l241: - position, tokenIndex = position236, tokenIndex236 + goto l237 + l242: + position, tokenIndex = position237, tokenIndex237 if buffer[position] != rune('_') { - goto l230 + goto l231 } position++ if buffer[position] != rune('f') { - goto l230 + goto l231 } position++ if buffer[position] != rune('i') { - goto l230 + goto l231 } position++ if buffer[position] != rune('e') { - goto l230 + goto l231 } position++ if buffer[position] != rune('l') { - goto l230 + goto l231 } position++ if buffer[position] != rune('d') { - goto l230 + goto l231 } position++ } - l236: - add(rulereserved, position235) + l237: + add(rulereserved, position236) } } - l233: - add(rulePegText, position232) + l234: + add(rulePegText, position233) } { add(ruleAction49, position) } - add(rulefield, position231) + add(rulefield, position232) } return true - l230: - position, tokenIndex = position230, tokenIndex230 + l231: + position, tokenIndex = position231, tokenIndex231 return false }, /* 17 reserved <- <(('_' 'r' 'o' 'w') / ('_' 'c' 'o' 'l') / ('_' 's' 't' 'a' 'r' 't') / ('_' 'e' 'n' 'd') / ('_' 't' 'i' 'm' 'e' 's' 't' 'a' 'm' 'p') / ('_' 'f' 'i' 'e' 'l' 'd'))> */ nil, /* 18 posfield <- <( Action50)> */ func() bool { - position244, tokenIndex244 := position, tokenIndex + position245, tokenIndex245 := position, tokenIndex { - position245 := position + position246 := position { - position246 := position + position247 := position if !_rules[rulefieldExpr]() { - goto l244 + goto l245 } - add(rulePegText, position246) + add(rulePegText, position247) } { add(ruleAction50, position) } - add(ruleposfield, position245) + add(ruleposfield, position246) } return true - l244: - position, tokenIndex = position244, tokenIndex244 + l245: + position, tokenIndex = position245, tokenIndex245 return false }, /* 19 uint <- <(([1-9] [0-9]*) / '0')> */ func() bool { - position248, tokenIndex248 := position, tokenIndex + position249, tokenIndex249 := position, tokenIndex { - position249 := position + position250 := position { - position250, tokenIndex250 := position, tokenIndex + position251, tokenIndex251 := position, tokenIndex if c := buffer[position]; c < rune('1') || c > rune('9') { - goto l251 + goto l252 } position++ - l252: + l253: { - position253, tokenIndex253 := position, tokenIndex + position254, tokenIndex254 := position, tokenIndex if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l253 + goto l254 } position++ - goto l252 - l253: - position, tokenIndex = position253, tokenIndex253 + goto l253 + l254: + position, tokenIndex = position254, tokenIndex254 } - goto l250 - l251: - position, tokenIndex = position250, tokenIndex250 + goto l251 + l252: + position, tokenIndex = position251, tokenIndex251 if buffer[position] != rune('0') { - goto l248 + goto l249 } position++ } - l250: - add(ruleuint, position249) + l251: + add(ruleuint, position250) } return true - l248: - position, tokenIndex = position248, tokenIndex248 + l249: + position, tokenIndex = position249, tokenIndex249 return false }, /* 20 col <- <(( Action51) / ('\'' '\'' Action52) / ('"' '"' Action53))> */ func() bool { - position254, tokenIndex254 := position, tokenIndex + position255, tokenIndex255 := position, tokenIndex { - position255 := position + position256 := position { - position256, tokenIndex256 := position, tokenIndex + position257, tokenIndex257 := position, tokenIndex { - position258 := position + position259 := position if !_rules[ruleuint]() { - goto l257 + goto l258 } - add(rulePegText, position258) + add(rulePegText, position259) } { add(ruleAction51, position) } - goto l256 - l257: - position, tokenIndex = position256, tokenIndex256 + goto l257 + l258: + position, tokenIndex = position257, tokenIndex257 if buffer[position] != rune('\'') { - goto l260 + goto l261 } position++ { - position261 := position + position262 := position if !_rules[rulesinglequotedstring]() { - goto l260 + goto l261 } - add(rulePegText, position261) + add(rulePegText, position262) } if buffer[position] != rune('\'') { - goto l260 + goto l261 } position++ { add(ruleAction52, position) } - goto l256 - l260: - position, tokenIndex = position256, tokenIndex256 + goto l257 + l261: + position, tokenIndex = position257, tokenIndex257 if buffer[position] != rune('"') { - goto l254 + goto l255 } position++ { - position263 := position + position264 := position if !_rules[ruledoublequotedstring]() { - goto l254 + goto l255 } - add(rulePegText, position263) + add(rulePegText, position264) } if buffer[position] != rune('"') { - goto l254 + goto l255 } position++ { add(ruleAction53, position) } } - l256: - add(rulecol, position255) + l257: + add(rulecol, position256) } return true - l254: - position, tokenIndex = position254, tokenIndex254 + l255: + position, tokenIndex = position255, tokenIndex255 return false }, /* 21 row <- <(( Action54) / ('\'' '\'' Action55) / ('"' '"' Action56))> */ nil, /* 22 open <- <('(' sp)> */ func() bool { - position266, tokenIndex266 := position, tokenIndex + position267, tokenIndex267 := position, tokenIndex { - position267 := position + position268 := position if buffer[position] != rune('(') { - goto l266 + goto l267 } position++ if !_rules[rulesp]() { - goto l266 + goto l267 } - add(ruleopen, position267) + add(ruleopen, position268) } return true - l266: - position, tokenIndex = position266, tokenIndex266 + l267: + position, tokenIndex = position267, tokenIndex267 return false }, /* 23 close <- <(')' sp)> */ func() bool { - position268, tokenIndex268 := position, tokenIndex + position269, tokenIndex269 := position, tokenIndex { - position269 := position + position270 := position if buffer[position] != rune(')') { - goto l268 + goto l269 } position++ if !_rules[rulesp]() { - goto l268 + goto l269 } - add(ruleclose, position269) + add(ruleclose, position270) } return true - l268: - position, tokenIndex = position268, tokenIndex268 + l269: + position, tokenIndex = position269, tokenIndex269 return false }, /* 24 sp <- <(' ' / '\t' / '\n')*> */ func() bool { { - position271 := position - l272: + position272 := position + l273: { - position273, tokenIndex273 := position, tokenIndex + position274, tokenIndex274 := position, tokenIndex { - position274, tokenIndex274 := position, tokenIndex + position275, tokenIndex275 := position, tokenIndex if buffer[position] != rune(' ') { - goto l275 - } - position++ - goto l274 - l275: - position, tokenIndex = position274, tokenIndex274 - if buffer[position] != rune('\t') { goto l276 } position++ - goto l274 + goto l275 l276: - position, tokenIndex = position274, tokenIndex274 + position, tokenIndex = position275, tokenIndex275 + if buffer[position] != rune('\t') { + goto l277 + } + position++ + goto l275 + l277: + position, tokenIndex = position275, tokenIndex275 if buffer[position] != rune('\n') { - goto l273 + goto l274 } position++ } + l275: + goto l273 l274: - goto l272 - l273: - position, tokenIndex = position273, tokenIndex273 + position, tokenIndex = position274, tokenIndex274 } - add(rulesp, position271) + add(rulesp, position272) } return true }, /* 25 comma <- <(sp ',' sp)> */ func() bool { - position277, tokenIndex277 := position, tokenIndex + position278, tokenIndex278 := position, tokenIndex { - position278 := position + position279 := position if !_rules[rulesp]() { - goto l277 + goto l278 } if buffer[position] != rune(',') { - goto l277 + goto l278 } position++ if !_rules[rulesp]() { - goto l277 + goto l278 } - add(rulecomma, position278) + add(rulecomma, position279) } return true - l277: - position, tokenIndex = position277, tokenIndex277 + l278: + position, tokenIndex = position278, tokenIndex278 return false }, /* 26 lbrack <- <('[' sp)> */ @@ -2806,204 +2813,204 @@ func (p *PQL) Init() { nil, /* 28 IDENT <- <(([a-z] / [A-Z]) ([a-z] / [A-Z] / [0-9])*)> */ func() bool { - position281, tokenIndex281 := position, tokenIndex + position282, tokenIndex282 := position, tokenIndex { - position282 := position + position283 := position { - position283, tokenIndex283 := position, tokenIndex + position284, tokenIndex284 := position, tokenIndex if c := buffer[position]; c < rune('a') || c > rune('z') { - goto l284 + goto l285 } position++ - goto l283 - l284: - position, tokenIndex = position283, tokenIndex283 + goto l284 + l285: + position, tokenIndex = position284, tokenIndex284 if c := buffer[position]; c < rune('A') || c > rune('Z') { - goto l281 + goto l282 } position++ } - l283: - l285: + l284: + l286: { - position286, tokenIndex286 := position, tokenIndex + position287, tokenIndex287 := position, tokenIndex { - position287, tokenIndex287 := position, tokenIndex + position288, tokenIndex288 := position, tokenIndex if c := buffer[position]; c < rune('a') || c > rune('z') { - goto l288 - } - position++ - goto l287 - l288: - position, tokenIndex = position287, tokenIndex287 - if c := buffer[position]; c < rune('A') || c > rune('Z') { goto l289 } position++ - goto l287 + goto l288 l289: - position, tokenIndex = position287, tokenIndex287 + position, tokenIndex = position288, tokenIndex288 + if c := buffer[position]; c < rune('A') || c > rune('Z') { + goto l290 + } + position++ + goto l288 + l290: + position, tokenIndex = position288, tokenIndex288 if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l286 + goto l287 } position++ } + l288: + goto l286 l287: - goto l285 - l286: - position, tokenIndex = position286, tokenIndex286 + position, tokenIndex = position287, tokenIndex287 } - add(ruleIDENT, position282) + add(ruleIDENT, position283) } return true - l281: - position, tokenIndex = position281, tokenIndex281 + l282: + position, tokenIndex = position282, tokenIndex282 return false }, /* 29 timestampbasicfmt <- <([0-9] [0-9] [0-9] [0-9] '-' ('0' / '1') [0-9] '-' [0-3] [0-9] 'T' [0-9] [0-9] ':' [0-9] [0-9])> */ func() bool { - position290, tokenIndex290 := position, tokenIndex + position291, tokenIndex291 := position, tokenIndex { - position291 := position + position292 := position if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l290 + goto l291 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l290 + goto l291 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l290 + goto l291 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l290 + goto l291 } position++ if buffer[position] != rune('-') { - goto l290 + goto l291 } position++ { - position292, tokenIndex292 := position, tokenIndex + position293, tokenIndex293 := position, tokenIndex if buffer[position] != rune('0') { - goto l293 + goto l294 } position++ - goto l292 - l293: - position, tokenIndex = position292, tokenIndex292 + goto l293 + l294: + position, tokenIndex = position293, tokenIndex293 if buffer[position] != rune('1') { - goto l290 + goto l291 } position++ } - l292: + l293: if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l290 + goto l291 } position++ if buffer[position] != rune('-') { - goto l290 + goto l291 } position++ if c := buffer[position]; c < rune('0') || c > rune('3') { - goto l290 + goto l291 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l290 + goto l291 } position++ if buffer[position] != rune('T') { - goto l290 + goto l291 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l290 + goto l291 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l290 + goto l291 } position++ if buffer[position] != rune(':') { - goto l290 + goto l291 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l290 + goto l291 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l290 + goto l291 } position++ - add(ruletimestampbasicfmt, position291) + add(ruletimestampbasicfmt, position292) } return true - l290: - position, tokenIndex = position290, tokenIndex290 + l291: + position, tokenIndex = position291, tokenIndex291 return false }, /* 30 timestampfmt <- <(('"' '"') / ('\'' '\'') / )> */ func() bool { - position294, tokenIndex294 := position, tokenIndex + position295, tokenIndex295 := position, tokenIndex { - position295 := position + position296 := position { - position296, tokenIndex296 := position, tokenIndex + position297, tokenIndex297 := position, tokenIndex if buffer[position] != rune('"') { - goto l297 + goto l298 } position++ { - position298 := position + position299 := position if !_rules[ruletimestampbasicfmt]() { - goto l297 + goto l298 } - add(rulePegText, position298) + add(rulePegText, position299) } if buffer[position] != rune('"') { - goto l297 + goto l298 } position++ - goto l296 - l297: - position, tokenIndex = position296, tokenIndex296 + goto l297 + l298: + position, tokenIndex = position297, tokenIndex297 if buffer[position] != rune('\'') { - goto l299 + goto l300 } position++ - { - position300 := position - if !_rules[ruletimestampbasicfmt]() { - goto l299 - } - add(rulePegText, position300) - } - if buffer[position] != rune('\'') { - goto l299 - } - position++ - goto l296 - l299: - position, tokenIndex = position296, tokenIndex296 { position301 := position if !_rules[ruletimestampbasicfmt]() { - goto l294 + goto l300 } add(rulePegText, position301) } + if buffer[position] != rune('\'') { + goto l300 + } + position++ + goto l297 + l300: + position, tokenIndex = position297, tokenIndex297 + { + position302 := position + if !_rules[ruletimestampbasicfmt]() { + goto l295 + } + add(rulePegText, position302) + } } - l296: - add(ruletimestampfmt, position295) + l297: + add(ruletimestampfmt, position296) } return true - l294: - position, tokenIndex = position294, tokenIndex294 + l295: + position, tokenIndex = position295, tokenIndex295 return false }, /* 31 timestamp <- <( Action57)> */ diff --git a/proto/pilosa.pb.go b/proto/pilosa.pb.go index 8a4ac9950..cdbcf58f0 100644 --- a/proto/pilosa.pb.go +++ b/proto/pilosa.pb.go @@ -4,14 +4,13 @@ package proto import ( + context "context" fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" -) - -import ( - context "golang.org/x/net/context" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -23,7 +22,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type QueryPQLRequest struct { Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` @@ -175,6 +174,7 @@ type ColumnResponse struct { // *ColumnResponse_BlobVal // *ColumnResponse_Uint64ArrayVal // *ColumnResponse_StringArrayVal + // *ColumnResponse_Float64Val ColumnVal isColumnResponse_ColumnVal `protobuf_oneof:"columnVal"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -238,6 +238,10 @@ type ColumnResponse_StringArrayVal struct { StringArrayVal *StringArray `protobuf:"bytes,7,opt,name=stringArrayVal,proto3,oneof"` } +type ColumnResponse_Float64Val struct { + Float64Val float64 `protobuf:"fixed64,8,opt,name=float64Val,proto3,oneof"` +} + func (*ColumnResponse_StringVal) isColumnResponse_ColumnVal() {} func (*ColumnResponse_Uint64Val) isColumnResponse_ColumnVal() {} @@ -252,6 +256,8 @@ func (*ColumnResponse_Uint64ArrayVal) isColumnResponse_ColumnVal() {} func (*ColumnResponse_StringArrayVal) isColumnResponse_ColumnVal() {} +func (*ColumnResponse_Float64Val) isColumnResponse_ColumnVal() {} + func (m *ColumnResponse) GetColumnVal() isColumnResponse_ColumnVal { if m != nil { return m.ColumnVal @@ -308,9 +314,16 @@ func (m *ColumnResponse) GetStringArrayVal() *StringArray { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*ColumnResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _ColumnResponse_OneofMarshaler, _ColumnResponse_OneofUnmarshaler, _ColumnResponse_OneofSizer, []interface{}{ +func (m *ColumnResponse) GetFloat64Val() float64 { + if x, ok := m.GetColumnVal().(*ColumnResponse_Float64Val); ok { + return x.Float64Val + } + return 0 +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*ColumnResponse) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*ColumnResponse_StringVal)(nil), (*ColumnResponse_Uint64Val)(nil), (*ColumnResponse_Int64Val)(nil), @@ -318,146 +331,10 @@ func (*ColumnResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer (*ColumnResponse_BlobVal)(nil), (*ColumnResponse_Uint64ArrayVal)(nil), (*ColumnResponse_StringArrayVal)(nil), + (*ColumnResponse_Float64Val)(nil), } } -func _ColumnResponse_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*ColumnResponse) - // columnVal - switch x := m.ColumnVal.(type) { - case *ColumnResponse_StringVal: - b.EncodeVarint(1<<3 | proto.WireBytes) - b.EncodeStringBytes(x.StringVal) - case *ColumnResponse_Uint64Val: - b.EncodeVarint(2<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.Uint64Val)) - case *ColumnResponse_Int64Val: - b.EncodeVarint(3<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.Int64Val)) - case *ColumnResponse_BoolVal: - t := uint64(0) - if x.BoolVal { - t = 1 - } - b.EncodeVarint(4<<3 | proto.WireVarint) - b.EncodeVarint(t) - case *ColumnResponse_BlobVal: - b.EncodeVarint(5<<3 | proto.WireBytes) - b.EncodeRawBytes(x.BlobVal) - case *ColumnResponse_Uint64ArrayVal: - b.EncodeVarint(6<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Uint64ArrayVal); err != nil { - return err - } - case *ColumnResponse_StringArrayVal: - b.EncodeVarint(7<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.StringArrayVal); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("ColumnResponse.ColumnVal has unexpected type %T", x) - } - return nil -} - -func _ColumnResponse_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*ColumnResponse) - switch tag { - case 1: // columnVal.stringVal - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.ColumnVal = &ColumnResponse_StringVal{x} - return true, err - case 2: // columnVal.uint64Val - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.ColumnVal = &ColumnResponse_Uint64Val{x} - return true, err - case 3: // columnVal.int64Val - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.ColumnVal = &ColumnResponse_Int64Val{int64(x)} - return true, err - case 4: // columnVal.boolVal - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.ColumnVal = &ColumnResponse_BoolVal{x != 0} - return true, err - case 5: // columnVal.blobVal - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeRawBytes(true) - m.ColumnVal = &ColumnResponse_BlobVal{x} - return true, err - case 6: // columnVal.uint64ArrayVal - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Uint64Array) - err := b.DecodeMessage(msg) - m.ColumnVal = &ColumnResponse_Uint64ArrayVal{msg} - return true, err - case 7: // columnVal.stringArrayVal - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(StringArray) - err := b.DecodeMessage(msg) - m.ColumnVal = &ColumnResponse_StringArrayVal{msg} - return true, err - default: - return false, nil - } -} - -func _ColumnResponse_OneofSizer(msg proto.Message) (n int) { - m := msg.(*ColumnResponse) - // columnVal - switch x := m.ColumnVal.(type) { - case *ColumnResponse_StringVal: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.StringVal))) - n += len(x.StringVal) - case *ColumnResponse_Uint64Val: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.Uint64Val)) - case *ColumnResponse_Int64Val: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.Int64Val)) - case *ColumnResponse_BoolVal: - n += 1 // tag and wire - n += 1 - case *ColumnResponse_BlobVal: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.BlobVal))) - n += len(x.BlobVal) - case *ColumnResponse_Uint64ArrayVal: - s := proto.Size(x.Uint64ArrayVal) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *ColumnResponse_StringArrayVal: - s := proto.Size(x.StringArrayVal) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - type InspectRequest struct { Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` Columns *IdsOrKeys `protobuf:"bytes,2,opt,name=columns,proto3" json:"columns,omitempty"` @@ -663,80 +540,14 @@ func (m *IdsOrKeys) GetKeys() *StringArray { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*IdsOrKeys) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _IdsOrKeys_OneofMarshaler, _IdsOrKeys_OneofUnmarshaler, _IdsOrKeys_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*IdsOrKeys) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*IdsOrKeys_Ids)(nil), (*IdsOrKeys_Keys)(nil), } } -func _IdsOrKeys_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*IdsOrKeys) - // type - switch x := m.Type.(type) { - case *IdsOrKeys_Ids: - b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Ids); err != nil { - return err - } - case *IdsOrKeys_Keys: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Keys); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("IdsOrKeys.Type has unexpected type %T", x) - } - return nil -} - -func _IdsOrKeys_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*IdsOrKeys) - switch tag { - case 1: // type.ids - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Uint64Array) - err := b.DecodeMessage(msg) - m.Type = &IdsOrKeys_Ids{msg} - return true, err - case 2: // type.keys - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(StringArray) - err := b.DecodeMessage(msg) - m.Type = &IdsOrKeys_Keys{msg} - return true, err - default: - return false, nil - } -} - -func _IdsOrKeys_OneofSizer(msg proto.Message) (n int) { - m := msg.(*IdsOrKeys) - // type - switch x := m.Type.(type) { - case *IdsOrKeys_Ids: - s := proto.Size(x.Ids) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *IdsOrKeys_Keys: - s := proto.Size(x.Keys) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - func init() { proto.RegisterType((*QueryPQLRequest)(nil), "proto.QueryPQLRequest") proto.RegisterType((*RowResponse)(nil), "proto.RowResponse") @@ -748,6 +559,44 @@ func init() { proto.RegisterType((*IdsOrKeys)(nil), "proto.IdsOrKeys") } +func init() { proto.RegisterFile("pilosa.proto", fileDescriptor_ef0691a44d1e275c) } + +var fileDescriptor_ef0691a44d1e275c = []byte{ + // 498 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0xdf, 0x6b, 0xd4, 0x40, + 0x10, 0xce, 0x5e, 0x72, 0x3f, 0x32, 0x39, 0xce, 0x3a, 0xa8, 0x84, 0x43, 0x24, 0xe6, 0x41, 0x82, + 0x42, 0x95, 0x53, 0x44, 0xa5, 0x2f, 0x56, 0x90, 0x1c, 0x0a,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 0xb5, 0x3a, 0x90, 0xb8, 0x8d, 0x84, 0x83, 0xdb, 0xdd, 0x8f, 0x4f, + 0xc0, 0x4e, 0x13, 0x65, 0xca, 0xbe, 0xcd, 0x6a, 0x2d, 0xc0, 0x08, 0x9c, 0x0b, 0x5e, 0xb5, 0x7d, + 0xfc, 0xdb, 0x55, 0xa3, 0x38, 0x9e, 0x80, 0xa3, 0x07, 0x6f, 0xf5, 0x1b, 0x26, 0x27, 0x66, 0xeb, + 0xf0, 0x1d, 0xcc, 0xda, 0x45, 0xc3, 0x07, 0x4d, 0xe4, 0x8d, 0xcd, 0x5b, 0xb6, 0x19, 0x7b, 0x6b, + 0x15, 0x5a, 0x2f, 0x08, 0xbe, 0x81, 0x69, 0x63, 0x35, 0xb6, 0x7b, 0x32, 0xb4, 0xfe, 0xb6, 0xc8, + 0xcd, 0xc4, 0xc0, 0x2f, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x69, 0x0c, 0xa2, 0x83, 0xfc, 0x03, + 0x00, 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -842,6 +691,17 @@ 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) 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) } @@ -906,40 +766,3 @@ var _Pilosa_serviceDesc = grpc.ServiceDesc{ }, Metadata: "pilosa.proto", } - -func init() { proto.RegisterFile("pilosa.proto", fileDescriptor_ef0691a44d1e275c) } - -var fileDescriptor_ef0691a44d1e275c = []byte{ - // 483 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0x51, 0x6f, 0xd3, 0x30, - 0x10, 0x4e, 0x9a, 0xb4, 0x69, 0x2e, 0x55, 0x19, 0x27, 0x40, 0x51, 0x85, 0x50, 0xc8, 0x03, 0x8a, - 0x40, 0x1a, 0xa8, 0x20, 0x04, 0x68, 0x2f, 0x0c, 0x09, 0xb5, 0x02, 0x89, 0xcd, 0x88, 0xbd, 0xbb, - 0x8b, 0x07, 0xd1, 0xbc, 0x38, 0x8b, 0xd3, 0x41, 0x5e, 0xf8, 0x4b, 0xfc, 0x45, 0x64, 0x27, 0x4e, - 0x93, 0x89, 0xf2, 0x14, 0xe7, 0xfb, 0xbe, 0xbb, 0xf3, 0x7d, 0xbe, 0x83, 0x59, 0x91, 0x71, 0x21, - 0xe9, 0x61, 0x51, 0x8a, 0x4a, 0xe0, 0x58, 0x7f, 0xe2, 0xb7, 0x70, 0xe7, 0x74, 0xcb, 0xca, 0xfa, - 0xe4, 0xf4, 0x33, 0x61, 0xd7, 0x5b, 0x26, 0x2b, 0xbc, 0x07, 0xe3, 0x2c, 0x4f, 0xd9, 0xaf, 0xd0, - 0x8e, 0xec, 0xc4, 0x27, 0xcd, 0x0f, 0x1e, 0x80, 0x53, 0x5c, 0xf3, 0x70, 0xa4, 0x31, 0x75, 0x8c, - 0x2f, 0x21, 0x20, 0xe2, 0x27, 0x61, 0xb2, 0x10, 0xb9, 0x64, 0xf8, 0x0c, 0xbc, 0x1f, 0x8c, 0xa6, - 0xac, 0x94, 0xa1, 0x1d, 0x39, 0x49, 0xb0, 0xbc, 0xdb, 0x54, 0x3a, 0xfc, 0x20, 0xf8, 0xf6, 0x2a, - 0x5f, 0xe7, 0x17, 0x82, 0x18, 0x05, 0x3e, 0x07, 0xef, 0x5c, 0xc3, 0x32, 0x1c, 0x69, 0xf1, 0xfd, - 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, 0x32, 0x5e, 0xb1, 0xf2, 0x63, 0xc6, 0x78, 0x2a, 0x43, - 0x27, 0x72, 0x12, 0x9f, 0x0c, 0xb0, 0xf8, 0x31, 0x04, 0xbd, 0x1e, 0xd5, 0x43, 0xdf, 0x50, 0xde, - 0x4c, 0x94, 0x4b, 0xf4, 0x59, 0x49, 0x7a, 0x8d, 0x0c, 0x24, 0x7e, 0x2b, 0x61, 0xe0, 0x77, 0xf5, - 0xf1, 0x09, 0x38, 0x59, 0x2a, 0xf5, 0xb5, 0xf7, 0x19, 0xa9, 0x04, 0x98, 0x80, 0x7b, 0xc9, 0x6a, - 0xd3, 0xc7, 0xbf, 0x3d, 0xd3, 0x8a, 0xe3, 0x09, 0xb8, 0x6a, 0xac, 0x96, 0xbf, 0x61, 0x72, 0xa2, - 0x77, 0x0a, 0xdf, 0xc1, 0xd4, 0xac, 0x11, 0x3e, 0x68, 0x23, 0x6f, 0xed, 0xd5, 0xc2, 0x64, 0xec, - 0x2d, 0x4d, 0x6c, 0xbd, 0xb0, 0xf1, 0x0d, 0x78, 0xad, 0xd5, 0x68, 0xb6, 0x60, 0x68, 0xfd, 0xbe, - 0xc8, 0xcd, 0x44, 0xc3, 0x2f, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xe2, 0xfa, 0x94, 0xa4, 0xda, - 0x03, 0x00, 0x00, -} diff --git a/proto/pilosa.proto b/proto/pilosa.proto index ae6e40860..cd5afa92c 100644 --- a/proto/pilosa.proto +++ b/proto/pilosa.proto @@ -26,6 +26,7 @@ message ColumnResponse{ bytes blobVal = 5; Uint64Array uint64ArrayVal = 6; StringArray stringArrayVal = 7; + double float64Val = 8; } } diff --git a/server/grpc.go b/server/grpc.go index f35113001..92a8febc1 100644 --- a/server/grpc.go +++ b/server/grpc.go @@ -109,7 +109,7 @@ func (h grpcHandler) Inspect(req *pb.InspectRequest, stream pb.Pilosa_InspectSer } resp, err := h.api.Query(context.Background(), &query) if err != nil { - return errors.Wrap(err, "querying rows") + return errors.Wrapf(err, "querying rows for set: %s", pql) } ids, ok := resp.Results[0].(pilosa.RowIdentifiers) @@ -133,7 +133,7 @@ func (h grpcHandler) Inspect(req *pb.InspectRequest, stream pb.Pilosa_InspectSer } resp, err := h.api.Query(context.Background(), &query) if err != nil { - return errors.Wrap(err, "querying rows") + return errors.Wrap(err, "querying rows for mutex") } ids, ok := resp.Results[0].(pilosa.RowIdentifiers) @@ -163,7 +163,17 @@ func (h grpcHandler) Inspect(req *pb.InspectRequest, stream pb.Pilosa_InspectSer rowResp.Columns = append(rowResp.Columns, &pb.ColumnResponse{ColumnVal: nil}) } - + case "decimal": + value, exists, err := field.FloatValue(col) + if err != nil { + return errors.Wrap(err, "getting decimal field value for column") + } else if exists { + rowResp.Columns = append(rowResp.Columns, + &pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_Float64Val{value}}) + } else { + rowResp.Columns = append(rowResp.Columns, + &pb.ColumnResponse{ColumnVal: nil}) + } case "bool": pql := fmt.Sprintf("Rows(%s, column=%d)", field.Name(), col) query := pilosa.QueryRequest{ @@ -172,7 +182,7 @@ func (h grpcHandler) Inspect(req *pb.InspectRequest, stream pb.Pilosa_InspectSer } resp, err := h.api.Query(context.Background(), &query) if err != nil { - return errors.Wrap(err, "querying rows") + return errors.Wrap(err, "querying rows for bool") } ids, ok := resp.Results[0].(pilosa.RowIdentifiers) @@ -227,7 +237,7 @@ func (h grpcHandler) Inspect(req *pb.InspectRequest, stream pb.Pilosa_InspectSer } resp, err := h.api.Query(context.Background(), &query) if err != nil { - return errors.Wrap(err, "querying rows") + return errors.Wrap(err, "querying set rows(keys)") } ids, ok := resp.Results[0].(pilosa.RowIdentifiers) @@ -251,7 +261,7 @@ func (h grpcHandler) Inspect(req *pb.InspectRequest, stream pb.Pilosa_InspectSer } resp, err := h.api.Query(context.Background(), &query) if err != nil { - return errors.Wrap(err, "querying rows") + return errors.Wrap(err, "querying mutex rows(keys)") } ids, ok := resp.Results[0].(pilosa.RowIdentifiers) @@ -287,6 +297,23 @@ func (h grpcHandler) Inspect(req *pb.InspectRequest, stream pb.Pilosa_InspectSer rowResp.Columns = append(rowResp.Columns, &pb.ColumnResponse{ColumnVal: nil}) } + case "decimal": + // Translate column key. + id, err := index.TranslateStore().TranslateKey(col) + if err != nil { + return errors.Wrap(err, "translating column key") + } + + value, exists, err := field.FloatValue(id) + if err != nil { + return errors.Wrap(err, "getting decimal field value for column") + } else if exists { + rowResp.Columns = append(rowResp.Columns, + &pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_Float64Val{value}}) + } else { + rowResp.Columns = append(rowResp.Columns, + &pb.ColumnResponse{ColumnVal: nil}) + } case "bool": pql := fmt.Sprintf("Rows(%s, column=\"%s\")", field.Name(), col) @@ -296,7 +323,7 @@ func (h grpcHandler) Inspect(req *pb.InspectRequest, stream pb.Pilosa_InspectSer } resp, err := h.api.Query(context.Background(), &query) if err != nil { - return errors.Wrap(err, "querying rows") + return errors.Wrap(err, "querying bool rows(keys)") } ids, ok := resp.Results[0].(pilosa.RowIdentifiers)