code: public void validateAndSetQuery() {
      if (start == null || start.isEmpty()) {
        throw new IllegalArgumentException("Missing start time");
      }
      start_time = DateTime.parseDateTimeString(start, timezone);
      
      if (end != null && !end.isEmpty()) {
        end_time = DateTime.parseDateTimeString(end, timezone);
      } else {
        end_time = System.currentTimeMillis();
      }
      if (end_time <= start_time) {
        throw new IllegalArgumentException(
            "End time [" + end_time + "] must be greater than the start time ["
            + start_time +"]");
      }
      
      if (queries == null || queries.isEmpty()) {
        throw new IllegalArgumentException("Missing queries");
      }
      
      // validate queries
      int i = 0;
      for (TSSubQuery sub : queries) {
        sub.validateAndSetQuery();
        final DownsamplingSpecification ds = sub.downsamplingSpecification();
        if (ds != null && timezone != null && !timezone.isEmpty() && 
            ds != DownsamplingSpecification.NO_DOWNSAMPLER) {
          final TimeZone tz = DateTime.timezones.get(timezone);
          if (tz == null) {
            throw new IllegalArgumentException(
                "The timezone specification could not be found");
          }
          ds.setTimezone(tz);
        }
        if (ds != null && use_calendar && 
            ds != DownsamplingSpecification.NO_DOWNSAMPLER) {
          ds.setUseCalendar(true);
        }
        
        sub.setIndex(i++);
      }
    }
docs: Runs through query parameters to make sure it's a valid request.
  This includes parsing relative timestamps, verifying that the end time is
  later than the start time (or isn't set), that one or more metrics or
  TSUIDs are present, etc. If no exceptions are thrown, the query is
  considered valid.
  <b>Warning:</b> You must call this before passing it on for processing as
  it sets the {@code start_time} and {@code end_time} fields as well as
  sets the {@link TSSubQuery} fields necessary for execution.
  @throws IllegalArgumentException if something is wrong with the query