Filters
Introduction to filters
A filter is a type of calculation that can be used as part of filtering expression.
Filters are pushed down automatically by the engine.
Using Filters
Any boolean attribute or calculated attribute can be used as a filter. In addition, filters can be written as ad-hoc sql expressions. Filters SQL expressions may combine entities of same granularity or lower - see combining entities in calculated attributes.
Filter Dynamic Datasets
Dynamic Datasets can include filters as part of their components.
Every filter in a dynamic dataset is applied (AND
).
Filtering is pushed down - every filter is pushed down to apply as early as possible, resulting in higher performance.
The engine pushes down the filter to the entity where it can be fully computed.
This has performance implications - for example, a filter like
will be executed on orders
after joining customers
.
In some cases, it is better to separate filters by entity and combine them only in a dynamic dataset or a SQL query. If using two attributes as:
And separately
The latter filter will be pushed down to customers
before joining it to orders
, resulting in a better performance.
Filtering Joins
Data can be filtered as a result of joins when applying filters.
For example, if looking for all customers customers.custkey
and apply this filter of shipped orders:
Then we will only get customers which have a shipped order, because orders
filters customers
after the JOIN between them.
Whether a filter on an entity applies to a different entity depends on the relationship. See cross filtering for more details.
Order of Computation
Multiple filters may execute in different order. See filtering order for more details.