mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
fix govet and gofmt errors in existing code
This commit is contained in:
parent
8af9cfbb7d
commit
2ddcbce8ad
40 changed files with 192 additions and 185 deletions
|
|
@ -52,12 +52,8 @@ linters-settings:
|
|||
|
||||
issues:
|
||||
exclude-use-default: false
|
||||
max-per-linter: 0
|
||||
max-same: 0
|
||||
exclude-rules:
|
||||
- linters:
|
||||
- gofmt
|
||||
text: "File is not `gofmt`-ed with `-s`"
|
||||
max-issues-per-linter: 0
|
||||
max-same-issues: 0
|
||||
exclude:
|
||||
- 'declaration of "(err|ctx)" shadows declaration at'
|
||||
- 'Error return value of .(.*\.Help|.*\.MarkFlagRequired|(os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked'
|
||||
|
|
|
|||
16
cache.go
16
cache.go
|
|
@ -398,8 +398,8 @@ func (p PairField) ToRows(callback func(*pb.RowResponse) error) error {
|
|||
{Name: "count", Datatype: "uint64"},
|
||||
},
|
||||
Columns: []*pb.ColumnResponse{
|
||||
&pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_StringVal{StringVal: p.Pair.Key}},
|
||||
&pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_Uint64Val{Uint64Val: p.Pair.Count}},
|
||||
{ColumnVal: &pb.ColumnResponse_StringVal{StringVal: p.Pair.Key}},
|
||||
{ColumnVal: &pb.ColumnResponse_Uint64Val{Uint64Val: p.Pair.Count}},
|
||||
},
|
||||
})
|
||||
} else {
|
||||
|
|
@ -409,8 +409,8 @@ func (p PairField) ToRows(callback func(*pb.RowResponse) error) error {
|
|||
{Name: "count", Datatype: "uint64"},
|
||||
},
|
||||
Columns: []*pb.ColumnResponse{
|
||||
&pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_Uint64Val{Uint64Val: p.Pair.ID}},
|
||||
&pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_Uint64Val{Uint64Val: p.Pair.Count}},
|
||||
{ColumnVal: &pb.ColumnResponse_Uint64Val{Uint64Val: p.Pair.ID}},
|
||||
{ColumnVal: &pb.ColumnResponse_Uint64Val{Uint64Val: p.Pair.Count}},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
@ -540,8 +540,8 @@ func (p *PairsField) ToRows(callback func(*pb.RowResponse) error) error {
|
|||
if err := callback(&pb.RowResponse{
|
||||
Headers: ci,
|
||||
Columns: []*pb.ColumnResponse{
|
||||
&pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_StringVal{StringVal: pair.Key}},
|
||||
&pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_Uint64Val{Uint64Val: uint64(pair.Count)}},
|
||||
{ColumnVal: &pb.ColumnResponse_StringVal{StringVal: pair.Key}},
|
||||
{ColumnVal: &pb.ColumnResponse_Uint64Val{Uint64Val: uint64(pair.Count)}},
|
||||
}}); err != nil {
|
||||
return errors.Wrap(err, "calling callback")
|
||||
}
|
||||
|
|
@ -549,8 +549,8 @@ func (p *PairsField) ToRows(callback func(*pb.RowResponse) error) error {
|
|||
if err := callback(&pb.RowResponse{
|
||||
Headers: ci,
|
||||
Columns: []*pb.ColumnResponse{
|
||||
&pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_Uint64Val{Uint64Val: uint64(pair.ID)}},
|
||||
&pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_Uint64Val{Uint64Val: uint64(pair.Count)}},
|
||||
{ColumnVal: &pb.ColumnResponse_Uint64Val{Uint64Val: uint64(pair.ID)}},
|
||||
{ColumnVal: &pb.ColumnResponse_Uint64Val{Uint64Val: uint64(pair.Count)}},
|
||||
}}); err != nil {
|
||||
return errors.Wrap(err, "calling callback")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -672,9 +672,9 @@ func (b *Batch) Import() error {
|
|||
return errors.Wrap(err, "starting transaction")
|
||||
}
|
||||
defer func() {
|
||||
trns, err := b.client.FinishTransaction(trns.ID)
|
||||
trnsl, err := b.client.FinishTransaction(trns.ID)
|
||||
if err != nil {
|
||||
b.log.Errorf("error finishing transaction: %v. trns: %+v", err, trns)
|
||||
b.log.Errorf("error finishing transaction: %v. trns: %+v", err, trnsl)
|
||||
}
|
||||
b.client.Stats.Timing(MetricBatchImportDurationSeconds, time.Since(start), 1.0)
|
||||
}()
|
||||
|
|
@ -729,9 +729,9 @@ func (b *Batch) Flush() error {
|
|||
return errors.Wrap(err, "starting transaction")
|
||||
}
|
||||
defer func() {
|
||||
trns, err := b.client.FinishTransaction(trns.ID)
|
||||
trnsl, err := b.client.FinishTransaction(trns.ID)
|
||||
if err != nil {
|
||||
b.log.Errorf("error finishing transaction: %v. trns: %+v", err, trns)
|
||||
b.log.Errorf("error finishing transaction: %v. trns: %+v", err, trnsl)
|
||||
}
|
||||
b.client.Stats.Timing(MetricBatchFlushDurationSeconds, time.Since(start), 1.0)
|
||||
}()
|
||||
|
|
@ -1053,17 +1053,17 @@ func (b *Batch) doImport(frags, clearFrags fragments) error {
|
|||
eg.Go(func() error {
|
||||
clearViewMap := clearFrags.GetViewMap(shard, field)
|
||||
if len(clearViewMap) > 0 {
|
||||
start := time.Now()
|
||||
startx := time.Now()
|
||||
err := b.client.ImportRoaringBitmap(b.index.Field(field), shard, clearViewMap, true)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "import clearing clearing data for %s", field)
|
||||
}
|
||||
b.log.Debugf("imp-roar-clr %s,shard:%d,views:%d %v", field, shard, len(clearViewMap), time.Since(start))
|
||||
b.log.Debugf("imp-roar-clr %s,shard:%d,views:%d %v", field, shard, len(clearViewMap), time.Since(startx))
|
||||
}
|
||||
|
||||
start := time.Now()
|
||||
starty := time.Now()
|
||||
err := b.client.ImportRoaringBitmap(b.index.Field(field), shard, viewMap, false)
|
||||
b.log.Debugf("imp-roar %s,shard:%d,views:%d %v", field, shard, len(clearViewMap), time.Since(start))
|
||||
b.log.Debugf("imp-roar %s,shard:%d,views:%d %v", field, shard, len(clearViewMap), time.Since(starty))
|
||||
return errors.Wrapf(err, "importing data for %s", field)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,8 +180,8 @@ func newClientWithCluster(cluster *Cluster, options *ClientOptions) *Client {
|
|||
func newClientWithURI(uri *pnet.URI, options *ClientOptions) *Client {
|
||||
client := newClientWithOptions(options)
|
||||
if options.manualServerAddress {
|
||||
fragmentNode := newFragmentNodeFromURI(uri)
|
||||
client.manualFragmentNode = &fragmentNode
|
||||
fNode := newFragmentNodeFromURI(uri)
|
||||
client.manualFragmentNode = &fNode
|
||||
client.manualServerURI = uri
|
||||
client.cluster = NewClusterWithHost()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/molecula/featurebase/v2"
|
||||
pilosa "github.com/molecula/featurebase/v2"
|
||||
"github.com/molecula/featurebase/v2/pql"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
|
@ -122,15 +122,15 @@ func TestORM(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("NewIndexOptions", func(t *testing.T) {
|
||||
schema := NewSchema()
|
||||
schemal := NewSchema()
|
||||
// test the defaults
|
||||
index := schema.Index("index-default-options")
|
||||
index := schemal.Index("index-default-options")
|
||||
target := `{"options":{}}`
|
||||
if target != index.options.String() {
|
||||
t.Fatalf("%s != %s", target, index.options.String())
|
||||
}
|
||||
|
||||
index = schema.Index("index-keys", OptIndexKeys(true))
|
||||
index = schemal.Index("index-keys", OptIndexKeys(true))
|
||||
if true != index.Opts().Keys() {
|
||||
t.Fatalf("index keys %v != %v", true, index.Opts().Keys())
|
||||
}
|
||||
|
|
@ -139,7 +139,7 @@ func TestORM(t *testing.T) {
|
|||
t.Fatalf("%s != %s", target, index.options.String())
|
||||
}
|
||||
|
||||
index = schema.Index("index-trackexistence", OptIndexTrackExistence(false))
|
||||
index = schemal.Index("index-trackexistence", OptIndexTrackExistence(false))
|
||||
if false != index.Opts().TrackExistence() {
|
||||
t.Fatalf("index trackExistene %v != %v", true, index.Opts().TrackExistence())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1534,7 +1534,7 @@ func (c *cluster) translateFieldListIDs(field *Field, ids []uint64) (keys []stri
|
|||
|
||||
// TODO: remove this when it is no longer used
|
||||
func (c *cluster) translateIndexKey(ctx context.Context, indexName string, key string, writable bool) (uint64, error) {
|
||||
keyMap, err := c.translateIndexKeySet(ctx, indexName, map[string]struct{}{key: struct{}{}}, writable)
|
||||
keyMap, err := c.translateIndexKeySet(ctx, indexName, map[string]struct{}{key: {}}, writable)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package main
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build amd64
|
||||
// +build amd64
|
||||
|
||||
package pilosa
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
|
||||
toml "github.com/pelletier/go-toml"
|
||||
"github.com/molecula/featurebase/v2"
|
||||
"github.com/molecula/featurebase/v2/server"
|
||||
toml "github.com/pelletier/go-toml"
|
||||
)
|
||||
|
||||
// ConfigCommand represents a command for printing a default config.
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/pelletier/go-toml"
|
||||
"github.com/molecula/featurebase/v2"
|
||||
"github.com/molecula/featurebase/v2/server"
|
||||
"github.com/pelletier/go-toml"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
|
|
|||
24
executor.go
24
executor.go
|
|
@ -2620,7 +2620,7 @@ func (r RowIdentifiers) ToRows(callback func(*proto.RowResponse) error) error {
|
|||
if err := callback(&proto.RowResponse{
|
||||
Headers: ci,
|
||||
Columns: []*proto.ColumnResponse{
|
||||
&proto.ColumnResponse{ColumnVal: &proto.ColumnResponse_StringVal{StringVal: key}},
|
||||
{ColumnVal: &proto.ColumnResponse_StringVal{StringVal: key}},
|
||||
}}); err != nil {
|
||||
return errors.Wrap(err, "calling callback")
|
||||
}
|
||||
|
|
@ -2632,7 +2632,7 @@ func (r RowIdentifiers) ToRows(callback func(*proto.RowResponse) error) error {
|
|||
if err := callback(&proto.RowResponse{
|
||||
Headers: ci,
|
||||
Columns: []*proto.ColumnResponse{
|
||||
&proto.ColumnResponse{ColumnVal: &proto.ColumnResponse_Uint64Val{Uint64Val: uint64(id)}},
|
||||
{ColumnVal: &proto.ColumnResponse_Uint64Val{Uint64Val: uint64(id)}},
|
||||
}}); err != nil {
|
||||
return errors.Wrap(err, "calling callback")
|
||||
}
|
||||
|
|
@ -7362,7 +7362,7 @@ func (s SignedRow) ToRows(callback func(*proto.RowResponse) error) error {
|
|||
if err := callback(&proto.RowResponse{
|
||||
Headers: ci,
|
||||
Columns: []*proto.ColumnResponse{
|
||||
&proto.ColumnResponse{ColumnVal: &proto.ColumnResponse_Int64Val{Int64Val: val}},
|
||||
{ColumnVal: &proto.ColumnResponse_Int64Val{Int64Val: val}},
|
||||
},
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "calling callback")
|
||||
|
|
@ -7380,7 +7380,7 @@ func (s SignedRow) ToRows(callback func(*proto.RowResponse) error) error {
|
|||
if err := callback(&proto.RowResponse{
|
||||
Headers: ci,
|
||||
Columns: []*proto.ColumnResponse{
|
||||
&proto.ColumnResponse{ColumnVal: &proto.ColumnResponse_Int64Val{Int64Val: val}},
|
||||
{ColumnVal: &proto.ColumnResponse_Int64Val{Int64Val: val}},
|
||||
},
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "calling callback")
|
||||
|
|
@ -7480,8 +7480,8 @@ func (v ValCount) ToRows(callback func(*proto.RowResponse) error) error {
|
|||
if err := callback(&proto.RowResponse{
|
||||
Headers: ci,
|
||||
Columns: []*proto.ColumnResponse{
|
||||
&proto.ColumnResponse{ColumnVal: &proto.ColumnResponse_DecimalVal{DecimalVal: &proto.Decimal{Value: v.DecimalVal.Value, Scale: v.DecimalVal.Scale}}},
|
||||
&proto.ColumnResponse{ColumnVal: &proto.ColumnResponse_Int64Val{Int64Val: v.Count}},
|
||||
{ColumnVal: &proto.ColumnResponse_DecimalVal{DecimalVal: &proto.Decimal{Value: v.DecimalVal.Value, Scale: v.DecimalVal.Scale}}},
|
||||
{ColumnVal: &proto.ColumnResponse_Int64Val{Int64Val: v.Count}},
|
||||
}}); err != nil {
|
||||
return errors.Wrap(err, "calling callback")
|
||||
}
|
||||
|
|
@ -7493,8 +7493,8 @@ func (v ValCount) ToRows(callback func(*proto.RowResponse) error) error {
|
|||
if err := callback(&proto.RowResponse{
|
||||
Headers: ci,
|
||||
Columns: []*proto.ColumnResponse{
|
||||
&proto.ColumnResponse{ColumnVal: &proto.ColumnResponse_Float64Val{Float64Val: v.FloatVal}},
|
||||
&proto.ColumnResponse{ColumnVal: &proto.ColumnResponse_Int64Val{Int64Val: v.Count}},
|
||||
{ColumnVal: &proto.ColumnResponse_Float64Val{Float64Val: v.FloatVal}},
|
||||
{ColumnVal: &proto.ColumnResponse_Int64Val{Int64Val: v.Count}},
|
||||
}}); err != nil {
|
||||
return errors.Wrap(err, "calling callback")
|
||||
}
|
||||
|
|
@ -7506,8 +7506,8 @@ func (v ValCount) ToRows(callback func(*proto.RowResponse) error) error {
|
|||
if err := callback(&proto.RowResponse{
|
||||
Headers: ci,
|
||||
Columns: []*proto.ColumnResponse{
|
||||
&proto.ColumnResponse{ColumnVal: &proto.ColumnResponse_StringVal{StringVal: v.TimestampVal.Format(time.RFC3339Nano)}},
|
||||
&proto.ColumnResponse{ColumnVal: &proto.ColumnResponse_Int64Val{Int64Val: v.Count}},
|
||||
{ColumnVal: &proto.ColumnResponse_StringVal{StringVal: v.TimestampVal.Format(time.RFC3339Nano)}},
|
||||
{ColumnVal: &proto.ColumnResponse_Int64Val{Int64Val: v.Count}},
|
||||
}}); err != nil {
|
||||
return errors.Wrap(err, "calling callback")
|
||||
}
|
||||
|
|
@ -7519,8 +7519,8 @@ func (v ValCount) ToRows(callback func(*proto.RowResponse) error) error {
|
|||
if err := callback(&proto.RowResponse{
|
||||
Headers: ci,
|
||||
Columns: []*proto.ColumnResponse{
|
||||
&proto.ColumnResponse{ColumnVal: &proto.ColumnResponse_Int64Val{Int64Val: v.Val}},
|
||||
&proto.ColumnResponse{ColumnVal: &proto.ColumnResponse_Int64Val{Int64Val: v.Count}},
|
||||
{ColumnVal: &proto.ColumnResponse_Int64Val{Int64Val: v.Val}},
|
||||
{ColumnVal: &proto.ColumnResponse_Int64Val{Int64Val: v.Count}},
|
||||
}}); err != nil {
|
||||
return errors.Wrap(err, "calling callback")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -961,9 +961,9 @@ func (f *fragment) unprotectedClearBlock(tx Tx, block int) (changed bool, err er
|
|||
err = f.gen.Transaction(wp, func() error {
|
||||
var rowChanged bool
|
||||
for rowID := uint64(firstRow); rowID < firstRow+HashBlockSize; rowID++ {
|
||||
if changed, err := f.unprotectedClearRow(tx, rowID); err != nil {
|
||||
if chang, err := f.unprotectedClearRow(tx, rowID); err != nil {
|
||||
return errors.Wrapf(err, "clearing row: %d", rowID)
|
||||
} else if changed {
|
||||
} else if chang {
|
||||
rowChanged = true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5375,7 +5375,7 @@ func TestFragmentConcurrentReadWrite(t *testing.T) {
|
|||
eg := &errgroup.Group{}
|
||||
eg.Go(func() error {
|
||||
|
||||
tx := idx.holder.txf.NewTx(Txo{Write: writable, Index: idx, Fragment: f, Shard: f.shard})
|
||||
ltx := idx.holder.txf.NewTx(Txo{Write: writable, Index: idx, Fragment: f, Shard: f.shard})
|
||||
|
||||
for i := uint64(0); i < 1000; i++ {
|
||||
_, err := f.setBit(tx, i%4, i)
|
||||
|
|
@ -5383,7 +5383,7 @@ func TestFragmentConcurrentReadWrite(t *testing.T) {
|
|||
return errors.Wrap(err, "setting bit")
|
||||
}
|
||||
}
|
||||
PanicOn(tx.Commit())
|
||||
PanicOn(ltx.Commit())
|
||||
return nil
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build !generationdebug
|
||||
// +build !generationdebug
|
||||
|
||||
package pilosa
|
||||
|
|
|
|||
2
hack.go
2
hack.go
|
|
@ -15,7 +15,7 @@
|
|||
package pilosa
|
||||
|
||||
import (
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/molecula/featurebase/v2/pb"
|
||||
"github.com/molecula/featurebase/v2/pql"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -2082,7 +2082,7 @@ func (h *Holder) Process(ctx context.Context, op HolderOperator) (err error) {
|
|||
if !recurse {
|
||||
continue
|
||||
}
|
||||
fragNums := fragNums[:0]
|
||||
fragNums = fragNums[:0]
|
||||
view.mu.Lock()
|
||||
for fragNum := range view.fragments {
|
||||
fragNums = append(fragNums, fragNum)
|
||||
|
|
|
|||
|
|
@ -1326,7 +1326,7 @@ func (h *Handler) handlePostField(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
fos := fieldOptionsToFunctionalOpts(req.Options)
|
||||
field, err := h.api.CreateField(r.Context(), indexName, fieldName, fos...)
|
||||
if _, ok := err.(pilosa.BadRequestError); ok {
|
||||
if _, ok = err.(pilosa.BadRequestError); ok {
|
||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
10
rbf.go
10
rbf.go
|
|
@ -254,25 +254,25 @@ func (tx *RBFTx) addOrRemove(index, field, view string, shard uint64, remove boo
|
|||
if rc.N() == 0 {
|
||||
return 0, nil
|
||||
}
|
||||
rc, chng := rc.Remove(lo)
|
||||
rc1, chng := rc.Remove(lo)
|
||||
if !chng {
|
||||
return 0, nil
|
||||
}
|
||||
if rc.N() == 0 {
|
||||
if rc1.N() == 0 {
|
||||
err = tx.tx.RemoveContainer(name, hi)
|
||||
} else {
|
||||
err = tx.tx.PutContainer(name, hi, rc)
|
||||
err = tx.tx.PutContainer(name, hi, rc1)
|
||||
}
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return 1, nil
|
||||
} else {
|
||||
rc, chng := rc.Add(lo)
|
||||
rc2, chng := rc.Add(lo)
|
||||
if !chng {
|
||||
return 0, nil
|
||||
}
|
||||
err = tx.tx.PutContainer(name, hi, rc)
|
||||
err = tx.tx.PutContainer(name, hi, rc2)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -558,10 +558,12 @@ func TestCursor_RLETesting(t *testing.T) {
|
|||
}
|
||||
|
||||
want := []uint16{0}
|
||||
if got, want := c.Values(), want; !reflect.DeepEqual(got, want) {
|
||||
got := c.Values()
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Fatalf("Values()=%#v, want %#v", got, want)
|
||||
} else if got, want := c.Key(), uint64(1); !reflect.DeepEqual(got, want) {
|
||||
t.Fatalf("Key()=%#v, want %#v", got, want)
|
||||
}
|
||||
if g, w := c.Key(), uint64(1); !reflect.DeepEqual(g, w) {
|
||||
t.Fatalf("Key()=%#v, want %#v", g, w)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -1140,7 +1142,7 @@ func TestForEachRange(t *testing.T) {
|
|||
}
|
||||
|
||||
rb.Put(0, roaring.NewContainerBitmap(n, bits))
|
||||
crun := roaring.NewContainerRun([]roaring.Interval16{roaring.Interval16{Start: 0, Last: 1<<16 - 1}})
|
||||
crun := roaring.NewContainerRun([]roaring.Interval16{{Start: 0, Last: 1<<16 - 1}})
|
||||
rb.Put(1, crun)
|
||||
rb.Put(2, roaring.NewContainerArray([]uint16{1, 1024, 1<<16 - 1}))
|
||||
|
||||
|
|
|
|||
|
|
@ -78,8 +78,8 @@ func dumpdot(tx *Tx, pgno uint32, parent string, writer io.Writer) {
|
|||
for _, record := range records {
|
||||
root := fmt.Sprintf("root%d", record.Pgno)
|
||||
fmt.Fprintf(writer, "%s[label=\"ROOT(%d)| %s\"]\n%s->%s\n", root, record.Pgno, record.Name, rr, root)
|
||||
parent := fmt.Sprintf("root%d", record.Pgno)
|
||||
dumpdot(tx, record.Pgno, parent, writer)
|
||||
p := fmt.Sprintf("root%d", record.Pgno)
|
||||
dumpdot(tx, record.Pgno, p, writer)
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ func TestReadWriteRootRecord(t *testing.T) {
|
|||
// Write records.
|
||||
if remaining, err := rbf.WriteRootRecord(buf, &rbf.RootRecord{Pgno: 10, Name: "foo"}); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if remaining, err := rbf.WriteRootRecord(remaining, &rbf.RootRecord{Pgno: 11, Name: "bar"}); err != nil {
|
||||
} else if remaining, err = rbf.WriteRootRecord(remaining, &rbf.RootRecord{Pgno: 11, Name: "bar"}); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if _, err := rbf.WriteRootRecord(remaining, &rbf.RootRecord{Pgno: 12, Name: "baz"}); err != io.ErrShortBuffer {
|
||||
t.Fatalf("unexpected error: %#v", err) // buffer too short
|
||||
|
|
@ -50,7 +50,7 @@ func TestReadWriteRootRecord(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
} else if got, want := *rec, (rbf.RootRecord{Pgno: 10, Name: "foo"}); got != want {
|
||||
t.Fatalf("ReadRootRecord=%#v, want %#v", got, want)
|
||||
} else if rec, remaining, err := rbf.ReadRootRecord(remaining); err != nil {
|
||||
} else if rec, remaining, err = rbf.ReadRootRecord(remaining); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if got, want := *rec, (rbf.RootRecord{Pgno: 11, Name: "bar"}); got != want {
|
||||
t.Fatalf("ReadRootRecord=%#v, want %#v", got, want)
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build !race
|
||||
// +build !race
|
||||
|
||||
package roaring
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build !generationdebug
|
||||
// +build !generationdebug
|
||||
|
||||
package roaring
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build !btreeInstrumentation
|
||||
// +build !btreeInstrumentation
|
||||
|
||||
package roaring
|
||||
|
|
|
|||
|
|
@ -99,9 +99,10 @@ func TestContainerRunAdd(t *testing.T) {
|
|||
{0, []Interval16{{Start: 0, Last: 4}, {Start: 6, Last: 7}, {Start: 10, Last: 10}}},
|
||||
{8, []Interval16{{Start: 0, Last: 4}, {Start: 6, Last: 8}, {Start: 10, Last: 10}}},
|
||||
}
|
||||
var changed bool
|
||||
for _, test := range tests {
|
||||
c.setMapped(true)
|
||||
c, changed := c.add(test.op)
|
||||
c, changed = c.add(test.op)
|
||||
if !changed {
|
||||
t.Fatalf("result of adding new bit should be true: %v", c.runs())
|
||||
}
|
||||
|
|
@ -731,65 +732,65 @@ func TestUnionInterval16InPlace(t *testing.T) {
|
|||
}{
|
||||
{
|
||||
name: "firstBitUnset lastBitSet",
|
||||
a: []Interval16{Interval16{1, 10}},
|
||||
b: []Interval16{Interval16{10, 10}},
|
||||
expected: []Interval16{Interval16{1, 10}},
|
||||
a: []Interval16{{1, 10}},
|
||||
b: []Interval16{{10, 10}},
|
||||
expected: []Interval16{{1, 10}},
|
||||
expectedN: 10,
|
||||
},
|
||||
{
|
||||
name: "single overlap",
|
||||
a: []Interval16{Interval16{1, 10}, Interval16{21, 28}},
|
||||
b: []Interval16{Interval16{8, 12}},
|
||||
expected: []Interval16{Interval16{1, 12}, Interval16{21, 28}},
|
||||
a: []Interval16{{1, 10}, {21, 28}},
|
||||
b: []Interval16{{8, 12}},
|
||||
expected: []Interval16{{1, 12}, {21, 28}},
|
||||
expectedN: 20,
|
||||
},
|
||||
{
|
||||
name: "nested intervals",
|
||||
a: []Interval16{Interval16{3, 13}, Interval16{17, 20}},
|
||||
b: []Interval16{Interval16{1, 4}, Interval16{6, 7}, Interval16{8, 9}, Interval16{10, 11}, Interval16{14, 17}},
|
||||
expected: []Interval16{Interval16{1, 20}},
|
||||
a: []Interval16{{3, 13}, {17, 20}},
|
||||
b: []Interval16{{1, 4}, {6, 7}, {8, 9}, {10, 11}, {14, 17}},
|
||||
expected: []Interval16{{1, 20}},
|
||||
expectedN: 20,
|
||||
},
|
||||
{
|
||||
name: "no overlap",
|
||||
a: []Interval16{Interval16{3, 4}, Interval16{7, 8}},
|
||||
b: []Interval16{Interval16{1, 2}, Interval16{5, 6}, Interval16{9, 10}},
|
||||
expected: []Interval16{Interval16{1, 10}},
|
||||
a: []Interval16{{3, 4}, {7, 8}},
|
||||
b: []Interval16{{1, 2}, {5, 6}, {9, 10}},
|
||||
expected: []Interval16{{1, 10}},
|
||||
expectedN: 10,
|
||||
},
|
||||
{
|
||||
name: "b in a",
|
||||
a: []Interval16{Interval16{1, 10}},
|
||||
b: []Interval16{Interval16{5, 7}},
|
||||
expected: []Interval16{Interval16{1, 10}},
|
||||
a: []Interval16{{1, 10}},
|
||||
b: []Interval16{{5, 7}},
|
||||
expected: []Interval16{{1, 10}},
|
||||
expectedN: 10,
|
||||
},
|
||||
{
|
||||
name: "a eq b",
|
||||
a: []Interval16{Interval16{1, 10}},
|
||||
b: []Interval16{Interval16{1, 10}},
|
||||
expected: []Interval16{Interval16{1, 10}},
|
||||
a: []Interval16{{1, 10}},
|
||||
b: []Interval16{{1, 10}},
|
||||
expected: []Interval16{{1, 10}},
|
||||
expectedN: 10,
|
||||
},
|
||||
{
|
||||
name: "a in b",
|
||||
a: []Interval16{Interval16{5, 7}},
|
||||
b: []Interval16{Interval16{1, 10}},
|
||||
expected: []Interval16{Interval16{1, 10}},
|
||||
a: []Interval16{{5, 7}},
|
||||
b: []Interval16{{1, 10}},
|
||||
expected: []Interval16{{1, 10}},
|
||||
expectedN: 10,
|
||||
},
|
||||
{
|
||||
name: "a ahead b",
|
||||
a: []Interval16{Interval16{1, 2}, Interval16{3, 4}, Interval16{5, 7}},
|
||||
b: []Interval16{Interval16{10, 11}, Interval16{12, 13}, Interval16{14, 15}},
|
||||
expected: []Interval16{Interval16{1, 7}, Interval16{10, 15}},
|
||||
a: []Interval16{{1, 2}, {3, 4}, {5, 7}},
|
||||
b: []Interval16{{10, 11}, {12, 13}, {14, 15}},
|
||||
expected: []Interval16{{1, 7}, {10, 15}},
|
||||
expectedN: 13,
|
||||
},
|
||||
{
|
||||
name: "b ahead a",
|
||||
a: []Interval16{Interval16{10, 11}, Interval16{12, 13}, Interval16{14, 15}},
|
||||
b: []Interval16{Interval16{1, 2}, Interval16{3, 4}, Interval16{5, 7}},
|
||||
expected: []Interval16{Interval16{1, 7}, Interval16{10, 15}},
|
||||
a: []Interval16{{10, 11}, {12, 13}, {14, 15}},
|
||||
b: []Interval16{{1, 2}, {3, 4}, {5, 7}},
|
||||
expected: []Interval16{{1, 7}, {10, 15}},
|
||||
expectedN: 13,
|
||||
},
|
||||
{
|
||||
|
|
@ -802,78 +803,78 @@ func TestUnionInterval16InPlace(t *testing.T) {
|
|||
{
|
||||
name: "empty a",
|
||||
a: []Interval16{},
|
||||
b: []Interval16{Interval16{1, 2}, Interval16{3, 4}, Interval16{5, 7}},
|
||||
expected: []Interval16{Interval16{1, 7}},
|
||||
b: []Interval16{{1, 2}, {3, 4}, {5, 7}},
|
||||
expected: []Interval16{{1, 7}},
|
||||
expectedN: 7,
|
||||
},
|
||||
{
|
||||
name: "empty b",
|
||||
a: []Interval16{Interval16{1, 2}, Interval16{3, 4}, Interval16{5, 7}},
|
||||
a: []Interval16{{1, 2}, {3, 4}, {5, 7}},
|
||||
b: []Interval16{},
|
||||
expected: []Interval16{Interval16{1, 7}},
|
||||
expected: []Interval16{{1, 7}},
|
||||
expectedN: 7,
|
||||
},
|
||||
{
|
||||
name: "single a",
|
||||
a: []Interval16{Interval16{1, 2}},
|
||||
a: []Interval16{{1, 2}},
|
||||
b: []Interval16{},
|
||||
expected: []Interval16{Interval16{1, 2}},
|
||||
expected: []Interval16{{1, 2}},
|
||||
expectedN: 2,
|
||||
},
|
||||
{
|
||||
name: "single b",
|
||||
a: []Interval16{},
|
||||
b: []Interval16{Interval16{1, 2}},
|
||||
expected: []Interval16{Interval16{1, 2}},
|
||||
b: []Interval16{{1, 2}},
|
||||
expected: []Interval16{{1, 2}},
|
||||
expectedN: 2,
|
||||
},
|
||||
{
|
||||
name: "single a single b",
|
||||
a: []Interval16{Interval16{3, 4}},
|
||||
b: []Interval16{Interval16{1, 2}},
|
||||
expected: []Interval16{Interval16{1, 4}},
|
||||
a: []Interval16{{3, 4}},
|
||||
b: []Interval16{{1, 2}},
|
||||
expected: []Interval16{{1, 4}},
|
||||
expectedN: 4,
|
||||
},
|
||||
{
|
||||
name: "oddBitsSet lastBitUnset",
|
||||
a: []Interval16{Interval16{1, 1}, Interval16{3, 3}, Interval16{5, 5}},
|
||||
b: []Interval16{Interval16{0, 4}},
|
||||
expected: []Interval16{Interval16{0, 5}},
|
||||
a: []Interval16{{1, 1}, {3, 3}, {5, 5}},
|
||||
b: []Interval16{{0, 4}},
|
||||
expected: []Interval16{{0, 5}},
|
||||
expectedN: 6,
|
||||
},
|
||||
{
|
||||
name: "all bits",
|
||||
a: []Interval16{Interval16{1, 1}, Interval16{3, 3}, Interval16{5, 5}},
|
||||
b: []Interval16{Interval16{0, 0}, Interval16{2, 2}, Interval16{4, 4}},
|
||||
expected: []Interval16{Interval16{0, 5}},
|
||||
a: []Interval16{{1, 1}, {3, 3}, {5, 5}},
|
||||
b: []Interval16{{0, 0}, {2, 2}, {4, 4}},
|
||||
expected: []Interval16{{0, 5}},
|
||||
expectedN: 6,
|
||||
},
|
||||
{
|
||||
name: "short a long b",
|
||||
a: []Interval16{Interval16{5, 5}, Interval16{7, 7}, Interval16{9, 10}, Interval16{12, 12}, Interval16{15, 17}, Interval16{19, 20}},
|
||||
b: []Interval16{Interval16{1, 10}, Interval16{12, 12}, Interval16{14, 18}},
|
||||
expected: []Interval16{Interval16{1, 10}, Interval16{12, 12}, Interval16{14, 20}},
|
||||
a: []Interval16{{5, 5}, {7, 7}, {9, 10}, {12, 12}, {15, 17}, {19, 20}},
|
||||
b: []Interval16{{1, 10}, {12, 12}, {14, 18}},
|
||||
expected: []Interval16{{1, 10}, {12, 12}, {14, 20}},
|
||||
expectedN: 18,
|
||||
},
|
||||
{
|
||||
name: "common endings",
|
||||
a: []Interval16{Interval16{1, 5}, Interval16{15, 20}, Interval16{25, 35}},
|
||||
b: []Interval16{Interval16{1, 10}, Interval16{15, 20}, Interval16{30, 35}},
|
||||
expected: []Interval16{Interval16{1, 10}, Interval16{15, 20}, Interval16{25, 35}},
|
||||
a: []Interval16{{1, 5}, {15, 20}, {25, 35}},
|
||||
b: []Interval16{{1, 10}, {15, 20}, {30, 35}},
|
||||
expected: []Interval16{{1, 10}, {15, 20}, {25, 35}},
|
||||
expectedN: 27,
|
||||
},
|
||||
{
|
||||
name: "common endings and overlap",
|
||||
a: []Interval16{Interval16{1, 5}, Interval16{10, 15}},
|
||||
b: []Interval16{Interval16{5, 10}, Interval16{12, 17}},
|
||||
expected: []Interval16{Interval16{1, 17}},
|
||||
a: []Interval16{{1, 5}, {10, 15}},
|
||||
b: []Interval16{{5, 10}, {12, 17}},
|
||||
expected: []Interval16{{1, 17}},
|
||||
expectedN: 17,
|
||||
},
|
||||
{
|
||||
name: "no common endings and overlap",
|
||||
a: []Interval16{Interval16{5, 10}, Interval16{12, 17}},
|
||||
b: []Interval16{Interval16{0, 11}, Interval16{15, 20}},
|
||||
expected: []Interval16{Interval16{0, 20}},
|
||||
a: []Interval16{{5, 10}, {12, 17}},
|
||||
b: []Interval16{{0, 11}, {15, 20}},
|
||||
expected: []Interval16{{0, 20}},
|
||||
expectedN: 21,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build !roaringparanoia
|
||||
// +build !roaringparanoia
|
||||
|
||||
package roaring
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build !roaringsentinel
|
||||
// +build !roaringsentinel
|
||||
|
||||
package roaring
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build !roaringstats
|
||||
// +build !roaringstats
|
||||
|
||||
package roaring
|
||||
|
|
|
|||
6
row.go
6
row.go
|
|
@ -146,7 +146,7 @@ func (r *Row) ToRows(callback func(*pb.RowResponse) error) error {
|
|||
if err := callback(&pb.RowResponse{
|
||||
Headers: ci,
|
||||
Columns: []*pb.ColumnResponse{
|
||||
&pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_StringVal{StringVal: x}},
|
||||
{ColumnVal: &pb.ColumnResponse_StringVal{StringVal: x}},
|
||||
}}); err != nil {
|
||||
return errors.Wrap(err, "calling callback")
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ func (r *Row) ToRows(callback func(*pb.RowResponse) error) error {
|
|||
if err := callback(&pb.RowResponse{
|
||||
Headers: ci,
|
||||
Columns: []*pb.ColumnResponse{
|
||||
&pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_Uint64Val{Uint64Val: x}},
|
||||
{ColumnVal: &pb.ColumnResponse_Uint64Val{Uint64Val: x}},
|
||||
}}); err != nil {
|
||||
return errors.Wrap(err, "calling callback")
|
||||
}
|
||||
|
|
@ -308,7 +308,7 @@ func (r *Row) Union(others ...*Row) *Row {
|
|||
}
|
||||
}
|
||||
nextSegs = nextSegs[:0]
|
||||
toProcess := toProcess[:0]
|
||||
toProcess = toProcess[:0]
|
||||
for _, segs := range segments {
|
||||
if segs[0].shard == shard {
|
||||
toProcess = append(toProcess, &segs[0])
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build darwin || (linux && !arm64)
|
||||
// +build darwin linux,!arm64
|
||||
|
||||
package server
|
||||
|
|
|
|||
|
|
@ -471,7 +471,7 @@ func (r ResultUint64) ToRows(callback func(*pb.RowResponse) error) error {
|
|||
return callback(&pb.RowResponse{
|
||||
Headers: []*pb.ColumnInfo{{Name: "count", Datatype: "uint64"}},
|
||||
Columns: []*pb.ColumnResponse{
|
||||
&pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_Uint64Val{Uint64Val: uint64(r)}},
|
||||
{ColumnVal: &pb.ColumnResponse_Uint64Val{Uint64Val: uint64(r)}},
|
||||
}})
|
||||
}
|
||||
|
||||
|
|
@ -490,7 +490,7 @@ func (r ResultBool) ToRows(callback func(*pb.RowResponse) error) error {
|
|||
return callback(&pb.RowResponse{
|
||||
Headers: []*pb.ColumnInfo{{Name: "result", Datatype: "bool"}},
|
||||
Columns: []*pb.ColumnResponse{
|
||||
&pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_BoolVal{BoolVal: bool(r)}},
|
||||
{ColumnVal: &pb.ColumnResponse_BoolVal{BoolVal: bool(r)}},
|
||||
}})
|
||||
}
|
||||
|
||||
|
|
@ -714,7 +714,7 @@ func (h *GRPCHandler) Inspect(req *pb.InspectRequest, stream pb.Pilosa_InspectSe
|
|||
rowResp := &pb.RowResponse{
|
||||
Headers: ci,
|
||||
Columns: []*pb.ColumnResponse{
|
||||
&pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_Uint64Val{Uint64Val: col}},
|
||||
{ColumnVal: &pb.ColumnResponse_Uint64Val{Uint64Val: col}},
|
||||
},
|
||||
}
|
||||
ci = nil // only include headers with the first row
|
||||
|
|
@ -1029,7 +1029,7 @@ func (h *GRPCHandler) Inspect(req *pb.InspectRequest, stream pb.Pilosa_InspectSe
|
|||
rowResp := &pb.RowResponse{
|
||||
Headers: ci,
|
||||
Columns: []*pb.ColumnResponse{
|
||||
&pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_StringVal{StringVal: col}},
|
||||
{ColumnVal: &pb.ColumnResponse_StringVal{StringVal: col}},
|
||||
},
|
||||
}
|
||||
ci = nil // only include headers with the first row
|
||||
|
|
|
|||
|
|
@ -141,21 +141,21 @@ func TestGRPC(t *testing.T) {
|
|||
// []GroupCount (uint64)
|
||||
{
|
||||
pilosa.NewGroupCounts("", []pilosa.GroupCount{
|
||||
pilosa.GroupCount{
|
||||
{
|
||||
Group: []pilosa.FieldRow{
|
||||
{Field: "a", RowID: 10},
|
||||
{Field: "b", RowID: 11},
|
||||
},
|
||||
Count: 123,
|
||||
},
|
||||
pilosa.GroupCount{
|
||||
{
|
||||
Group: []pilosa.FieldRow{
|
||||
{Field: "a", RowID: 10},
|
||||
{Field: "b", RowID: 12},
|
||||
},
|
||||
Count: 456,
|
||||
},
|
||||
pilosa.GroupCount{
|
||||
{
|
||||
Group: []pilosa.FieldRow{
|
||||
{Field: "va", Value: &va},
|
||||
{Field: "vb", Value: &vb},
|
||||
|
|
@ -177,7 +177,7 @@ func TestGRPC(t *testing.T) {
|
|||
// []GroupCount (string) + sum
|
||||
{
|
||||
pilosa.NewGroupCounts("sum", []pilosa.GroupCount{
|
||||
pilosa.GroupCount{
|
||||
{
|
||||
Group: []pilosa.FieldRow{
|
||||
{Field: "a", RowKey: "ten"},
|
||||
{Field: "b", RowKey: "eleven"},
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/molecula/featurebase/v2"
|
||||
pilosa "github.com/molecula/featurebase/v2"
|
||||
"github.com/molecula/featurebase/v2/boltdb"
|
||||
"github.com/molecula/featurebase/v2/encoding/proto"
|
||||
"github.com/molecula/featurebase/v2/http"
|
||||
|
|
@ -1104,7 +1104,7 @@ func TestHandler_Endpoints(t *testing.T) {
|
|||
clus := test.MustRunCluster(t, 1, []server.CommandOption{test.OptAllowedOrigins([]string{"http://test/"})})
|
||||
defer clus.Close()
|
||||
w = httptest.NewRecorder()
|
||||
h := clus.GetNode(0).Handler.(*http.Handler).Handler
|
||||
h = clus.GetNode(0).Handler.(*http.Handler).Handler
|
||||
h.ServeHTTP(w, req)
|
||||
result = w.Result()
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/molecula/featurebase/v2"
|
||||
pilosa "github.com/molecula/featurebase/v2"
|
||||
"github.com/molecula/featurebase/v2/pql"
|
||||
pproto "github.com/molecula/featurebase/v2/proto"
|
||||
"github.com/pkg/errors"
|
||||
|
|
@ -56,8 +56,8 @@ func (s *SelectHandler) Handle(ctx context.Context, mapped *MappedSQL) (pproto.T
|
|||
|
||||
func (s *SelectHandler) mapSelect(ctx context.Context, selectStmt *sqlparser.Select, qm QueryMask) (*MappingResult, error) {
|
||||
// Get the handler for this query mask.
|
||||
handler := s.router.handler(qm)
|
||||
if handler == nil {
|
||||
hndlr := s.router.handler(qm)
|
||||
if hndlr == nil {
|
||||
return nil, ErrUnsupportedQuery
|
||||
}
|
||||
indexFunc := func(indexName string) *pilosa.Index {
|
||||
|
|
@ -68,7 +68,7 @@ func (s *SelectHandler) mapSelect(ctx context.Context, selectStmt *sqlparser.Sel
|
|||
return idx
|
||||
}
|
||||
|
||||
mr, err := handler.Apply(selectStmt, qm, indexFunc)
|
||||
mr, err := hndlr.Apply(selectStmt, qm, indexFunc)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "handling")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -569,7 +569,7 @@ func TestParser_ParseStatement(t *testing.T) {
|
|||
ForeignTable: &sql.Ident{Name: "foo", NamePos: pos(39)},
|
||||
ForeignLparen: pos(43),
|
||||
ForeignColumns: []*sql.Ident{
|
||||
&sql.Ident{Name: "col2", NamePos: pos(44)},
|
||||
{Name: "col2", NamePos: pos(44)},
|
||||
},
|
||||
ForeignRparen: pos(48),
|
||||
},
|
||||
|
|
@ -586,11 +586,11 @@ func TestParser_ParseStatement(t *testing.T) {
|
|||
ForeignTable: &sql.Ident{Name: "foo", NamePos: pos(39)},
|
||||
ForeignLparen: pos(43),
|
||||
ForeignColumns: []*sql.Ident{
|
||||
&sql.Ident{Name: "col2", NamePos: pos(44)},
|
||||
{Name: "col2", NamePos: pos(44)},
|
||||
},
|
||||
ForeignRparen: pos(48),
|
||||
Args: []*sql.ForeignKeyArg{
|
||||
&sql.ForeignKeyArg{
|
||||
{
|
||||
On: pos(50),
|
||||
OnDelete: pos(53),
|
||||
Set: pos(60),
|
||||
|
|
@ -608,11 +608,11 @@ func TestParser_ParseStatement(t *testing.T) {
|
|||
ForeignTable: &sql.Ident{Name: "foo", NamePos: pos(39)},
|
||||
ForeignLparen: pos(43),
|
||||
ForeignColumns: []*sql.Ident{
|
||||
&sql.Ident{Name: "col2", NamePos: pos(44)},
|
||||
{Name: "col2", NamePos: pos(44)},
|
||||
},
|
||||
ForeignRparen: pos(48),
|
||||
Args: []*sql.ForeignKeyArg{
|
||||
&sql.ForeignKeyArg{
|
||||
{
|
||||
On: pos(50),
|
||||
OnDelete: pos(53),
|
||||
Set: pos(60),
|
||||
|
|
@ -630,11 +630,11 @@ func TestParser_ParseStatement(t *testing.T) {
|
|||
ForeignTable: &sql.Ident{Name: "foo", NamePos: pos(39)},
|
||||
ForeignLparen: pos(43),
|
||||
ForeignColumns: []*sql.Ident{
|
||||
&sql.Ident{Name: "col2", NamePos: pos(44)},
|
||||
{Name: "col2", NamePos: pos(44)},
|
||||
},
|
||||
ForeignRparen: pos(48),
|
||||
Args: []*sql.ForeignKeyArg{
|
||||
&sql.ForeignKeyArg{
|
||||
{
|
||||
On: pos(50),
|
||||
OnDelete: pos(53),
|
||||
Cascade: pos(60),
|
||||
|
|
@ -651,11 +651,11 @@ func TestParser_ParseStatement(t *testing.T) {
|
|||
ForeignTable: &sql.Ident{Name: "foo", NamePos: pos(39)},
|
||||
ForeignLparen: pos(43),
|
||||
ForeignColumns: []*sql.Ident{
|
||||
&sql.Ident{Name: "col2", NamePos: pos(44)},
|
||||
{Name: "col2", NamePos: pos(44)},
|
||||
},
|
||||
ForeignRparen: pos(48),
|
||||
Args: []*sql.ForeignKeyArg{
|
||||
&sql.ForeignKeyArg{
|
||||
{
|
||||
On: pos(50),
|
||||
OnDelete: pos(53),
|
||||
Restrict: pos(60),
|
||||
|
|
@ -672,11 +672,11 @@ func TestParser_ParseStatement(t *testing.T) {
|
|||
ForeignTable: &sql.Ident{Name: "foo", NamePos: pos(39)},
|
||||
ForeignLparen: pos(43),
|
||||
ForeignColumns: []*sql.Ident{
|
||||
&sql.Ident{Name: "col2", NamePos: pos(44)},
|
||||
{Name: "col2", NamePos: pos(44)},
|
||||
},
|
||||
ForeignRparen: pos(48),
|
||||
Args: []*sql.ForeignKeyArg{
|
||||
&sql.ForeignKeyArg{
|
||||
{
|
||||
On: pos(50),
|
||||
OnDelete: pos(53),
|
||||
No: pos(60),
|
||||
|
|
@ -694,16 +694,16 @@ func TestParser_ParseStatement(t *testing.T) {
|
|||
ForeignTable: &sql.Ident{Name: "foo", NamePos: pos(39)},
|
||||
ForeignLparen: pos(43),
|
||||
ForeignColumns: []*sql.Ident{
|
||||
&sql.Ident{Name: "col2", NamePos: pos(44)},
|
||||
{Name: "col2", NamePos: pos(44)},
|
||||
},
|
||||
ForeignRparen: pos(48),
|
||||
Args: []*sql.ForeignKeyArg{
|
||||
&sql.ForeignKeyArg{
|
||||
{
|
||||
On: pos(50),
|
||||
OnDelete: pos(53),
|
||||
Cascade: pos(60),
|
||||
},
|
||||
&sql.ForeignKeyArg{
|
||||
{
|
||||
On: pos(68),
|
||||
OnUpdate: pos(71),
|
||||
Restrict: pos(78),
|
||||
|
|
@ -720,7 +720,7 @@ func TestParser_ParseStatement(t *testing.T) {
|
|||
ForeignTable: &sql.Ident{Name: "foo", NamePos: pos(39)},
|
||||
ForeignLparen: pos(43),
|
||||
ForeignColumns: []*sql.Ident{
|
||||
&sql.Ident{Name: "col2", NamePos: pos(44)},
|
||||
{Name: "col2", NamePos: pos(44)},
|
||||
},
|
||||
ForeignRparen: pos(48),
|
||||
Deferrable: pos(50),
|
||||
|
|
@ -735,7 +735,7 @@ func TestParser_ParseStatement(t *testing.T) {
|
|||
ForeignTable: &sql.Ident{Name: "foo", NamePos: pos(39)},
|
||||
ForeignLparen: pos(43),
|
||||
ForeignColumns: []*sql.Ident{
|
||||
&sql.Ident{Name: "col2", NamePos: pos(44)},
|
||||
{Name: "col2", NamePos: pos(44)},
|
||||
},
|
||||
ForeignRparen: pos(48),
|
||||
Not: pos(50),
|
||||
|
|
@ -751,7 +751,7 @@ func TestParser_ParseStatement(t *testing.T) {
|
|||
ForeignTable: &sql.Ident{Name: "foo", NamePos: pos(39)},
|
||||
ForeignLparen: pos(43),
|
||||
ForeignColumns: []*sql.Ident{
|
||||
&sql.Ident{Name: "col2", NamePos: pos(44)},
|
||||
{Name: "col2", NamePos: pos(44)},
|
||||
},
|
||||
ForeignRparen: pos(48),
|
||||
Deferrable: pos(50),
|
||||
|
|
@ -768,7 +768,7 @@ func TestParser_ParseStatement(t *testing.T) {
|
|||
ForeignTable: &sql.Ident{Name: "foo", NamePos: pos(39)},
|
||||
ForeignLparen: pos(43),
|
||||
ForeignColumns: []*sql.Ident{
|
||||
&sql.Ident{Name: "col2", NamePos: pos(44)},
|
||||
{Name: "col2", NamePos: pos(44)},
|
||||
},
|
||||
ForeignRparen: pos(48),
|
||||
Deferrable: pos(50),
|
||||
|
|
@ -802,8 +802,8 @@ func TestParser_ParseStatement(t *testing.T) {
|
|||
Key: pos(37),
|
||||
Lparen: pos(41),
|
||||
Columns: []*sql.Ident{
|
||||
&sql.Ident{Name: "col1", NamePos: pos(42)},
|
||||
&sql.Ident{Name: "col2", NamePos: pos(48)},
|
||||
{Name: "col1", NamePos: pos(42)},
|
||||
{Name: "col2", NamePos: pos(48)},
|
||||
},
|
||||
Rparen: pos(52),
|
||||
},
|
||||
|
|
@ -838,8 +838,8 @@ func TestParser_ParseStatement(t *testing.T) {
|
|||
Unique: pos(45),
|
||||
Lparen: pos(52),
|
||||
Columns: []*sql.Ident{
|
||||
&sql.Ident{Name: "col1", NamePos: pos(53)},
|
||||
&sql.Ident{Name: "col2", NamePos: pos(59)},
|
||||
{Name: "col1", NamePos: pos(53)},
|
||||
{Name: "col2", NamePos: pos(59)},
|
||||
},
|
||||
Rparen: pos(63),
|
||||
},
|
||||
|
|
@ -903,16 +903,16 @@ func TestParser_ParseStatement(t *testing.T) {
|
|||
ForeignKey: pos(37),
|
||||
Lparen: pos(41),
|
||||
Columns: []*sql.Ident{
|
||||
&sql.Ident{Name: "col1", NamePos: pos(42)},
|
||||
&sql.Ident{Name: "col2", NamePos: pos(48)},
|
||||
{Name: "col1", NamePos: pos(42)},
|
||||
{Name: "col2", NamePos: pos(48)},
|
||||
},
|
||||
Rparen: pos(52),
|
||||
References: pos(54),
|
||||
ForeignTable: &sql.Ident{Name: "tbl2", NamePos: pos(65)},
|
||||
ForeignLparen: pos(70),
|
||||
ForeignColumns: []*sql.Ident{
|
||||
&sql.Ident{Name: "x", NamePos: pos(71)},
|
||||
&sql.Ident{Name: "y", NamePos: pos(74)},
|
||||
{Name: "x", NamePos: pos(71)},
|
||||
{Name: "y", NamePos: pos(74)},
|
||||
},
|
||||
ForeignRparen: pos(75),
|
||||
},
|
||||
|
|
@ -963,8 +963,8 @@ func TestParser_ParseStatement(t *testing.T) {
|
|||
Name: &sql.Ident{NamePos: pos(12), Name: "vw"},
|
||||
Lparen: pos(15),
|
||||
Columns: []*sql.Ident{
|
||||
&sql.Ident{NamePos: pos(16), Name: "col1"},
|
||||
&sql.Ident{NamePos: pos(22), Name: "col2"},
|
||||
{NamePos: pos(16), Name: "col1"},
|
||||
{NamePos: pos(22), Name: "col2"},
|
||||
},
|
||||
Rparen: pos(26),
|
||||
As: pos(28),
|
||||
|
|
@ -1709,8 +1709,8 @@ func TestParser_ParseStatement(t *testing.T) {
|
|||
Order: pos(9),
|
||||
OrderBy: pos(15),
|
||||
OrderingTerms: []*sql.OrderingTerm{
|
||||
&sql.OrderingTerm{X: &sql.Ident{NamePos: pos(18), Name: "foo"}, Asc: pos(22)},
|
||||
&sql.OrderingTerm{X: &sql.Ident{NamePos: pos(27), Name: "bar"}, Desc: pos(31)},
|
||||
{X: &sql.Ident{NamePos: pos(18), Name: "foo"}, Asc: pos(22)},
|
||||
{X: &sql.Ident{NamePos: pos(27), Name: "bar"}, Desc: pos(31)},
|
||||
},
|
||||
})
|
||||
|
||||
|
|
@ -1757,7 +1757,7 @@ func TestParser_ParseStatement(t *testing.T) {
|
|||
Order: pos(24),
|
||||
OrderBy: pos(30),
|
||||
OrderingTerms: []*sql.OrderingTerm{
|
||||
&sql.OrderingTerm{X: &sql.Ident{NamePos: pos(33), Name: "foo"}},
|
||||
{X: &sql.Ident{NamePos: pos(33), Name: "foo"}},
|
||||
},
|
||||
})
|
||||
AssertParseStatement(t, `SELECT * UNION ALL SELECT *`, &sql.SelectStatement{
|
||||
|
|
|
|||
|
|
@ -228,9 +228,7 @@ func walk(v Visitor, node Node) (_ Node, err error) {
|
|||
if n.Source != nil {
|
||||
if src, err := walk(v, n.Source); err != nil {
|
||||
return node, err
|
||||
} else if src != nil {
|
||||
n.Source = n.Source
|
||||
} else {
|
||||
} else if src == nil {
|
||||
n.Source = nil
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@
|
|||
package syswrap
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"syscall"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
|
|
|||
2
time.go
2
time.go
|
|
@ -288,7 +288,7 @@ func parseTime(t interface{}) (time.Time, error) {
|
|||
if calcTime, err = time.Parse(TimeFormat, v); err != nil {
|
||||
// if the default parsing fails, check if user tried to
|
||||
// supply partial time eg year and month
|
||||
calcTime, err := parsePartialTime(v)
|
||||
calcTime, err = parsePartialTime(v)
|
||||
return calcTime, err
|
||||
}
|
||||
case int64:
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ import (
|
|||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/opentracing/opentracing-go"
|
||||
"github.com/opentracing/opentracing-go/ext"
|
||||
"github.com/molecula/featurebase/v2/logger"
|
||||
"github.com/molecula/featurebase/v2/tracing"
|
||||
"github.com/opentracing/opentracing-go"
|
||||
"github.com/opentracing/opentracing-go/ext"
|
||||
)
|
||||
|
||||
// Ensure type implements interface.
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/molecula/featurebase/v2"
|
||||
pilosa "github.com/molecula/featurebase/v2"
|
||||
"github.com/molecula/featurebase/v2/boltdb"
|
||||
"github.com/molecula/featurebase/v2/http"
|
||||
"github.com/molecula/featurebase/v2/mock"
|
||||
|
|
@ -550,9 +550,9 @@ func TestTranslation_Cluster_CreateFind(t *testing.T) {
|
|||
var g errgroup.Group
|
||||
defer g.Wait() //nolint:errcheck
|
||||
for i, n := range c.Nodes {
|
||||
i, api := i, n.API
|
||||
x, api := i, n.API
|
||||
g.Go(func() (err error) {
|
||||
defer func() { err = errors.Wrapf(err, "translating on node %d", i) }()
|
||||
defer func() { err = errors.Wrapf(err, "translating on node %d", x) }()
|
||||
localTranslations, err := api.FindIndexKeys(ctx, "i", keyList...)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "finding translations")
|
||||
|
|
@ -567,9 +567,9 @@ func TestTranslation_Cluster_CreateFind(t *testing.T) {
|
|||
|
||||
// Check that re-invoking create returns the original translations.
|
||||
for i, n := range c.Nodes {
|
||||
i, api := i, n.API
|
||||
x, api := i, n.API
|
||||
g.Go(func() (err error) {
|
||||
defer func() { err = errors.Wrapf(err, "translating on node %d", i) }()
|
||||
defer func() { err = errors.Wrapf(err, "translating on node %d", x) }()
|
||||
localTranslations, err := api.CreateIndexKeys(ctx, "i", keyList...)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "finding translations")
|
||||
|
|
@ -636,9 +636,9 @@ func TestTranslation_Cluster_CreateFind(t *testing.T) {
|
|||
var g errgroup.Group
|
||||
defer g.Wait() //nolint:errcheck
|
||||
for i, n := range c.Nodes {
|
||||
i, api := i, n.API
|
||||
x, api := i, n.API
|
||||
g.Go(func() (err error) {
|
||||
defer func() { err = errors.Wrapf(err, "translating on node %d", i) }()
|
||||
defer func() { err = errors.Wrapf(err, "translating on node %d", x) }()
|
||||
localTranslations, err := api.FindFieldKeys(ctx, "i", "f", keyList...)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "finding translations")
|
||||
|
|
@ -653,9 +653,9 @@ func TestTranslation_Cluster_CreateFind(t *testing.T) {
|
|||
|
||||
// Check that re-invoking create returns the original translations.
|
||||
for i, n := range c.Nodes {
|
||||
i, api := i, n.API
|
||||
x, api := i, n.API
|
||||
g.Go(func() (err error) {
|
||||
defer func() { err = errors.Wrapf(err, "translating on node %d", i) }()
|
||||
defer func() { err = errors.Wrapf(err, "translating on node %d", x) }()
|
||||
localTranslations, err := api.CreateFieldKeys(ctx, "i", "f", keyList...)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "finding translations")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue