mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 02:44:59 +00:00
ensure ClearRow() arguments get translated
This commit is contained in:
parent
988d5a6156
commit
30711664e8
2 changed files with 17 additions and 1 deletions
|
|
@ -1693,6 +1693,9 @@ func (e *executor) executeClearRow(ctx context.Context, index string, c *pql.Cal
|
|||
}
|
||||
|
||||
result, err := e.mapReduce(ctx, index, shards, c, opt, mapFn, reduceFn)
|
||||
if err != nil {
|
||||
return false, errors.Wrap(err, "mapreducing clearrow")
|
||||
}
|
||||
return result.(bool), err
|
||||
}
|
||||
|
||||
|
|
@ -2368,7 +2371,7 @@ func (e *executor) translateCalls(ctx context.Context, index string, idx *Index,
|
|||
func (e *executor) translateCall(index string, idx *Index, c *pql.Call) error {
|
||||
var colKey, rowKey, fieldName string
|
||||
switch c.Name {
|
||||
case "Set", "Clear", "Row", "Range", "SetColumnAttrs":
|
||||
case "Set", "Clear", "Row", "Range", "SetColumnAttrs", "ClearRow":
|
||||
// Positional args in new PQL syntax require special handling here.
|
||||
colKey = "_" + columnLabel
|
||||
fieldName, _ = c.FieldArg()
|
||||
|
|
|
|||
|
|
@ -2887,6 +2887,19 @@ func TestExecutor_Execute_ClearRow(t *testing.T) {
|
|||
t.Fatalf("topn wrong results: %v", res.Results)
|
||||
}
|
||||
})
|
||||
|
||||
// Ensure that ClearRow returns false when the row to clear needs translation.
|
||||
t.Run("WithKeys", func(t *testing.T) {
|
||||
wq := ""
|
||||
rq := []string{
|
||||
`ClearRow(f="bar")`,
|
||||
}
|
||||
|
||||
responses := runCallTest(t, wq, rq, &pilosa.IndexOptions{}, pilosa.OptFieldKeys())
|
||||
if res := responses[0].Results[0].(bool); res {
|
||||
t.Fatalf("unexpected result: %+v", res)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Ensure a row can be set.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue