revert a bunch of stuff and fix some comments

This commit is contained in:
Matt Jaffee 2018-05-24 16:35:27 -05:00
parent e3da6efe3c
commit 4ef266e5cc
No known key found for this signature in database
GPG key ID: 08A3DFFF987B11BF
20 changed files with 171 additions and 171 deletions

View file

@ -469,7 +469,7 @@ type BitmapCache interface {
// SimpleCache implements BitmapCache
// it is meant to be a short-lived cache for cases where writes are continuing to access
// the same column within a short time frame (i.e. good for write-heavy loads)
// the same row within a short time frame (i.e. good for write-heavy loads)
// A read-heavy use case would cause the cache to get bigger, potentially causing the
// node to run out of memory.
type SimpleCache struct {

View file

@ -308,7 +308,7 @@ func (c *InternalHTTPClient) Import(ctx context.Context, index, frame string, sl
return nil
}
// ImportK bulk imports columns to a host.
// ImportK bulk imports bits specified by string keys to a host.
func (c *InternalHTTPClient) ImportK(ctx context.Context, index, frame string, columns []Bit) error {
if index == "" {
return ErrIndexRequired
@ -356,7 +356,7 @@ func marshalImportPayload(index, frame string, slice uint64, bits []Bit) ([]byte
columnIDs := Bits(bits).ColumnIDs()
timestamps := Bits(bits).Timestamps()
// Marshal columns to protobufs.
// Marshal data to protobuf.
buf, err := proto.Marshal(&internal.ImportRequest{
Index: index,
Frame: frame,
@ -378,7 +378,7 @@ func marshalImportPayloadK(index, frame string, bits []Bit) ([]byte, error) {
columnKeys := Bits(bits).ColumnKeys()
timestamps := Bits(bits).Timestamps()
// Marshal columns to protobufs.
// Marshal data to protobuf.
buf, err := proto.Marshal(&internal.ImportRequest{
Index: index,
Frame: frame,
@ -465,7 +465,7 @@ func marshalImportValuePayload(index, frame, field string, slice uint64, vals []
columnIDs := FieldValues(vals).ColumnIDs()
values := FieldValues(vals).Values()
// Marshal columns to protobufs.
// Marshal data to protobuf.
buf, err := proto.Marshal(&internal.ImportValueRequest{
Index: index,
Frame: frame,
@ -1140,7 +1140,8 @@ func (c *InternalHTTPClient) SendMessage(ctx context.Context, uri *URI, pb proto
return nil
}
// Bit represents the location of a the intersection of a row and a column.
// Bit represents the intersection of a row and a column. It can be specifed by
// integer ids or string keys.
type Bit struct {
RowID uint64
ColumnID uint64
@ -1149,7 +1150,7 @@ type Bit struct {
Timestamp int64
}
// Bits represents a slice of Bit.
// Bits is a slice of Bit.
type Bits []Bit
func (p Bits) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
@ -1210,17 +1211,17 @@ func (p Bits) Timestamps() []int64 {
return other
}
// GroupBySlice returns a map of columns by slice.
// GroupBySlice returns a map of bits by slice.
func (p Bits) GroupBySlice() map[uint64][]Bit {
m := make(map[uint64][]Bit)
for _, column := range p {
slice := column.ColumnID / SliceWidth
m[slice] = append(m[slice], column)
for _, bit := range p {
slice := bit.ColumnID / SliceWidth
m[slice] = append(m[slice], bit)
}
for slice, columns := range m {
sort.Sort(Bits(columns))
m[slice] = columns
for slice, bits := range m {
sort.Sort(Bits(bits))
m[slice] = bits
}
return m
@ -1277,7 +1278,7 @@ func (p FieldValues) GroupBySlice() map[uint64][]FieldValue {
return m
}
// BitsByPos represents a slice of columns sorted by internal position.
// BitsByPos is a slice of bits sorted row then column.
type BitsByPos []Bit
func (p BitsByPos) Swap(i, j int) { p[i], p[j] = p[j], p[i] }

View file

@ -502,11 +502,11 @@ func TestClient_FragmentBlocks(t *testing.T) {
hldr := test.MustOpenHolder()
defer hldr.Close()
// Set two columns on blocks 0 & 3.
// Set two bits on blocks 0 & 3.
hldr.MustCreateFragmentIfNotExists("i", "f", pilosa.ViewStandard, 0).SetBit(0, 1)
hldr.MustCreateFragmentIfNotExists("i", "f", pilosa.ViewStandard, 0).SetBit(pilosa.HashBlockSize*3, 100)
// Set a column on a different slice.
// Set a bit on a different slice.
hldr.MustCreateFragmentIfNotExists("i", "f", pilosa.ViewStandard, 1).SetBit(0, 1)
s := test.NewServer()

View file

@ -930,7 +930,7 @@ func (c *Cluster) Open() error {
// (and now in a state of STARTING) so that it can be put to the correct
// cluster state.
// TODO: Because the normal code path already sends a NodeJoin event (via
// memberlist), this it a column redundant in most cases. Perhaps determine
// memberlist), this it a bit redundant in most cases. Perhaps determine
// that the node has been restarted and don't do this step.
msg := &internal.NodeEventMessage{
Event: uint32(NodeJoin),

View file

@ -476,7 +476,7 @@ func TestCluster_ResizeStates(t *testing.T) {
t.Errorf("expected node1 topology: %v, but got: %v", expectedTop.NodeIDs, node1.Topology.NodeIDs)
}
// Columns
// Bits
// Verify that node-1 contains the fragment (i/f/standard/1) transferred from node-0.
node1Frame := node1.Holder.Frame("i", "f")
node1View := node1Frame.View("standard")

View file

@ -45,7 +45,7 @@ Executes a benchmark for a given operation against the index.
flags.StringVarP(&Bencher.Host, "host", "", "localhost:10101", "host:port of Pilosa.")
flags.StringVarP(&Bencher.Index, "index", "i", "", "Pilosa index to benchmark.")
flags.StringVarP(&Bencher.Frame, "frame", "f", "", "Frame to benchmark.")
flags.StringVarP(&Bencher.Op, "operation", "o", "set-column", "Operation to perform: choose from [set-column]")
flags.StringVarP(&Bencher.Op, "operation", "o", "set-bit", "Operation to perform: choose from [set-bit]")
flags.IntVarP(&Bencher.N, "num", "n", 0, "Number of operations to perform.")
ctl.SetTLSConfig(flags, &Bencher.TLS.CertificatePath, &Bencher.TLS.CertificateKeyPath, &Bencher.TLS.SkipVerify)

View file

@ -33,7 +33,7 @@ func TestBenchHelp(t *testing.T) {
func TestBenchConfig(t *testing.T) {
tests := []commandTest{
{
args: []string{"bench", "--operation", "set-column"},
args: []string{"bench", "--operation", "set-bit"},
env: map[string]string{"PILOSA_HOST": "localhost:12345"},
cfgFileContent: `
index = "myindex"
@ -44,7 +44,7 @@ frame = "f1"
v.Check(cmd.Bencher.Host, "localhost:12345")
v.Check(cmd.Bencher.Index, "myindex")
v.Check(cmd.Bencher.Frame, "f1")
v.Check(cmd.Bencher.Op, "set-column")
v.Check(cmd.Bencher.Op, "set-bit")
v.Check(cmd.Bencher.N, 0)
return v.Error()
},

View file

@ -32,7 +32,7 @@ func NewImportCommand(stdin io.Reader, stdout, stderr io.Writer) *cobra.Command
importCmd := &cobra.Command{
Use: "import",
Short: "Bulk load data into pilosa.",
Long: `Bulk imports one or more CSV files to a host's index and frame. The columns
Long: `Bulk imports one or more CSV files to a host's index and frame. The data
of the CSV file are grouped by slice for the most efficient import.
The format of the CSV file is:
@ -57,7 +57,7 @@ omitted. If it is present then its format should be YYYY-MM-DDTHH:MM.
flags.StringVarP(&Importer.Frame, "frame", "f", "", "Frame to import into.")
flags.StringVarP(&Importer.Field, "field", "", "", "Field to import into.")
flags.BoolVar(&Importer.StringKeys, "string-keys", false, "Treat payload as string keys.")
flags.IntVarP(&Importer.BufferSize, "buffer-size", "s", 10000000, "Number of columns to buffer/sort before importing.")
flags.IntVarP(&Importer.BufferSize, "buffer-size", "s", 10000000, "Number of bits to buffer/sort before importing.")
flags.BoolVarP(&Importer.Sort, "sort", "", false, "Enables sorting before import.")
flags.BoolVarP(&Importer.CreateSchema, "create", "e", false, "Create the schema if it does not exist before import.")
flags.Var(&Importer.FrameOptions.TimeQuantum, "frame-time-quantum", "Time quantum for the frame")

View file

@ -62,7 +62,7 @@ func (cmd *BenchCommand) Run(ctx context.Context) error {
}
switch cmd.Op {
case "set-column":
case "set-bit":
return cmd.runSetBit(ctx, client)
case "":
return errors.New("op required")

View file

@ -56,7 +56,7 @@ func TestBenchCommand_Run(t *testing.T) {
r, w, _ := os.Pipe()
cm := NewBenchCommand(stdin, w, w)
cm.Op = "set-column"
cm.Op = "set-bit"
cm.Host = "localhost:10101"
err := cm.Run(context.Background())

View file

@ -107,7 +107,6 @@ func (cmd *ImportCommand) Run(ctx context.Context) error {
// Import each path and import by slice.
for _, path := range cmd.Paths {
// Parse path into columns.
logger.Printf("parsing: %s", path)
if err := cmd.importPath(ctx, path); err != nil {
return err
@ -129,22 +128,22 @@ func (cmd *ImportCommand) ensureSchema(ctx context.Context) error {
return nil
}
// importPath parses a path into columns and imports it to the server.
// importPath parses a path into bits and imports it to the server.
func (cmd *ImportCommand) importPath(ctx context.Context, path string) error {
// If a field is provided, treat the import data as values to be range-encoded.
if cmd.Field != "" {
return cmd.bufferFieldValues(ctx, path)
} else {
if cmd.StringKeys {
return cmd.bufferColumnsK(ctx, path)
return cmd.bufferBitsK(ctx, path)
} else {
return cmd.bufferColumns(ctx, path)
return cmd.bufferBits(ctx, path)
}
}
}
// bufferColumns buffers slices of columns to be imported as a batch.
func (cmd *ImportCommand) bufferColumns(ctx context.Context, path string) error {
// bufferBits buffers slices of bits to be imported as a batch.
func (cmd *ImportCommand) bufferBits(ctx context.Context, path string) error {
a := make([]pilosa.Bit, 0, cmd.BufferSize)
var r *csv.Reader
@ -157,7 +156,7 @@ func (cmd *ImportCommand) bufferColumns(ctx context.Context, path string) error
}
defer f.Close()
// Read rows as columns.
// Read rows as bits.
r = csv.NewReader(f)
} else {
r = csv.NewReader(cmd.Stdin)
@ -183,21 +182,21 @@ func (cmd *ImportCommand) bufferColumns(ctx context.Context, path string) error
return fmt.Errorf("bad column count on row %d: col=%d", rnum, len(record))
}
var column pilosa.Bit
var bit pilosa.Bit
// Parse row id.
rowID, err := strconv.ParseUint(record[0], 10, 64)
if err != nil {
return fmt.Errorf("invalid row id on row %d: %q", rnum, record[0])
}
column.RowID = rowID
bit.RowID = rowID
// Parse column id.
columnID, err := strconv.ParseUint(record[1], 10, 64)
if err != nil {
return fmt.Errorf("invalid column id on row %d: %q", rnum, record[1])
}
column.ColumnID = columnID
bit.ColumnID = columnID
// Parse time, if exists.
if len(record) > 2 && record[2] != "" {
@ -205,37 +204,37 @@ func (cmd *ImportCommand) bufferColumns(ctx context.Context, path string) error
if err != nil {
return fmt.Errorf("invalid timestamp on row %d: %q", rnum, record[2])
}
column.Timestamp = t.UnixNano()
bit.Timestamp = t.UnixNano()
}
a = append(a, column)
a = append(a, bit)
// If we've reached the buffer size then import columns.
// If we've reached the buffer size then import bits.
if len(a) == cmd.BufferSize {
if err := cmd.importColumns(ctx, a); err != nil {
if err := cmd.importBits(ctx, a); err != nil {
return err
}
a = a[:0]
}
}
// If there are still columns in the buffer then flush them.
if err := cmd.importColumns(ctx, a); err != nil {
// If there are still bits in the buffer then flush them.
if err := cmd.importBits(ctx, a); err != nil {
return err
}
return nil
}
// importColumns sends batches of columns to the server.
func (cmd *ImportCommand) importColumns(ctx context.Context, bits []pilosa.Bit) error {
// importBits sends batches of bits to the server.
func (cmd *ImportCommand) importBits(ctx context.Context, bits []pilosa.Bit) error {
logger := log.New(cmd.Stderr, "", log.LstdFlags)
// Group columns by slice.
logger.Printf("grouping %d columns", len(bits))
// Group bits by slice.
logger.Printf("grouping %d bits", len(bits))
bitsBySlice := pilosa.Bits(bits).GroupBySlice()
// Parse path into columns.
// Parse path into bits.
for slice, chunk := range bitsBySlice {
if cmd.Sort {
sort.Sort(pilosa.BitsByPos(chunk))
@ -250,8 +249,8 @@ func (cmd *ImportCommand) importColumns(ctx context.Context, bits []pilosa.Bit)
return nil
}
// bufferColumnsK buffers slices of keys to be imported as a batch.
func (cmd *ImportCommand) bufferColumnsK(ctx context.Context, path string) error {
// bufferBitsK buffers slices of keys to be imported as a batch.
func (cmd *ImportCommand) bufferBitsK(ctx context.Context, path string) error {
a := make([]pilosa.Bit, 0, cmd.BufferSize)
var r *csv.Reader
@ -264,7 +263,7 @@ func (cmd *ImportCommand) bufferColumnsK(ctx context.Context, path string) error
}
defer f.Close()
// Read rows as columns.
// Read rows as bits.
r = csv.NewReader(f)
} else {
r = csv.NewReader(cmd.Stdin)
@ -290,19 +289,19 @@ func (cmd *ImportCommand) bufferColumnsK(ctx context.Context, path string) error
return fmt.Errorf("bad column count on row %d: col=%d", rnum, len(record))
}
var column pilosa.Bit
var bit pilosa.Bit
// Parse row key.
if record[0] == "" {
return fmt.Errorf("invalid row key on row %d: %q", rnum, record[0])
}
column.RowKey = record[0]
bit.RowKey = record[0]
// Parse column key.
if record[1] == "" {
return fmt.Errorf("invalid column id on row %d: %q", rnum, record[1])
}
column.ColumnKey = record[1]
bit.ColumnKey = record[1]
// Parse time, if exists.
if len(record) > 2 && record[2] != "" {
@ -310,36 +309,36 @@ func (cmd *ImportCommand) bufferColumnsK(ctx context.Context, path string) error
if err != nil {
return fmt.Errorf("invalid timestamp on row %d: %q", rnum, record[2])
}
column.Timestamp = t.UnixNano()
bit.Timestamp = t.UnixNano()
}
a = append(a, column)
a = append(a, bit)
// If we've reached the buffer size then import columns.
// If we've reached the buffer size then import bits.
if len(a) == cmd.BufferSize {
if err := cmd.importColumnsK(ctx, a); err != nil {
if err := cmd.importBitsK(ctx, a); err != nil {
return err
}
a = a[:0]
}
}
// If there are still columnKs in the buffer then flush them.
if err := cmd.importColumnsK(ctx, a); err != nil {
// If there are still bitKs in the buffer then flush them.
if err := cmd.importBitsK(ctx, a); err != nil {
return err
}
return nil
}
// importColumnsK sends batches of columnKs to the server.
func (cmd *ImportCommand) importColumnsK(ctx context.Context, columns []pilosa.Bit) error {
// importBitsK sends batches of bitKs to the server.
func (cmd *ImportCommand) importBitsK(ctx context.Context, bits []pilosa.Bit) error {
logger := log.New(cmd.Stderr, "", log.LstdFlags)
// TODO: does it help to sort the rowKeys?
logger.Printf("importing keys: n=%d", len(columns))
if err := cmd.Client.ImportK(ctx, cmd.Index, cmd.Frame, columns); err != nil {
logger.Printf("importing keys: n=%d", len(bits))
if err := cmd.Client.ImportK(ctx, cmd.Index, cmd.Frame, bits); err != nil {
return errors.Wrap(err, "importing keys")
}
@ -360,7 +359,7 @@ func (cmd *ImportCommand) bufferFieldValues(ctx context.Context, path string) er
}
defer f.Close()
// Read rows as columns.
// Read rows as bits.
r = csv.NewReader(f)
} else {
r = csv.NewReader(cmd.Stdin)

View file

@ -1064,7 +1064,7 @@ func (e *Executor) executeClearBit(ctx context.Context, index string, c *pql.Cal
return false, fmt.Errorf("ClearBit col field '%v' required", columnLabel)
}
// Clear columns for each view.
// Clear bits for each view.
switch view {
case ViewStandard:
return e.executeClearBitView(ctx, index, c, f, view, colID, rowID, opt)
@ -1164,7 +1164,7 @@ func (e *Executor) executeSetBit(ctx context.Context, index string, c *pql.Call,
timestamp = &t
}
// Set columns for each view.
// Set bits for each view.
switch view {
case ViewStandard:
return e.executeSetBitView(ctx, index, c, f, view, colID, rowID, timestamp, opt)
@ -1404,7 +1404,7 @@ func (e *Executor) executeBulkSetRowAttrs(ctx context.Context, index string, cal
if err := frame.RowAttrStore().SetBulkAttrs(frameMap); err != nil {
return nil, err
}
frame.Stats.Count("SetColumnAttrs", 1, 1.0)
frame.Stats.Count("SetRowAttrs", 1, 1.0)
}
// Do not forward call if this is already being forwarded.

View file

@ -40,7 +40,7 @@ func TestExecutor_Execute_Bitmap(t *testing.T) {
e := test.NewExecutor(hldr.Holder, test.NewCluster(1))
// Set columns.
// Set bits.
if _, err := e.Execute(context.Background(), "i", test.MustParse(``+
fmt.Sprintf("SetBit(frame=f, row=%d, col=%d)\n", 10, 3)+
fmt.Sprintf("SetBit(frame=f, row=%d, col=%d)\n", 10, SliceWidth+1)+
@ -60,7 +60,7 @@ func TestExecutor_Execute_Bitmap(t *testing.T) {
t.Fatalf("unexpected attrs: %s", spew.Sdump(attrs))
}
// Inhicolumn columns.
// Inhibit columns attributes.
if res, err := e.Execute(context.Background(), "i", test.MustParse(`Bitmap(row=10, frame=f)`), nil, &pilosa.ExecOptions{ExcludeColumns: true}); err != nil {
t.Fatal(err)
} else if columns := res[0].(*pilosa.Row).Columns(); !reflect.DeepEqual(columns, []uint64{}) {
@ -69,7 +69,7 @@ func TestExecutor_Execute_Bitmap(t *testing.T) {
t.Fatalf("unexpected attrs: %s", spew.Sdump(attrs))
}
// Inhicolumn attributes.
// Inhibit row attributes.
if res, err := e.Execute(context.Background(), "i", test.MustParse(`Bitmap(row=10, frame=f)`), nil, &pilosa.ExecOptions{ExcludeRowAttrs: true}); err != nil {
t.Fatal(err)
} else if columns := res[0].(*pilosa.Row).Columns(); !reflect.DeepEqual(columns, []uint64{3, SliceWidth + 1}) {
@ -89,7 +89,7 @@ func TestExecutor_Execute_Bitmap(t *testing.T) {
e := test.NewExecutor(hldr.Holder, test.NewCluster(1))
// Set columns.
// Set bits.
if _, err := e.Execute(context.Background(), "i", test.MustParse(``+
fmt.Sprintf("SetBit(frame=f, row=%d, col=%d)\n", 10, 3)+
fmt.Sprintf("SetBit(frame=f, row=%d, col=%d)\n", 10, SliceWidth+1)+

View file

@ -171,7 +171,7 @@ func (f *Fragment) Open() error {
// Clear checksums.
f.checksums = make(map[int][]byte)
// Read last column to determine max row.
// Read last bit to determine max row.
pos := f.storage.Max()
f.maxRowID = pos / SliceWidth
f.stats.Gauge("rows", float64(f.maxRowID), 1.0)
@ -380,7 +380,7 @@ func (f *Fragment) row(rowID uint64, checkRowCache bool, updateRowCache bool) *R
return row
}
// SetBit sets a column for a given column & row within the fragment.
// SetBit sets a bit for a given column & row within the fragment.
// This updates both the on-disk storage and the in-cache bitmap.
func (f *Fragment) SetBit(rowID, columnID uint64) (changed bool, err error) {
f.mu.Lock()
@ -390,10 +390,10 @@ func (f *Fragment) SetBit(rowID, columnID uint64) (changed bool, err error) {
func (f *Fragment) setBit(rowID, columnID uint64) (changed bool, err error) {
changed = false
// Determine the position of the column in the storage.
// Determine the position of the bit in the storage.
pos, err := f.pos(rowID, columnID)
if err != nil {
return false, errors.Wrap(err, "getting column ops")
return false, errors.Wrap(err, "getting bit pos")
}
// Write to storage.
@ -432,7 +432,7 @@ func (f *Fragment) setBit(rowID, columnID uint64) (changed bool, err error) {
return changed, nil
}
// ClearBit clears a column for a given column & row within the fragment.
// ClearBit clears a bit for a given column & row within the fragment.
// This updates both the on-disk storage and the in-cache bitmap.
func (f *Fragment) ClearBit(rowID, columnID uint64) (bool, error) {
f.mu.Lock()
@ -442,10 +442,10 @@ func (f *Fragment) ClearBit(rowID, columnID uint64) (bool, error) {
func (f *Fragment) clearBit(rowID, columnID uint64) (changed bool, err error) {
changed = false
// Determine the position of the column in the storage.
// Determine the position of the bit in the storage.
pos, err := f.pos(rowID, columnID)
if err != nil {
return false, errors.Wrap(err, "getting column pos")
return false, errors.Wrap(err, "getting bit pos")
}
// Write to storage.
@ -582,10 +582,10 @@ func (f *Fragment) importSetFieldValue(columnID uint64, bitDepth uint, value uin
return changed, nil
}
// FieldSum returns the sum of a given field as well as the number of bits involved.
// FieldSum returns the sum of a given field as well as the number of columns involved.
// A bitmap can be passed in to optionally filter the computed columns.
func (f *Fragment) FieldSum(filter *Row, bitDepth uint) (sum, count uint64, err error) {
// Compute count based on the existence column.
// Compute count based on the existence row.
row := f.Row(uint64(bitDepth))
if filter != nil {
count = row.IntersectionCount(filter)
@ -614,7 +614,7 @@ func (f *Fragment) FieldSum(filter *Row, bitDepth uint) (sum, count uint64, err
return sum, count, nil
}
// FieldMin returns the min of a given field as well as the number of bits involved.
// FieldMin returns the min of a given field as well as the number of columns involved.
// A bitmap can be passed in to optionally filter the computed columns.
func (f *Fragment) FieldMin(filter *Row, bitDepth uint) (min, count uint64, err error) {
@ -647,8 +647,8 @@ func (f *Fragment) FieldMin(filter *Row, bitDepth uint) (min, count uint64, err
return min, count, nil
}
// FieldMax returns the max of a given field as well as the number of bits involved.
// A bitmap can be passed in to optionally filter the computed bits.
// FieldMax returns the max of a given field as well as the number of columns involved.
// A bitmap can be passed in to optionally filter the computed columns.
func (f *Fragment) FieldMax(filter *Row, bitDepth uint) (max, count uint64, err error) {
consider := f.Row(uint64(bitDepth))
@ -656,13 +656,13 @@ func (f *Fragment) FieldMax(filter *Row, bitDepth uint) (max, count uint64, err
consider = consider.Intersect(filter)
}
// If there are no bits to consider, return early.
// If there are no columns to consider, return early.
if consider.Count() == 0 {
return 0, 0, nil
}
for i := bitDepth; i > uint(0); i-- {
ii := i - 1 // allow for uint range: (columndepth-1) to 0
ii := i - 1 // allow for uint range: (bitDepth-1) to 0
row := f.Row(uint64(ii))
x := row.Intersect(consider)
@ -741,7 +741,7 @@ func (f *Fragment) fieldRangeLT(bitDepth uint, predicate uint64, allowEquality b
row := f.Row(uint64(i))
bit := (predicate >> uint(i)) & 1
// Remove any columns with higher columns set.
// Remove any columns with higher bits set.
if leadingZeros {
if bit == 0 {
b = b.Difference(row)
@ -751,9 +751,9 @@ func (f *Fragment) fieldRangeLT(bitDepth uint, predicate uint64, allowEquality b
}
}
// Handle last column differently.
// If column is zero then return only already kept columns.
// If column is one then remove any one columns.
// Handle last bit differently.
// If bit is zero then return only already kept columns.
// If bit is one then remove any one columns.
if i == 0 && !allowEquality {
if bit == 0 {
return keep, nil
@ -767,7 +767,7 @@ func (f *Fragment) fieldRangeLT(bitDepth uint, predicate uint64, allowEquality b
continue
}
// If bit is set then add bits for set bits to exclude.
// If bit is set then add columns for set bits to exclude.
// Don't bother to compute this on the final iteration.
if i > 0 {
keep = keep.Union(b.Difference(row))
@ -781,14 +781,14 @@ func (f *Fragment) fieldRangeGT(bitDepth uint, predicate uint64, allowEquality b
b := f.Row(uint64(bitDepth))
keep := NewRow()
// Filter any columns that don't match the current column value.
// Filter any bits that don't match the current bit value.
for i := int(bitDepth - 1); i >= 0; i-- {
row := f.Row(uint64(i))
bit := (predicate >> uint(i)) & 1
// Handle last bit differently.
// If bit is one then return only already kept bits.
// If bit is zero then remove any unset bits.
// If bit is one then return only already kept columns.
// If bit is zero then remove any unset columns.
if i == 0 && !allowEquality {
if bit == 1 {
return keep, nil
@ -796,13 +796,13 @@ func (f *Fragment) fieldRangeGT(bitDepth uint, predicate uint64, allowEquality b
return b.Difference(b.Difference(row).Difference(keep)), nil
}
// If bit is set then remove all unset bits not already kept.
// If bit is set then remove all unset columns not already kept.
if bit == 1 {
b = b.Difference(b.Difference(row).Difference(keep))
continue
}
// If bit is unset then add bits with set bit to keep.
// If bit is unset then add columns with set bit to keep.
// Don't bother to compute this on the final iteration.
if i > 0 {
keep = keep.Union(b.Intersect(row))
@ -1184,7 +1184,7 @@ func (f *Fragment) readContiguousChecksums(a *[]FragmentBlock, blockID int) (n i
}
}
// BlockData returns columns in a block as row & column ID pairs.
// BlockData returns bits in a block as row & column ID pairs.
func (f *Fragment) BlockData(id int) (rowIDs, columnIDs []uint64) {
f.mu.Lock()
defer f.mu.Unlock()
@ -1196,11 +1196,11 @@ func (f *Fragment) BlockData(id int) (rowIDs, columnIDs []uint64) {
return
}
// MergeBlock compares the block's columns and computes a diff with another set of block columns.
// The state of a column is determined by consensus from all blocks being considered.
// MergeBlock compares the block's bits and computes a diff with another set of block bits.
// The state of a bit is determined by consensus from all blocks being considered.
//
// For example, if 3 blocks are compared and two have a set column and one has a
// cleared column then the column is considered cleared. The function returns the
// For example, if 3 blocks are compared and two have a set bit and one has a
// cleared bit then the bit is considered cleared. The function returns the
// diff per incoming block so that all can be in sync.
func (f *Fragment) MergeBlock(id int, data []PairSet) (sets, clears []PairSet, err error) {
// Ensure that all pair sets are of equal length.
@ -1305,14 +1305,14 @@ func (f *Fragment) MergeBlock(id int, data []PairSet) (sets, clears []PairSet, e
}
}
// Set local columns.
// Set local bits.
for i := range sets[0].ColumnIDs {
if _, err := f.setBit(sets[0].RowIDs[i], (f.Slice()*SliceWidth)+sets[0].ColumnIDs[i]); err != nil {
return nil, nil, errors.Wrap(err, "setting")
}
}
// Clear local columns.
// Clear local bits.
for i := range clears[0].ColumnIDs {
if _, err := f.clearBit(clears[0].RowIDs[i], (f.Slice()*SliceWidth)+clears[0].ColumnIDs[i]); err != nil {
return nil, nil, errors.Wrap(err, "clearing")
@ -1322,7 +1322,7 @@ func (f *Fragment) MergeBlock(id int, data []PairSet) (sets, clears []PairSet, e
return sets[1:], clears[1:], nil
}
// Import bulk imports a set of columns and then snapshots the storage.
// Import bulk imports a set of bits and then snapshots the storage.
// This does not affect the fragment's cache.
func (f *Fragment) Import(rowIDs, columnIDs []uint64) error {
f.mu.Lock()
@ -1335,7 +1335,7 @@ func (f *Fragment) Import(rowIDs, columnIDs []uint64) error {
// Disconnect op writer so we don't append updates.
f.storage.OpWriter = nil
// Process every column.
// Process every bit.
// If an error occurs then reopen the storage.
lastID := uint64(0)
if err := func() error {
@ -1343,10 +1343,10 @@ func (f *Fragment) Import(rowIDs, columnIDs []uint64) error {
for i := range rowIDs {
rowID, columnID := rowIDs[i], columnIDs[i]
// Determine the position of the column in the storage.
// Determine the position of the bit in the storage.
pos, err := f.pos(rowID, columnID)
if err != nil {
return errors.Wrap(err, "getting column pos")
return errors.Wrap(err, "getting bit pos")
}
// Write to storage.
@ -1393,7 +1393,7 @@ func (f *Fragment) Import(rowIDs, columnIDs []uint64) error {
}
// ImportValue bulk imports a set of range-encoded values.
func (f *Fragment) ImportValue(columnIDs, values []uint64, columnDepth uint) error {
func (f *Fragment) ImportValue(columnIDs, values []uint64, bitDepth uint) error {
f.mu.Lock()
defer f.mu.Unlock()
// Verify that there are an equal number of column ids and values.
@ -1408,7 +1408,7 @@ func (f *Fragment) ImportValue(columnIDs, values []uint64, columnDepth uint) err
for i := range columnIDs {
columnID, value := columnIDs[i], values[i]
_, err := f.importSetFieldValue(columnID, columnDepth, value)
_, err := f.importSetFieldValue(columnID, bitDepth, value)
if err != nil {
return errors.Wrap(err, "setting")
}

View file

@ -69,7 +69,7 @@ func TestFragment_SetBit(t *testing.T) {
}
}
// Ensure a fragment can clear a set bits.
// Ensure a fragment can clear a set bit.
func TestFragment_ClearBit(t *testing.T) {
f := test.MustOpenFragment("i", "f", pilosa.ViewStandard, 0, "")
defer f.Close()
@ -191,24 +191,24 @@ func TestFragment_SetFieldValue(t *testing.T) {
// Set values.
m := make(map[uint64]int64)
for _, value := range values {
bit_index := value % bitN
columnID := value % bitN
m[bit_index] = int64(value)
m[columnID] = int64(value)
if _, err := f.SetFieldValue(bit_index, bitDepth, value); err != nil {
if _, err := f.SetFieldValue(columnID, bitDepth, value); err != nil {
t.Fatal(err)
}
}
// Ensure values are set.
for bit_index, value := range m {
v, exists, err := f.FieldValue(bit_index, bitDepth)
for columnID, value := range m {
v, exists, err := f.FieldValue(columnID, bitDepth)
if err != nil {
t.Fatal(err)
} else if value != int64(v) {
t.Fatalf("value mismatch: bit_index=%d, bitdepth=%d, value: %d != %d", bit_index, bitDepth, value, v)
t.Fatalf("value mismatch: columnID=%d, bitdepth=%d, value: %d != %d", columnID, bitDepth, value, v)
} else if !exists {
t.Fatalf("value should exist: bit_index=%d", bit_index)
t.Fatalf("value should exist: columnID=%d", columnID)
}
}
@ -531,7 +531,7 @@ func TestFragment_Snapshot(t *testing.T) {
f := test.MustOpenFragment("i", "f", pilosa.ViewStandard, 0, "")
defer f.Close()
// Set and then clear columns on the fragment.
// Set and then clear bits on the fragment.
if _, err := f.SetBit(1000, 1); err != nil {
t.Fatal(err)
} else if _, err := f.SetBit(1000, 2); err != nil {
@ -555,12 +555,12 @@ func TestFragment_Snapshot(t *testing.T) {
}
}
// Ensure a fragment can iterate over all columns in order.
// Ensure a fragment can iterate over all bits in order.
func TestFragment_ForEachBit(t *testing.T) {
f := test.MustOpenFragment("i", "f", pilosa.ViewStandard, 0, "")
defer f.Close()
// Set columns on the fragment.
// Set bits on the fragment.
if _, err := f.SetBit(100, 20); err != nil {
t.Fatal(err)
} else if _, err := f.SetBit(2, 38); err != nil {
@ -569,7 +569,7 @@ func TestFragment_ForEachBit(t *testing.T) {
t.Fatal(err)
}
// Iterate over columns.
// Iterate over bits.
var result [][2]uint64
if err := f.ForEachBit(func(rowID, columnID uint64) error {
result = append(result, [2]uint64{rowID, columnID})
@ -578,7 +578,7 @@ func TestFragment_ForEachBit(t *testing.T) {
t.Fatal(err)
}
// Verify columns are correct.
// Verify bits are correct.
if !reflect.DeepEqual(result, [][2]uint64{{2, 37}, {2, 38}, {100, 20}}) {
t.Fatalf("unexpected result: %#v", result)
}
@ -588,7 +588,7 @@ func TestFragment_ForEachBit(t *testing.T) {
func TestFragment_Top(t *testing.T) {
f := test.MustOpenFragment("i", "f", pilosa.ViewStandard, 0, pilosa.CacheTypeRanked)
defer f.Close()
// Set columns on the rows 100, 101, & 102.
// Set bits on the rows 100, 101, & 102.
f.MustSetBits(100, 1, 3, 200)
f.MustSetBits(101, 1)
f.MustSetBits(102, 1, 2)
@ -611,7 +611,7 @@ func TestFragment_Top_Filter(t *testing.T) {
f := test.MustOpenFragment("i", "f", pilosa.ViewStandard, 0, pilosa.CacheTypeRanked)
defer f.Close()
// Set columns on the rows 100, 101, & 102.
// Set bits on the rows 100, 101, & 102.
f.MustSetBits(100, 1, 3, 200)
f.MustSetBits(101, 1)
f.MustSetBits(102, 1, 2)
@ -644,7 +644,7 @@ func TestFragment_TopN_Intersect(t *testing.T) {
// Create an intersecting input row.
src := pilosa.NewRow(1, 2, 3)
// Set columns on various rows.
// Set bits on various rows.
f.MustSetBits(100, 1, 10, 11, 12) // one intersection
f.MustSetBits(101, 1, 2, 3, 4) // three intersections
f.MustSetBits(102, 1, 2, 4, 5, 6) // two intersections
@ -678,7 +678,7 @@ func TestFragment_TopN_Intersect_Large(t *testing.T) {
990, 991, 992, 993, 994, 995, 996, 997, 998, 999,
)
// Set columns on rows 0 - 999. Higher rows have higher column counts.
// Set bits on rows 0 - 999. Higher rows have higher bit counts.
for i := uint64(0); i < 1000; i++ {
for j := uint64(0); j < i; j++ {
f.MustSetBits(i, j)
@ -710,7 +710,7 @@ func TestFragment_TopN_IDs(t *testing.T) {
f := test.MustOpenFragment("i", "f", pilosa.ViewStandard, 0, pilosa.CacheTypeRanked)
defer f.Close()
// Set columns on various rows.
// Set bits on various rows.
f.MustSetBits(100, 1, 2, 3)
f.MustSetBits(101, 4, 5, 6, 7)
f.MustSetBits(102, 8, 9, 10, 11, 12)
@ -731,7 +731,7 @@ func TestFragment_TopN_NopCache(t *testing.T) {
f := test.MustOpenFragment("i", "f", pilosa.ViewStandard, 0, pilosa.CacheTypeNone)
defer f.Close()
// Set columns on various rows.
// Set bits on various rows.
f.MustSetBits(100, 1, 2, 3)
f.MustSetBits(101, 4, 5, 6, 7)
f.MustSetBits(102, 8, 9, 10, 11, 12)
@ -783,7 +783,7 @@ func TestFragment_TopN_CacheSize(t *testing.T) {
}
defer f.Close()
// Set columns on various rows.
// Set bits on various rows.
f.MustSetBits(100, 1, 2, 3)
f.MustSetBits(101, 4, 5, 6, 7)
f.MustSetBits(102, 8, 9, 10, 11, 12)
@ -816,7 +816,7 @@ func TestFragment_Checksum(t *testing.T) {
f := test.MustOpenFragment("i", "f", pilosa.ViewStandard, 0, "")
defer f.Close()
// Retrieve checksum and set columns.
// Retrieve checksum and set bits.
orig := f.Checksum()
if _, err := f.SetBit(1, 200); err != nil {
t.Fatal(err)
@ -848,7 +848,7 @@ func TestFragment_Blocks(t *testing.T) {
}
prev = blocks
// Set column on different row.
// Set bit on different row.
if _, err := f.SetBit(20, 0); err != nil {
t.Fatal(err)
}
@ -858,7 +858,7 @@ func TestFragment_Blocks(t *testing.T) {
}
prev = blocks
// Set column on different column.
// Set bit on different column.
if _, err := f.SetBit(20, 100); err != nil {
t.Fatal(err)
}
@ -873,7 +873,7 @@ func TestFragment_Blocks_Empty(t *testing.T) {
f := test.MustOpenFragment("i", "f", pilosa.ViewStandard, 0, "")
defer f.Close()
// Set columns on a different block.
// Set bits on a different block.
if _, err := f.SetBit(100, 1); err != nil {
t.Fatal(err)
}
@ -891,7 +891,7 @@ func TestFragment_LRUCache_Persistence(t *testing.T) {
f := test.MustOpenFragment("i", "f", pilosa.ViewStandard, 0, pilosa.CacheTypeLRU)
defer f.Close()
// Set columns on the fragment.
// Set bits on the fragment.
for i := uint64(0); i < 1000; i++ {
if _, err := f.SetBit(i, 0); err != nil {
t.Fatal(err)
@ -941,7 +941,7 @@ func TestFragment_RankCache_Persistence(t *testing.T) {
t.Fatal(err)
}
// Set columns on the fragment.
// Set bits on the fragment.
for i := uint64(0); i < 1000; i++ {
if _, err := f.SetBit(i, 0); err != nil {
t.Fatal(err)
@ -1083,7 +1083,7 @@ func TestFragment_Tanimoto(t *testing.T) {
src := pilosa.NewRow(1, 2, 3)
// Set columns on the rows 100, 101, & 102.
// Set bits on the rows 100, 101, & 102.
f.MustSetBits(100, 1, 3, 2, 200)
f.MustSetBits(101, 1, 3)
f.MustSetBits(102, 1, 2, 10, 12)
@ -1106,7 +1106,7 @@ func TestFragment_Zero_Tanimoto(t *testing.T) {
src := pilosa.NewRow(1, 2, 3)
// Set columns on the rows 100, 101, & 102.
// Set bits on the rows 100, 101, & 102.
f.MustSetBits(100, 1, 3, 2, 200)
f.MustSetBits(101, 1, 3)
f.MustSetBits(102, 1, 2, 10, 12)
@ -1129,7 +1129,7 @@ func TestFragment_Snapshot_Run(t *testing.T) {
f := test.MustOpenFragment("i", "f", pilosa.ViewStandard, 0, "")
defer f.Close()
// Set columns on the fragment.
// Set bits on the fragment.
for i := uint64(1); i < 3; i++ {
if _, err := f.SetBit(1000, i); err != nil {
t.Fatal(err)

View file

@ -587,7 +587,7 @@ func (f *Frame) DeleteView(name string) error {
return nil
}
// SetBit sets a column on a view within the frame.
// SetBit sets a bit on a view within the frame.
func (f *Frame) SetBit(name string, rowID, colID uint64, t *time.Time) (changed bool, err error) {
// Validate view name.
if !IsValidView(name) {
@ -600,7 +600,7 @@ func (f *Frame) SetBit(name string, rowID, colID uint64, t *time.Time) (changed
return changed, errors.Wrap(err, "creating view")
}
// Set non-time column.
// Set non-time bit.
if v, err := view.SetBit(rowID, colID); err != nil {
return changed, errors.Wrap(err, "setting on view")
} else if v {
@ -612,7 +612,7 @@ func (f *Frame) SetBit(name string, rowID, colID uint64, t *time.Time) (changed
return changed, nil
}
// If a timestamp is specified then set columns across all views for the quantum.
// If a timestamp is specified then set bits across all views for the quantum.
for _, subname := range ViewsByTime(name, *t, f.TimeQuantum()) {
view, err := f.CreateViewIfNotExists(subname)
if err != nil {
@ -629,7 +629,7 @@ func (f *Frame) SetBit(name string, rowID, colID uint64, t *time.Time) (changed
return changed, nil
}
// ClearBit clears a column within the frame.
// ClearBit clears a bit within the frame.
func (f *Frame) ClearBit(name string, rowID, colID uint64, t *time.Time) (changed bool, err error) {
// Validate view name.
if !IsValidView(name) {
@ -642,7 +642,7 @@ func (f *Frame) ClearBit(name string, rowID, colID uint64, t *time.Time) (change
return changed, errors.Wrap(err, "creating view")
}
// Clear non-time column.
// Clear non-time bit.
if v, err := view.ClearBit(rowID, colID); err != nil {
return changed, errors.Wrap(err, "setting on view")
} else if v {
@ -654,7 +654,7 @@ func (f *Frame) ClearBit(name string, rowID, colID uint64, t *time.Time) (change
return changed, nil
}
// If a timestamp is specified then clear columns across all views for the quantum.
// If a timestamp is specified then clear bits across all views for the quantum.
for _, subname := range ViewsByTime(name, *t, f.TimeQuantum()) {
view, err := f.CreateViewIfNotExists(subname)
if err != nil {
@ -846,13 +846,13 @@ func (f *Frame) Import(rowIDs, columnIDs []uint64, timestamps []*time.Time) erro
inverse = []string{ViewInverse}
} else {
standard = ViewsByTime(ViewStandard, *timestamp, q)
// In order to match the logic of `SetBit()`, we want columns
// In order to match the logic of `SetBit()`, we want bits
// with timestamps to write to both time and standard views.
standard = append(standard, ViewStandard)
inverse = ViewsByTime(ViewInverse, *timestamp, q)
}
// Attach column to each standard view.
// Attach bit to each standard view.
for _, name := range standard {
key := importKey{View: name, Slice: columnID / SliceWidth}
data := dataByFragment[key]
@ -862,7 +862,7 @@ func (f *Frame) Import(rowIDs, columnIDs []uint64, timestamps []*time.Time) erro
}
if f.inverseEnabled {
// Attach reversed columns to each inverse view.
// Attach reversed bits to each inverse view.
for _, name := range inverse {
key := importKey{View: name, Slice: rowID / SliceWidth}
data := dataByFragment[key]
@ -909,7 +909,7 @@ func (f *Frame) Import(rowIDs, columnIDs []uint64, timestamps []*time.Time) erro
// ImportValue bulk imports range-encoded value data.
func (f *Frame) ImportValue(fieldName string, columnIDs []uint64, values []int64) error {
viewName := ViewFieldPrefix + fieldName
// Get the field so we know columnDepth.
// Get the field so we know bitDepth.
field := f.Field(fieldName)
if field == nil {
return fmt.Errorf("Field does not exist: %s", fieldName)
@ -939,7 +939,7 @@ func (f *Frame) ImportValue(fieldName string, columnIDs []uint64, values []int64
for key, data := range dataByFragment {
// The view must already exist (i.e. we can't create it)
// because we need to know columnDepth (based on min/max value).
// because we need to know bitDepth (based on min/max value).
view, err := f.CreateViewIfNotExists(key.View)
if err != nil {
return errors.Wrap(err, "creating view")
@ -1064,7 +1064,7 @@ type Field struct {
Max int64 `json:"max,omitempty"`
}
// BitDepth returns the number of columns required to store a value between min & max.
// BitDepth returns the number of bits required to store a value between min & max.
func (f *Field) BitDepth() uint {
for i := uint(0); i < 63; i++ {
if f.Max-f.Min < (1 << i) {

View file

@ -1110,7 +1110,7 @@ func TestHandler_Fragment_BackupRestore(t *testing.T) {
s.Handler.API.Holder = hldr.Holder
defer s.Close()
// Set columns in the index.
// Set bits in the index.
f0 := hldr.MustCreateFragmentIfNotExists("i", "f", pilosa.ViewStandard, 0)
f0.MustSetBits(100, 1, 2, 3)

View file

@ -162,8 +162,8 @@ func TestStatsCount_SetColumnAttrs(t *testing.T) {
frame.Stats = &MockStats{
mockCount: func(name string, value int64, rate float64) {
if name != "SetColumnAttrs" {
t.Errorf("Expected SetColumnAttrs, Results %s", name)
if name != "SetRowAttrs" {
t.Errorf("Expected SetRowAttrs, Results %s", name)
}
called = true
},

36
view.go
View file

@ -305,7 +305,7 @@ func (v *View) DeleteFragment(slice uint64) error {
return nil
}
// SetBit sets a column within the view.
// SetBit sets a bit within the view.
func (v *View) SetBit(rowID, columnID uint64) (changed bool, err error) {
slice := columnID / SliceWidth
frag, err := v.CreateFragmentIfNotExists(slice)
@ -315,7 +315,7 @@ func (v *View) SetBit(rowID, columnID uint64) (changed bool, err error) {
return frag.SetBit(rowID, columnID)
}
// ClearBit clears a column within the view.
// ClearBit clears a bit within the view.
func (v *View) ClearBit(rowID, columnID uint64) (changed bool, err error) {
slice := columnID / SliceWidth
frag, err := v.CreateFragmentIfNotExists(slice)
@ -325,30 +325,30 @@ func (v *View) ClearBit(rowID, columnID uint64) (changed bool, err error) {
return frag.ClearBit(rowID, columnID)
}
// FieldValue uses a column of columns to read a multi-column value.
func (v *View) FieldValue(columnID uint64, columnDepth uint) (value uint64, exists bool, err error) {
// FieldValue uses a column of bits to read a multi-bit value.
func (v *View) FieldValue(columnID uint64, bitDepth uint) (value uint64, exists bool, err error) {
slice := columnID / SliceWidth
frag, err := v.CreateFragmentIfNotExists(slice)
if err != nil {
return value, exists, err
}
return frag.FieldValue(columnID, columnDepth)
return frag.FieldValue(columnID, bitDepth)
}
// SetFieldValue uses a column of columns to set a multi-column value.
func (v *View) SetFieldValue(columnID uint64, columnDepth uint, value uint64) (changed bool, err error) {
// SetFieldValue uses a column of bits to set a multi-bit value.
func (v *View) SetFieldValue(columnID uint64, bitDepth uint, value uint64) (changed bool, err error) {
slice := columnID / SliceWidth
frag, err := v.CreateFragmentIfNotExists(slice)
if err != nil {
return changed, err
}
return frag.SetFieldValue(columnID, columnDepth, value)
return frag.SetFieldValue(columnID, bitDepth, value)
}
// FieldSum returns the sum & count of a field.
func (v *View) FieldSum(filter *Row, columnDepth uint) (sum, count uint64, err error) {
func (v *View) FieldSum(filter *Row, bitDepth uint) (sum, count uint64, err error) {
for _, f := range v.Fragments() {
fsum, fcount, err := f.FieldSum(filter, columnDepth)
fsum, fcount, err := f.FieldSum(filter, bitDepth)
if err != nil {
return sum, count, err
}
@ -359,10 +359,10 @@ func (v *View) FieldSum(filter *Row, columnDepth uint) (sum, count uint64, err e
}
// FieldMin returns the min and count of a field.
func (v *View) FieldMin(filter *Row, columnDepth uint) (min, count uint64, err error) {
func (v *View) FieldMin(filter *Row, bitDepth uint) (min, count uint64, err error) {
var minHasValue bool
for _, f := range v.Fragments() {
fmin, fcount, err := f.FieldMin(filter, columnDepth)
fmin, fcount, err := f.FieldMin(filter, bitDepth)
if err != nil {
return min, count, err
}
@ -387,9 +387,9 @@ func (v *View) FieldMin(filter *Row, columnDepth uint) (min, count uint64, err e
}
// FieldMax returns the max and count of a field.
func (v *View) FieldMax(filter *Row, columnDepth uint) (max, count uint64, err error) {
func (v *View) FieldMax(filter *Row, bitDepth uint) (max, count uint64, err error) {
for _, f := range v.Fragments() {
fmax, fcount, err := f.FieldMax(filter, columnDepth)
fmax, fcount, err := f.FieldMax(filter, bitDepth)
if err != nil {
return max, count, err
}
@ -402,10 +402,10 @@ func (v *View) FieldMax(filter *Row, columnDepth uint) (max, count uint64, err e
}
// FieldRange returns rows with a field value encoding matching the predicate.
func (v *View) FieldRange(op pql.Token, columnDepth uint, predicate uint64) (*Row, error) {
func (v *View) FieldRange(op pql.Token, bitDepth uint, predicate uint64) (*Row, error) {
r := NewRow()
for _, frag := range v.Fragments() {
other, err := frag.FieldRange(op, columnDepth, predicate)
other, err := frag.FieldRange(op, bitDepth, predicate)
if err != nil {
return nil, err
}
@ -416,10 +416,10 @@ func (v *View) FieldRange(op pql.Token, columnDepth uint, predicate uint64) (*Ro
// FieldRangeBetween returns bitmaps with a field value encoding matching any
// value between predicateMin and predicateMax.
func (v *View) FieldRangeBetween(columnDepth uint, predicateMin, predicateMax uint64) (*Row, error) {
func (v *View) FieldRangeBetween(bitDepth uint, predicateMin, predicateMax uint64) (*Row, error) {
r := NewRow()
for _, frag := range v.Fragments() {
other, err := frag.FieldRangeBetween(columnDepth, predicateMin, predicateMax)
other, err := frag.FieldRangeBetween(bitDepth, predicateMin, predicateMax)
if err != nil {
return nil, err
}

View file

@ -83,7 +83,7 @@ func (v *View) MustSetBits(rowID uint64, columnIDs ...uint64) {
}
// MustClearColumns clears columns on a row. Panic on error.
func (v *View) MustClearColumns(rowID uint64, columnIDs ...uint64) {
func (v *View) MustClearBits(rowID uint64, columnIDs ...uint64) {
for _, columnID := range columnIDs {
if _, err := v.ClearBit(rowID, columnID); err != nil {
panic(err)