*/
public static Iter applyPostprecessingOptions(Iter i, Map<String,Object> options) {
if (options == null) return i;
int offset = 0;
int limit = Integer.MAX_VALUE;
ScriptFunction mapFn = (ScriptFunction) options.get("map");
ScriptFunction filterFn = (ScriptFunction) options.get("filter");
i = new OptionsIter(i, offset, limit, mapFn, filterFn);
ScriptFunction reduceFn = (ScriptFunction) options.get("reduce");
if (reduceFn != null) {
Object result = reduceIter(i, reduceFn);
i = new LiteralIter(new Object[]{result});
}
return i;