mirror of
https://github.com/minio/minio.git
synced 2025-11-09 13:39:46 -05:00
fix: SQL select to honor limits properly for array queries (#13568)
added tests to cover the scenarios as well.
This commit is contained in:
@@ -332,6 +332,7 @@ func TestFromClauseJSONPath(t *testing.T) {
|
||||
"select * from s3object[*].books[*].name as s",
|
||||
"select * from s3object s where name > 2",
|
||||
"select * from s3object[*].name as s where name > 2",
|
||||
"select * from s3object[*].books[*] limit 1",
|
||||
}
|
||||
for i, tc := range cases {
|
||||
err := p.ParseString(tc, &s)
|
||||
|
||||
@@ -302,9 +302,8 @@ func (e *SelectStatement) Eval(input, output Record) (Record, error) {
|
||||
// .. WHERE ..`
|
||||
|
||||
// Update count of records output.
|
||||
if e.limitValue > -1 {
|
||||
e.outputCount++
|
||||
}
|
||||
e.outputCount++
|
||||
|
||||
return input.Clone(output), nil
|
||||
}
|
||||
|
||||
@@ -328,9 +327,7 @@ func (e *SelectStatement) Eval(input, output Record) (Record, error) {
|
||||
}
|
||||
|
||||
// Update count of records output.
|
||||
if e.limitValue > -1 {
|
||||
e.outputCount++
|
||||
}
|
||||
e.outputCount++
|
||||
|
||||
return output, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user