Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(319)

Side by Side Diff: filter/txnBuf/query_merger.go

Issue 2342063003: Differentiate between single- and multi- props. (Closed)
Patch Set: Slice is now always a clone. This is marginally worse performance, but a much safer UI. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « filter/featureBreaker/featurebreaker_test.go ('k') | filter/txnBuf/txnbuf_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package txnBuf 5 package txnBuf
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "sort" 9 "sort"
10 10
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 // The result of this function is the series of serialized properties, one per 255 // The result of this function is the series of serialized properties, one per
256 // order column, which represent this key/pm's first entry in the composite 256 // order column, which represent this key/pm's first entry in the composite
257 // index that would point to it (e.g. the one with `order` sort orders). 257 // index that would point to it (e.g. the one with `order` sort orders).
258 func toComparableString(start, end []byte, order []ds.IndexColumn, k *ds.Key, pm ds.PropertyMap) (row, key []byte) { 258 func toComparableString(start, end []byte, order []ds.IndexColumn, k *ds.Key, pm ds.PropertyMap) (row, key []byte) {
259 doCmp := true 259 doCmp := true
260 soFar := []byte{} 260 soFar := []byte{}
261 ps := serialize.PropertyMapPartially(k, nil) 261 ps := serialize.PropertyMapPartially(k, nil)
262 for _, ord := range order { 262 for _, ord := range order {
263 row, ok := ps[ord.Property] 263 row, ok := ps[ord.Property]
264 if !ok { 264 if !ok {
265 » » » if vals, ok := pm[ord.Property]; ok { 265 » » » if pslice := pm.Slice(ord.Property); len(pslice) > 0 {
266 » » » » row = serialize.PropertySlice(vals) 266 » » » » row = serialize.PropertySlice(pslice)
267 } 267 }
268 } 268 }
269 sort.Sort(row) 269 sort.Sort(row)
270 foundOne := false 270 foundOne := false
271 for _, serialized := range row { 271 for _, serialized := range row {
272 if ord.Descending { 272 if ord.Descending {
273 serialized = serialize.Invert(serialized) 273 serialized = serialize.Invert(serialized)
274 } 274 }
275 if doCmp { 275 if doCmp {
276 maybe := serialize.Join(soFar, serialized) 276 maybe := serialize.Join(soFar, serialized)
(...skipping 12 matching lines...) Expand all
289 } 289 }
290 if !foundOne { 290 if !foundOne {
291 return nil, nil 291 return nil, nil
292 } 292 }
293 } 293 }
294 if end != nil && bytes.Compare(soFar, end) >= 0 { 294 if end != nil && bytes.Compare(soFar, end) >= 0 {
295 return nil, nil 295 return nil, nil
296 } 296 }
297 return soFar, ps["__key__"][0] 297 return soFar, ps["__key__"][0]
298 } 298 }
OLDNEW
« no previous file with comments | « filter/featureBreaker/featurebreaker_test.go ('k') | filter/txnBuf/txnbuf_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698