Merge pull request #1955 from molecula/fb1225

[FB-1225] don't look up a field by name to find out its name
This commit is contained in:
seebs 2022-03-01 12:43:21 -06:00 • committed by GitHub
commit 789fef7a8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -1007,6 +1007,10 @@ func TestQuerySQLWithError(t *testing.T) {
sql: "select _id, age, field_not_found from grouper",
err: pilosa.ErrFieldNotFound,
},
{
sql: "select age, color, count(*) from grouper group by field_not_found, age, color",
err: pilosa.ErrFieldNotFound,
},
}
for i, test := range tests {

View file

@ -598,8 +598,7 @@ func (h handlerSelectGroupBy) Apply(stmt *sqlparser.Select, qm QueryMask, indexF
rowsQueries := []string{}
for _, fieldName := range groupByFieldNames {
field := index.Field(fieldName)
rowsQueries = append(rowsQueries, Rows(field.Name()))
rowsQueries = append(rowsQueries, Rows(fieldName))
}
var wherePQL string