Make sure the parameters for histogram query are valid. aggregation function: only NONE and SUM supported aggregation function in downsampling: only SUM supported percentile: only in rage (0,100)
()
| 252 | * </ul> |
| 253 | */ |
| 254 | private void checkHistogramQuery() { |
| 255 | if (!isHistogramQuery()) { |
| 256 | return; |
| 257 | } |
| 258 | |
| 259 | // only support NONE and SUM |
| 260 | if (agg != null && agg != Aggregators.NONE && agg != Aggregators.SUM) { |
| 261 | throw new IllegalArgumentException("Only NONE or SUM aggregation function supported for histogram query"); |
| 262 | } |
| 263 | |
| 264 | // only support SUM in downsampling |
| 265 | if (DownsamplingSpecification.NO_DOWNSAMPLER != downsample_specifier && |
| 266 | downsample_specifier.getHistogramAggregation() != HistogramAggregation.SUM) { |
| 267 | throw new IllegalArgumentException("Only SUM downsampling aggregation supported for histogram query"); |
| 268 | } |
| 269 | |
| 270 | |
| 271 | if (null != percentiles && percentiles.size() > 0) { |
| 272 | for (Float parameter : percentiles) { |
| 273 | if (parameter < 0 || parameter > 100) { |
| 274 | throw new IllegalArgumentException("Invalid percentile parameters: " + parameter); |
| 275 | } |
| 276 | } |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | /** @return the parsed aggregation function */ |
| 281 | public Aggregator aggregator() { |
no test coverage detected