mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 09:05:55 +00:00
Merge pull request #921 from niaow/fix-rows-type-error
Generate errors for all unsupported types in Rows calls
This commit is contained in:
commit
84830d8361
2 changed files with 17 additions and 3 deletions
|
|
@ -2592,10 +2592,8 @@ func (e *executor) executeRowsShard(ctx context.Context, qcx *Qcx, index string,
|
|||
// in order to represent `Rows` for the field.
|
||||
var views = []string{viewStandard}
|
||||
|
||||
// Handle `int` and `time` fields.
|
||||
switch f.Type() {
|
||||
case FieldTypeInt:
|
||||
return nil, errors.New("int fields not supported by Rows() query")
|
||||
case FieldTypeSet, FieldTypeMutex:
|
||||
case FieldTypeTime:
|
||||
var err error
|
||||
|
||||
|
|
@ -2657,6 +2655,8 @@ func (e *executor) executeRowsShard(ctx context.Context, qcx *Qcx, index string,
|
|||
// Determine the views based on the specified time range.
|
||||
views = viewsByTimeRange(viewStandard, fromTime, toTime, q)
|
||||
}
|
||||
default:
|
||||
return nil, errors.Errorf("%s fields not supported by Rows() query", f.Type())
|
||||
}
|
||||
|
||||
start := uint64(0)
|
||||
|
|
|
|||
|
|
@ -4851,6 +4851,8 @@ func TestExecutor_Execute_Query_Error(t *testing.T) {
|
|||
defer c.Close()
|
||||
c.CreateField(t, "i", pilosa.IndexOptions{}, "general")
|
||||
c.CreateField(t, "i", pilosa.IndexOptions{}, "integer", pilosa.OptFieldTypeInt(-1000, 1000))
|
||||
c.CreateField(t, "i", pilosa.IndexOptions{}, "decimal", pilosa.OptFieldTypeDecimal(2))
|
||||
c.CreateField(t, "i", pilosa.IndexOptions{}, "bool", pilosa.OptFieldTypeBool())
|
||||
|
||||
tests := []struct {
|
||||
query string
|
||||
|
|
@ -4884,6 +4886,18 @@ func TestExecutor_Execute_Query_Error(t *testing.T) {
|
|||
query: "GroupBy(Rows(integer), prev=-1)",
|
||||
error: "unknown arg 'prev'",
|
||||
},
|
||||
{
|
||||
query: "Rows(integer)",
|
||||
error: "int fields not supported by Rows() query",
|
||||
},
|
||||
{
|
||||
query: "Rows(decimal)",
|
||||
error: "decimal fields not supported by Rows() query",
|
||||
},
|
||||
{
|
||||
query: "Rows(bool)",
|
||||
error: "bool fields not supported by Rows() query",
|
||||
},
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue