class TupleToRange implements Function<Tuple2<String,IndexInfo>,Iterator<QueryPlan>> {

    public Iterator<QueryPlan> apply(Tuple2<String,IndexInfo> tuple) {
        String shard = tuple.first();
        IndexInfo indexInfo = tuple.second();
        
        JexlNode queryNode = currentScript;
        if (log.isTraceEnabled() && indexInfo.getNode() != null) {
            log.trace("Got it from tuple " + JexlStringBuildingVisitor.buildQuery(indexInfo.getNode()));
        }
        
        if (isDocumentRange(indexInfo)) {
            
            return createDocumentRanges(queryNode, shard, indexInfo, config.isTldQuery());
            
        } else if (isShardRange(shard)) {
            
            return createShardRange(queryNode, shard, indexInfo);
            
        } else {
            
            return createDayRange(queryNode, shard, indexInfo);
        }
    }

    public  TupleToRange(JexlNode currentNode, ShardQueryConfiguration config);

}