mirror of https://github.com/tidwall/tile38.git
Copy array and only loop if we need to pad.
This commit is contained in:
parent
91ef777771
commit
27c6980f82
|
@ -248,12 +248,10 @@ func (sw *scanWriter) fieldMatch(fields []float64, o geojson.Object) (fvals []fl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for idx := range sw.farr {
|
copy(sw.fvals, fields)
|
||||||
var value float64
|
// fields might be shorter for this item, need to pad sw.fvals with zeros
|
||||||
if len(fields) > idx {
|
for i := len(fields); i < len(sw.fvals); i++ {
|
||||||
value = fields[idx]
|
sw.fvals[i] = 0
|
||||||
}
|
|
||||||
sw.fvals[idx] = value
|
|
||||||
}
|
}
|
||||||
for _, where := range sw.wheres {
|
for _, where := range sw.wheres {
|
||||||
if where.field == "z" {
|
if where.field == "z" {
|
||||||
|
@ -267,21 +265,13 @@ func (sw *scanWriter) fieldMatch(fields []float64, o geojson.Object) (fvals []fl
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
var value float64
|
value := sw.fvals[sw.fmap[where.field]]
|
||||||
idx, ok := sw.fmap[where.field]
|
|
||||||
if ok {
|
|
||||||
value = sw.fvals[idx]
|
|
||||||
}
|
|
||||||
if !where.match(value) {
|
if !where.match(value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, wherein := range sw.whereins {
|
for _, wherein := range sw.whereins {
|
||||||
var value float64
|
value := sw.fvals[sw.fmap[wherein.field]]
|
||||||
idx, ok := sw.fmap[wherein.field]
|
|
||||||
if ok {
|
|
||||||
value = sw.fvals[idx]
|
|
||||||
}
|
|
||||||
if !wherein.match(value) {
|
if !wherein.match(value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue