Runs through query parameters to make sure it's a valid request. This includes parsing the aggregator, downsampling info, metrics, tags or timeseries and setting the local parsed fields needed by the TSD for proper execution. If no exceptions are thrown, the query is considered valid. Note: Y
()
| 210 | * @throws IllegalArgumentException if something is wrong with the query |
| 211 | */ |
| 212 | public void validateAndSetQuery() { |
| 213 | if (aggregator == null || aggregator.isEmpty()) { |
| 214 | throw new IllegalArgumentException("Missing the aggregation function"); |
| 215 | } |
| 216 | try { |
| 217 | agg = Aggregators.get(aggregator); |
| 218 | } catch (NoSuchElementException nse) { |
| 219 | throw new IllegalArgumentException( |
| 220 | "No such aggregation function: " + aggregator); |
| 221 | } |
| 222 | |
| 223 | // we must have at least one TSUID OR a metric |
| 224 | if ((tsuids == null || tsuids.isEmpty()) && |
| 225 | (metric == null || metric.isEmpty())) { |
| 226 | throw new IllegalArgumentException( |
| 227 | "Missing the metric or tsuids, provide at least one"); |
| 228 | } |
| 229 | |
| 230 | // Make sure we have a filter list |
| 231 | if (filters == null) { |
| 232 | filters = new ArrayList<TagVFilter>(); |
| 233 | } |
| 234 | |
| 235 | // parse the downsampler if we have one |
| 236 | if (downsample != null && !downsample.isEmpty()) { |
| 237 | // downsampler given, so parse it |
| 238 | downsample_specifier = new DownsamplingSpecification(downsample); |
| 239 | } else { |
| 240 | // no downsampler |
| 241 | downsample_specifier = DownsamplingSpecification.NO_DOWNSAMPLER; |
| 242 | } |
| 243 | checkHistogramQuery(); |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * Make sure the parameters for histogram query are valid. |