docs: public static TSQuery parseQuery(final TSDB tsdb, final HttpQuery query,
        final List<ExpressionTree> expressions) {
      final TSQuery data_query = new TSQuery();
      
      data_query.setStart(query.getRequiredQueryStringParam("start"));
      data_query.setEnd(query.getQueryStringParam("end"));
      
      if (query.hasQueryStringParam("padding")) {
        data_query.setPadding(true);
      }
      
      if (query.hasQueryStringParam("no_annotations")) {
        data_query.setNoAnnotations(true);
      }
      
      if (query.hasQueryStringParam("global_annotations")) {
        data_query.setGlobalAnnotations(true);
      }
      
      if (query.hasQueryStringParam("show_tsuids")) {
        data_query.setShowTSUIDs(true);
      }
      
      if (query.hasQueryStringParam("ms")) {
        data_query.setMsResolution(true);
      }
      
      if (query.hasQueryStringParam("show_query")) {
        data_query.setShowQuery(true);
      }  
      
      if (query.hasQueryStringParam("show_stats")) {
        data_query.setShowStats(true);
      }    
      
      if (query.hasQueryStringParam("show_summary")) {
          data_query.setShowSummary(true);
      }
      
      // handle tsuid queries first
      if (query.hasQueryStringParam("tsuid")) {
        final List<String> tsuids = query.getQueryStringParams("tsuid");     
        for (String q : tsuids) {
          parseTsuidTypeSubQuery(q, data_query);
        }
      }
      
      if (query.hasQueryStringParam("m")) {
        final List<String> legacy_queries = query.getQueryStringParams("m");      
        for (String q : legacy_queries) {
          parseMTypeSubQuery(q, data_query);
        }
      }
      
      // TODO - testing out the graphite style expressions here with the "exp" 
      // param that could stand for experimental or expression ;)
      if (expressions != null) {
        if (query.hasQueryStringParam("exp")) {
          final List<String> uri_expressions = query.getQueryStringParams("exp");
          final List<String> metric_queries = new ArrayList<String>(
              uri_expressions.size());
          // parse the expressions into their trees. If one or more expressions 
          // are improper then it will toss an exception up
          expressions.addAll(Expressions.parseExpressions(
              uri_expressions, data_query, metric_queries));
          // iterate over each of the parsed metric queries and store it in the
          // TSQuery list so that we fetch the data for them.
          for (final String mq: metric_queries) {
            parseMTypeSubQuery(mq, data_query);
          }
        }
      } else {
        if (LOG.isDebugEnabled()) {
          LOG.debug("Received a request with an expression but at the "
              + "wrong endpoint: " + query);
        }
      }
      
      if (data_query.getQueries() == null || data_query.getQueries().size() < 1) {
        throw new BadRequestException("Missing sub queries");
      }
  
      // Filter out duplicate queries
      Set<TSSubQuery> query_set = new LinkedHashSet<TSSubQuery>(data_query.getQueries());
      data_query.getQueries().clear();
      data_query.getQueries().addAll(query_set);
  
      return data_query;
    }