Query: Accumulated outputs can be folded (reduced) and returned as a map.

Filters can now accumulate values and return them at the end of
the query. Values are returned in a map, keyed by filter ID. If
the query is run with multiple threads, the computed metadata will
be folded together at the end so it looks like it was run single-
threaded. Outputs are returned as instances of the new class
Foldable, which means they could be further combined with other
results if running on a cluster.

Currently there is no way to specify the semantics of the output:
toString is the only uniformly-supported output interface of
Foldable.
Query: Added check for filter dimension definition.

Without this, confusing null exceptions were being thrown.