raise an error on Rows() query against a time field with noStandardView:true

This commit is contained in:
Travis Turner 2019-01-14 16:14:27 -06:00
parent 897221a24e
commit 44f53a5f1d
No known key found for this signature in database
GPG key ID: 5734CE1B30B355DF
2 changed files with 19 additions and 0 deletions

View file

@ -1138,6 +1138,14 @@ func (e *executor) executeRowsShard(_ context.Context, index string, c *pql.Call
if f == nil {
return nil, ErrFieldNotFound
}
// Rows query does not currently support a `time` field that has
// `noStandardView: true`.
// TODO https://github.com/pilosa/pilosa/issues/1783
if f.Type() == FieldTypeTime && f.options.NoStandardView {
return nil, errors.New("Rows() query on time field with no standard view is not supported")
}
frag := e.Holder.fragment(index, fieldName, viewStandard, shard)
if frag == nil {
return make(RowIDs, 0), nil

View file

@ -3059,6 +3059,17 @@ func TestExecutor_Execute_Rows(t *testing.T) {
}
}
func TestExecutor_Execute_RowsTime(t *testing.T) {
c := test.MustRunCluster(t, 1)
defer c.Close()
c.CreateField(t, "i", pilosa.IndexOptions{}, "t", pilosa.OptFieldTypeTime(pilosa.TimeQuantum("YMD"), true))
exp := "executing: Rows() query on time field with no standard view is not supported"
if _, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Rows(field=t)`}); err == nil || err.Error() != exp {
t.Fatalf("expected error: %s", exp)
}
}
func TestExecutor_Execute_Query_Error(t *testing.T) {
c := test.MustRunCluster(t, 1)
defer c.Close()