mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-20 15:16:42 +00:00
wip
This commit is contained in:
parent
9f8dd1ef31
commit
51b869d458
2 changed files with 10 additions and 7 deletions
|
@ -231,6 +231,10 @@ func ParseQuery(s string) (*Query, error) {
|
||||||
}
|
}
|
||||||
q.pipes = pipes
|
q.pipes = pipes
|
||||||
|
|
||||||
|
if !lex.isEnd() {
|
||||||
|
return nil, fmt.Errorf("unexpected unparsed tail; context: %s", lex.context())
|
||||||
|
}
|
||||||
|
|
||||||
return q, nil
|
return q, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ func (dpp defaultPipeProcessor) flush() {
|
||||||
|
|
||||||
func parsePipes(lex *lexer) ([]pipe, error) {
|
func parsePipes(lex *lexer) ([]pipe, error) {
|
||||||
var pipes []pipe
|
var pipes []pipe
|
||||||
for !lex.isEnd() {
|
for !lex.isKeyword(")", "") {
|
||||||
if !lex.isKeyword("|") {
|
if !lex.isKeyword("|") {
|
||||||
return nil, fmt.Errorf("expecting '|'")
|
return nil, fmt.Errorf("expecting '|'")
|
||||||
}
|
}
|
||||||
|
@ -151,14 +151,14 @@ func parseFieldsPipe(lex *lexer) (*fieldsPipe, error) {
|
||||||
field := parseFieldName(lex)
|
field := parseFieldName(lex)
|
||||||
fields = append(fields, field)
|
fields = append(fields, field)
|
||||||
switch {
|
switch {
|
||||||
case lex.isKeyword("|", ""):
|
case lex.isKeyword("|", ")", ""):
|
||||||
fp := &fieldsPipe{
|
fp := &fieldsPipe{
|
||||||
fields: fields,
|
fields: fields,
|
||||||
}
|
}
|
||||||
return fp, nil
|
return fp, nil
|
||||||
case lex.isKeyword(","):
|
case lex.isKeyword(","):
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unexpected token: %q; expecting ',' or '|'", lex.token)
|
return nil, fmt.Errorf("unexpected token: %q; expecting ',', '|' or ')'", lex.token)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -244,8 +244,7 @@ type statsPipeProcessor struct {
|
||||||
type statsPipeProcessorShard struct {
|
type statsPipeProcessorShard struct {
|
||||||
statsPipeProcessorShardNopad
|
statsPipeProcessorShardNopad
|
||||||
|
|
||||||
// The padding prevents false sharing on widespread platforms with
|
// The padding prevents false sharing on widespread platforms with 128 mod (cache line size) = 0 .
|
||||||
// 128 mod (cache line size) = 0 .
|
|
||||||
_ [128 - unsafe.Sizeof(statsPipeProcessorShardNopad{})%128]byte
|
_ [128 - unsafe.Sizeof(statsPipeProcessorShardNopad{})%128]byte
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,12 +443,12 @@ func parseStatsPipe(lex *lexer) (*statsPipe, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
funcs = append(funcs, sf)
|
funcs = append(funcs, sf)
|
||||||
if lex.isKeyword("|", "") {
|
if lex.isKeyword("|", ")", "") {
|
||||||
sp.funcs = funcs
|
sp.funcs = funcs
|
||||||
return &sp, nil
|
return &sp, nil
|
||||||
}
|
}
|
||||||
if !lex.isKeyword(",") {
|
if !lex.isKeyword(",") {
|
||||||
return nil, fmt.Errorf("unexpected token %q; want ',' or '|'", lex.token)
|
return nil, fmt.Errorf("unexpected token %q; want ',', '|' or ')'", lex.token)
|
||||||
}
|
}
|
||||||
lex.nextToken()
|
lex.nextToken()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue