Skip to content
This repository has been archived by the owner on Oct 17, 2018. It is now read-only.

Commit

Permalink
Shortcut aggregation id decompression (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
cw9 committed Jun 12, 2017
1 parent a8d3dce commit f55a389
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions policy/aggregation_id_compress.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ func NewPooledAggregationIDDecompressor(pool AggregationTypesPool) AggregationID
}

func (c *aggregationIDDecompressor) Decompress(id AggregationID) (AggregationTypes, error) {
if id.IsDefault() {
return DefaultAggregationTypes, nil
}
// NB(cw) it's guaranteed that len(c.buf) == len(id) == AggregationIDLen, we need to copy
// the words from id into a slice to be used in bitset.
for i := range id {
Expand Down
2 changes: 1 addition & 1 deletion policy/aggregation_id_compress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestAggregationIDCompressRoundTrip(t *testing.T) {
result AggregationTypes
expectErr bool
}{
{DefaultAggregationTypes, AggregationTypes{}, false},
{DefaultAggregationTypes, DefaultAggregationTypes, false},
{[]AggregationType{Unknown}, DefaultAggregationTypes, true},
{[]AggregationType{Lower, Upper}, []AggregationType{Lower, Upper}, false},
{[]AggregationType{Last}, []AggregationType{Last}, false},
Expand Down

0 comments on commit f55a389

Please sign in to comment.