mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 02:44:59 +00:00
fix test that differed based on map key order
This commit is contained in:
parent
2562292074
commit
4f86b2be83
2 changed files with 16 additions and 10 deletions
24
executor.go
24
executor.go
|
|
@ -1059,6 +1059,16 @@ func (e *executor) executeClearBitField(ctx context.Context, index string, c *pq
|
|||
|
||||
// executeSet executes a Set() call.
|
||||
func (e *executor) executeSet(ctx context.Context, index string, c *pql.Call, opt *execOptions) (bool, error) {
|
||||
|
||||
// Read colID.
|
||||
colID, ok, err := c.UintArg("_" + columnLabel)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("reading Set() column: %v", err)
|
||||
} else if !ok {
|
||||
return false, fmt.Errorf("Set() column argument '%v' required", columnLabel)
|
||||
}
|
||||
|
||||
// Read field name.
|
||||
fieldName, err := c.FieldArg()
|
||||
if err != nil {
|
||||
return false, errors.New("Set() argument required: field")
|
||||
|
|
@ -1074,14 +1084,6 @@ func (e *executor) executeSet(ctx context.Context, index string, c *pql.Call, op
|
|||
return false, ErrFieldNotFound
|
||||
}
|
||||
|
||||
// Read colID using labels.
|
||||
colID, ok, err := c.UintArg("_" + columnLabel)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("reading Set() column: %v", err)
|
||||
} else if !ok {
|
||||
return false, fmt.Errorf("Set() column argument '%v' required", columnLabel)
|
||||
}
|
||||
|
||||
if f.Type() == FieldTypeInt {
|
||||
// Read remaining fields using labels.
|
||||
rowVal, ok, err := c.IntArg(fieldName)
|
||||
|
|
@ -1575,7 +1577,11 @@ func (e *executor) translateCall(index string, idx *Index, c *pql.Call) error {
|
|||
if fieldName != "" {
|
||||
field := idx.Field(fieldName)
|
||||
if field == nil {
|
||||
return ErrFieldNotFound
|
||||
// Instead of returning ErrFieldNotFound here,
|
||||
// we just return, and don't attempt the translation.
|
||||
// The assumption is that the non-existant field
|
||||
// will raise an error downstream when it's used.
|
||||
return nil
|
||||
}
|
||||
if field.keys() {
|
||||
if c.Args[rowKey] != nil && !isString(c.Args[rowKey]) {
|
||||
|
|
|
|||
|
|
@ -440,7 +440,7 @@ func TestExecutor_Execute_SetValue(t *testing.T) {
|
|||
}
|
||||
|
||||
t.Run("ErrColumnBSIGroupRequired", func(t *testing.T) {
|
||||
if _, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Set(invalid_column_name=10, f=100)`}); err == nil || errors.Cause(err).Error() != `field not found` {
|
||||
if _, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Set(invalid_column_name=10, f=100)`}); err == nil || errors.Cause(err).Error() != `Set() column argument 'col' required` {
|
||||
t.Fatalf("unexpected error: %s", err)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue