mirror of
https://github.com/minio/minio.git
synced 2025-11-09 13:39:46 -05:00
select: Return early from bool AND, OR (#13914)
Return as soon as an AND fails and whenever an OR succeeds. Faster and more flexible. For example makes `select * from S3object where _2 != '' AND _2 > 1` able to operate on empty fields. Followup to #13900
This commit is contained in:
@@ -69,6 +69,9 @@ func (e *Expression) evalNode(r Record, tableAlias string) (*Value, error) {
|
||||
if !ok {
|
||||
return nil, errExpectedBool
|
||||
}
|
||||
if b {
|
||||
return FromBool(true), nil
|
||||
}
|
||||
result = result || b
|
||||
}
|
||||
return FromBool(result), nil
|
||||
@@ -91,6 +94,9 @@ func (e *AndCondition) evalNode(r Record, tableAlias string) (*Value, error) {
|
||||
if !ok {
|
||||
return nil, errExpectedBool
|
||||
}
|
||||
if !b {
|
||||
return FromBool(false), nil
|
||||
}
|
||||
result = result && b
|
||||
}
|
||||
return FromBool(result), nil
|
||||
|
||||
Reference in New Issue
Block a user