Filter: finalize dynamic queries using upstream pipelets' query trees