more fixes

This commit is contained in:
Matt Jaffee 2018-05-25 10:56:47 -05:00
parent f7f20c6595
commit ca530b1fc3
No known key found for this signature in database
GPG key ID: 08A3DFFF987B11BF
4 changed files with 17 additions and 16 deletions

View file

@ -448,28 +448,28 @@ func TestFragment_FieldRange(t *testing.T) {
t.Fatal(err)
}
// Query for fields greater than (ending with unset column).
// Query for fields greater than (ending with unset bit).
if b, err := f.FieldRange(pql.GT, bitDepth, 300); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(b.Columns(), []uint64{1000, 3000, 4000}) {
t.Fatalf("unexpected columns: %+v", b.Columns())
}
// Query for fields greater than (ending with set column).
// Query for fields greater than (ending with set bit).
if b, err := f.FieldRange(pql.GT, bitDepth, 301); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(b.Columns(), []uint64{1000, 3000}) {
t.Fatalf("unexpected columns: %+v", b.Columns())
}
// Query for fields greater than or equal to (ending with unset column).
// Query for fields greater than or equal to (ending with unset bit).
if b, err := f.FieldRange(pql.GTE, bitDepth, 300); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(b.Columns(), []uint64{1000, 2000, 3000, 4000}) {
t.Fatalf("unexpected columns: %+v", b.Columns())
}
// Query for fields greater than or equal to (ending with set column).
// Query for fields greater than or equal to (ending with set bit).
if b, err := f.FieldRange(pql.GTE, bitDepth, 301); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(b.Columns(), []uint64{1000, 3000, 4000}) {
@ -838,7 +838,7 @@ func TestFragment_Blocks(t *testing.T) {
// Retrieve initial checksum.
var prev []pilosa.FragmentBlock
// Set first column.
// Set first bit.
if _, err := f.SetBit(0, 0); err != nil {
t.Fatal(err)
}
@ -976,7 +976,7 @@ func TestFragment_WriteTo_ReadFrom(t *testing.T) {
f0 := test.MustOpenFragment("i", "f", pilosa.ViewStandard, 0, "")
defer f0.Close()
// Set and then clear columns on the fragment.
// Set and then clear bits on the fragment.
if _, err := f0.SetBit(1000, 1); err != nil {
t.Fatal(err)
} else if _, err := f0.SetBit(1000, 2); err != nil {

View file

@ -466,7 +466,7 @@ func (h *Holder) flushCaches() {
// RecalculateCaches recalculates caches on every index in the holder. This is
// probably not practical to call in real-world workloads, but makes writing
// integration tests much eaiser, since one doesn't have to wait 10 seconds
// after setting columns to get expected response.
// after setting bits to get expected response.
func (h *Holder) RecalculateCaches() {
for _, index := range h.Indexes() {
index.RecalculateCaches()

View file

@ -330,7 +330,7 @@ func TestHolder_DeleteIndex(t *testing.T) {
hldr := test.MustOpenHolder()
defer hldr.Close()
// Write columns to separate indexes.
// Write bits to separate indexes.
f0 := hldr.MustCreateFragmentIfNotExists("i0", "f", pilosa.ViewStandard, 0)
if _, err := f0.SetBit(100, 200); err != nil {
t.Fatal(err)

17
row.go
View file

@ -22,7 +22,8 @@ import (
"github.com/pilosa/pilosa/roaring"
)
// Row represents a set of columns.
// Row is a set of integers (the associated columns), and attributes which are
// arbitrary key/value pairs storing metadata about what the row represents.
type Row struct {
segments []RowSegment
@ -115,7 +116,7 @@ func (r *Row) Xor(other *Row) *Row {
return &Row{segments: segments}
}
// Union returns the columnwise union of r and other.
// Union returns the bitwise union of r and other.
func (r *Row) Union(other *Row) *Row {
var segments []RowSegment
itr := newMergeSegmentIterator(r.segments, other.segments)
@ -226,7 +227,7 @@ func (r *Row) DecrementCount(i uint64) {
}
}
// Count returns the number of set columns in the row.
// Count returns the number of columns in the row.
func (r *Row) Count() uint64 {
var n uint64
for i := range r.segments {
@ -238,8 +239,8 @@ func (r *Row) Count() uint64 {
// MarshalJSON returns a JSON-encoded byte slice of r.
func (r *Row) MarshalJSON() ([]byte, error) {
var o struct {
Attrs map[string]interface{} `json:"attrs"`
Columns []uint64 `json:"columns"`
Attrs map[string]interface{} `json:"attrs"`
Columns []uint64 `json:"columns"`
}
o.Columns = r.Columns()
@ -267,8 +268,8 @@ func encodeRow(r *Row) *internal.Row {
}
return &internal.Row{
Columns: r.Columns(),
Attrs: encodeAttrs(r.Attrs),
Columns: r.Columns(),
Attrs: encodeAttrs(r.Attrs),
}
}
@ -339,7 +340,7 @@ func (s *RowSegment) Intersect(other *RowSegment) *RowSegment {
}
}
// Union returns the columnwise union of s and other.
// Union returns the bitwise union of s and other.
func (s *RowSegment) Union(other *RowSegment) *RowSegment {
data := s.data.Union(&other.data)