mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-09 12:27:52 +00:00
don't panic on nil field during inner join
when running a select statement with an inner join where the secondary field is non-existent, we get a panic. this commit fixes that. see [fb-766](https://molecula.atlassian.net/browse/FB-766) for more information.
This commit is contained in:
parent
630d510f85
commit
9e17579a76
2 changed files with 7 additions and 0 deletions
|
|
@ -1072,6 +1072,10 @@ func TestQuerySQLWithError(t *testing.T) {
|
|||
sql: "select age, color, count(*) from grouper group by field_not_found, age, color",
|
||||
err: pilosa.ErrFieldNotFound,
|
||||
},
|
||||
{
|
||||
sql: "select count(*) from grouper inner join joiner on grouper._id = joiner.field_not_found",
|
||||
err: pilosa.ErrFieldNotFound,
|
||||
},
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
|
|
|
|||
|
|
@ -772,6 +772,9 @@ func (h handlerSelectJoin) Apply(stmt *sqlparser.Select, qm QueryMask, indexFunc
|
|||
return nil, fmt.Errorf("nonexistent index %q", secondaryIndexName)
|
||||
}
|
||||
secondaryField := secondaryIndex.Field(secondary.column.name)
|
||||
if secondaryField == nil {
|
||||
return nil, errors.Wrap(pilosa.ErrFieldNotFound, fmt.Sprintf("non-existent field %s for index %s", secondary.column.name, secondaryIndexName))
|
||||
}
|
||||
|
||||
var wheres tableWheres
|
||||
if qm.HasWhere() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue