Refuse duplicate aggregate columns and page aggregates after the fold
A repeated extract function names one response column twice, which openvoxdb aliases as <name>_2: unknown to the merge spec, it froze at the first backend's value. A limit pushed upstream truncated each backend's groups before the cross-backend fold, so a group could be partly counted or missed. - Refuses any extract projecting one response column twice, naming the clash - Fetches every group and applies limit/offset after the fold - Documents the float64 avg divergence from Postgres numeric
This commit is contained in:
+20
-4
@@ -219,10 +219,7 @@ func parsePaging(v url.Values) (paging, error) {
|
||||
|
||||
// Backends are asked for the first offset+limit records with no offset; the offset is applied to the union instead.
|
||||
func (p paging) upstreamParams(in url.Values) url.Values {
|
||||
out := url.Values{}
|
||||
for k, vs := range in {
|
||||
out[k] = append([]string(nil), vs...)
|
||||
}
|
||||
out := copyParams(in)
|
||||
out.Del("offset")
|
||||
if p.limit >= 0 {
|
||||
out.Set("limit", strconv.Itoa(p.limit+p.offset))
|
||||
@@ -230,6 +227,25 @@ func (p paging) upstreamParams(in url.Values) url.Values {
|
||||
return out
|
||||
}
|
||||
|
||||
// unpagedParams is upstreamParams for a response whose rows are folded together:
|
||||
// a backend's own first N groups are not the merged result's first N, and a
|
||||
// group truncated away on one backend folds to a wrong value, so every group is
|
||||
// fetched and the window is cut after the fold.
|
||||
func unpagedParams(in url.Values) url.Values {
|
||||
out := copyParams(in)
|
||||
out.Del("offset")
|
||||
out.Del("limit")
|
||||
return out
|
||||
}
|
||||
|
||||
func copyParams(in url.Values) url.Values {
|
||||
out := url.Values{}
|
||||
for k, vs := range in {
|
||||
out[k] = append([]string(nil), vs...)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func (p paging) apply(recs []json.RawMessage) []json.RawMessage {
|
||||
if p.offset >= len(recs) {
|
||||
return []json.RawMessage{}
|
||||
|
||||
Reference in New Issue
Block a user