kensho-technologies/graphql-compiler

Filters with multiple fields are handled incorrectly in cost estimation.

Closed this issue · 0 comments

A field can apply to multiple fields. For example, the name_or_alias field applies to both name, or alias, returning true if at least one of those fields has the desired value.

A unique index can also apply to multiple fields, but that means something else. It means that the pair of those two values are unique.

In filter_selectivity_utils.py, with _are_filters_uniquely_indexed, we check if an index applies to the fields of an equality filter, and if so, assume the filter will retain at most one vertex. However, it is possible that there's a unique index on (name, alias), and name_or_alias still find more than one match.