mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/logstorage: allow typing asc
in sort
pipe for the sake of consistency with desc
This commit is contained in:
parent
68c07b0599
commit
96c29ab403
2 changed files with 9 additions and 3 deletions
|
@ -725,9 +725,12 @@ func parsePipeSort(lex *lexer) (*pipeSort, error) {
|
|||
ps.byFields = bfs
|
||||
}
|
||||
|
||||
if lex.isKeyword("desc") {
|
||||
switch {
|
||||
case lex.isKeyword("desc"):
|
||||
lex.nextToken()
|
||||
ps.isDesc = true
|
||||
case lex.isKeyword("asc"):
|
||||
lex.nextToken()
|
||||
}
|
||||
|
||||
for {
|
||||
|
@ -797,9 +800,12 @@ func parseBySortFields(lex *lexer) ([]*bySortField, error) {
|
|||
bf := &bySortField{
|
||||
name: fieldName,
|
||||
}
|
||||
if lex.isKeyword("desc") {
|
||||
switch {
|
||||
case lex.isKeyword("desc"):
|
||||
lex.nextToken()
|
||||
bf.isDesc = true
|
||||
case lex.isKeyword("asc"):
|
||||
lex.nextToken()
|
||||
}
|
||||
bfs = append(bfs, bf)
|
||||
switch {
|
||||
|
|
|
@ -60,7 +60,7 @@ func TestPipeSort(t *testing.T) {
|
|||
})
|
||||
|
||||
// Sort by a single field
|
||||
f("sort by (a)", [][]Field{
|
||||
f("sort by (a asc) asc", [][]Field{
|
||||
{
|
||||
{"_msg", `abc`},
|
||||
{"a", `2`},
|
||||
|
|
Loading…
Reference in a new issue