Queries: Restore old prepareAggregations method. (#4432)

For backwards compatibility, post-#4394.
This commit is contained in:
Gian Merlino 2017-06-21 05:36:32 -07:00 committed by Slim
parent 679cf277c0
commit 34d2f9ebfe
1 changed files with 24 additions and 2 deletions

View File

@ -25,6 +25,7 @@ import com.google.common.collect.Sets;
import io.druid.query.aggregation.AggregatorFactory; import io.druid.query.aggregation.AggregatorFactory;
import io.druid.query.aggregation.PostAggregator; import io.druid.query.aggregation.PostAggregator;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@ -47,14 +48,35 @@ public class Queries
return decorated; return decorated;
} }
/**
* Like {@link #prepareAggregations(List, List, List)} but with otherOutputNames as an empty list. Deprecated
* because it makes it easy to forget to include dimensions, etc. in "otherOutputNames".
*
* @param aggFactories aggregator factories for this query
* @param postAggs post-aggregators for this query
*
* @return decorated post-aggregators
*
* @throws NullPointerException if aggFactories is null
* @throws IllegalArgumentException if there are any output name collisions or missing post-aggregator inputs
*/
@Deprecated
public static List<PostAggregator> prepareAggregations(
List<AggregatorFactory> aggFactories,
List<PostAggregator> postAggs
)
{
return prepareAggregations(Collections.emptyList(), aggFactories, postAggs);
}
/** /**
* Returns decorated post-aggregators, based on original un-decorated post-aggregators. In addition, this method * Returns decorated post-aggregators, based on original un-decorated post-aggregators. In addition, this method
* also verifies that there are no output name collisions, and that all of the post-aggregators' required input * also verifies that there are no output name collisions, and that all of the post-aggregators' required input
* fields are present. * fields are present.
* *
* @param otherOutputNames names of fields that will appear in the same output namespace as aggregators and * @param otherOutputNames names of fields that will appear in the same output namespace as aggregators and
* post-aggregators. For most built-in query types, this is either empty, or the list of * post-aggregators, and are also assumed to be valid inputs to post-aggregators. For most
* dimension output names. * built-in query types, this is either empty, or the list of dimension output names.
* @param aggFactories aggregator factories for this query * @param aggFactories aggregator factories for this query
* @param postAggs post-aggregators for this query * @param postAggs post-aggregators for this query
* *