Recently I started to move some java code to aerospike. I began to review the query-with-filters sample.
stmt.setFilters(Filter.equal("username", Value.get("Mary"))); resultSet = client.queryAggregate(null, stmt, "profile", "check_password" , Value.get("ghjks"));
I assume that the client code filter (username) executed before the UDF filter (password).
In my code I got a similar part. Filters needed are:
Sequence: FIlter1 -> Filter2 -> ResultSet
Filter1: ValueA == “” (many records in relation to the whole set) Filter2: ValueB Between 0 AND 10 (only a small part of the Filter1 result would NOT match)
What would be the best method of chaining such filters? Should the client (Filter.range/equal) or the UDF filter do the largest reduction of the result set (Filter1)? What sequence would offer the best performance?
Or is it possible to apply all filters in UDF without a client filter in the queryAggregate call similar to following code?
return stream : filter(filter_1) : filter(filter_2) : map(map_record)
Thanks in advance!