mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 00:55:55 +00:00
don't try to translate keys on unkeyed indexes
this causes a few things to error earlier than they otherwise would have, hence the changed tests.
This commit is contained in:
parent
063a3b96e3
commit
a48bf28be2
2 changed files with 6 additions and 2 deletions
|
|
@ -2918,6 +2918,10 @@ func (c *cluster) createIndexKeys(ctx context.Context, indexName string, keys ..
|
|||
return nil, ErrIndexNotFound
|
||||
}
|
||||
|
||||
if !idx.keys {
|
||||
return nil, errors.Errorf("can't create index keys on unkeyed index %s", indexName)
|
||||
}
|
||||
|
||||
// Split keys by partition.
|
||||
keysByPartition := make(map[int][]string, c.partitionN)
|
||||
for _, key := range keys {
|
||||
|
|
|
|||
|
|
@ -575,7 +575,7 @@ func TestExecutor_Execute_Set(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("ErrInvalidColValueType", func(t *testing.T) {
|
||||
if _, err := cmd.API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Set("foo", f=1)`}); err == nil || !hasCause(err, pilosa.ErrTranslatingKeyNotFound) || !strings.Contains(err.Error(), "unkeyed index") {
|
||||
if _, err := cmd.API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Set("foo", f=1)`}); err == nil || !strings.Contains(err.Error(), "unkeyed index") {
|
||||
t.Fatalf("The error is: '%v'", err)
|
||||
}
|
||||
})
|
||||
|
|
@ -977,7 +977,7 @@ func TestExecutor_Execute_SetValue(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("ColumnBSIGroupValue", func(t *testing.T) {
|
||||
if _, err := c.GetNode(0).API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Set("bad_column", f=100)`}); err == nil || !hasCause(err, pilosa.ErrTranslatingKeyNotFound) || !strings.Contains(err.Error(), "unkeyed index") {
|
||||
if _, err := c.GetNode(0).API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Set("bad_column", f=100)`}); err == nil || !strings.Contains(err.Error(), "unkeyed index") {
|
||||
t.Fatalf("unexpected error: %s", err)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue