mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-11 15:21:02 +00:00
handle input nil bit
This commit is contained in:
parent
98fa937af2
commit
d8e7769f5b
2 changed files with 12 additions and 2 deletions
3
index.go
3
index.go
|
|
@ -766,6 +766,9 @@ func (i *Index) InputBits(frame string, bits []*Bit) error {
|
|||
}
|
||||
|
||||
for i, bit := range bits {
|
||||
if bit == nil {
|
||||
continue
|
||||
}
|
||||
rowIDs = append(rowIDs, bit.RowID)
|
||||
columnIDs = append(columnIDs, bit.ColumnID)
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import (
|
|||
"io/ioutil"
|
||||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/pilosa/pilosa"
|
||||
|
|
@ -456,6 +457,7 @@ func TestIndex_CreateFrameWhenOpenInputDefinition(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestIndex_InputBits(t *testing.T) {
|
||||
var bits []*pilosa.Bit
|
||||
index := MustOpenIndex()
|
||||
defer index.Close()
|
||||
|
||||
|
|
@ -464,17 +466,22 @@ func TestIndex_InputBits(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
err := index.InputBits("f", bits)
|
||||
if !strings.Contains(err.Error(), "Frame not found") {
|
||||
t.Fatalf("Expected Frame not found error, actual error: %s", err)
|
||||
}
|
||||
|
||||
// Create frame.
|
||||
if _, err := index.CreateFrameIfNotExists("f", pilosa.FrameOptions{}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
var bits []*pilosa.Bit
|
||||
bits = append(bits, &pilosa.Bit{RowID: 0, ColumnID: 0})
|
||||
bits = append(bits, &pilosa.Bit{RowID: 0, ColumnID: 1})
|
||||
bits = append(bits, &pilosa.Bit{RowID: 2, ColumnID: 2, Timestamp: 1})
|
||||
bits = append(bits, nil)
|
||||
|
||||
err := index.InputBits("f", bits)
|
||||
err = index.InputBits("f", bits)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue