@Deprecated public class FilteredSketchMetricsHelper extends Object implements MetricsFilterSetBuilder
Constructor and Description |
---|
FilteredSketchMetricsHelper()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
Set<Dimension> |
gatherFilterDimensions(Filter filter)
Deprecated.
Helper method that calls gatherFilterDimensions(Filter filter, Set<Dimension> dimensions)
by passing in filter and an empty HashSet.
|
Set<Dimension> |
gatherFilterDimensions(Filter filter,
Set<Dimension> dimensions)
Deprecated.
Method to get dimensions from a Filter object.
|
String |
generateMetricName(String filterString)
Deprecated.
Method to prepare filter string.
|
Set<FilteredAggregation> |
getFilteredAggregation(com.fasterxml.jackson.databind.JsonNode filter,
Aggregation aggregation,
DimensionDictionary dimensionDictionary,
LogicalTable table,
DataApiRequest apiRequest)
Deprecated.
For a given aggregator, this method applies the filter and returns a set of filtered aggregations.
|
LogicalMetric |
getFilteredLogicalMetric(LogicalMetric logicalMetric,
com.fasterxml.jackson.databind.JsonNode metricFilterObject,
DimensionDictionary dimensionDictionary,
LogicalTable table,
DataApiRequest apiRequest)
Deprecated.
Provides filter wrapped logical metric for the given logical metric.
|
PostAggregation |
replacePostAggregation(SketchSetOperationPostAggFunction func,
PostAggregation postAggregation,
Map<String,List<FilteredAggregation>> filteredAggDictionary)
Deprecated.
A method to replace postAggs with new postAggs that access the intersection or union of filteredAggregators.
|
PostAggregation |
replacePostAggWithPostAggFromMap(PostAggregation postAggregation,
Map<String,Aggregation> oldNameToNewAggregationMapping)
Deprecated.
Takes a post aggregation and updates its FieldAccessor if its fieldName is present in the map changed.
|
Collection<PostAggregation> |
updateNestedQueryPostAggs(Collection<PostAggregation> nestedQueryPostAggs,
Map<String,String> oldFieldNameToNewFieldNameMap,
String filterSuffix)
Deprecated.
Update the nested query post agg names if they are not of the type CONSTANT.
|
TemplateDruidQuery |
updateOuterQuery(TemplateDruidQuery outerQuery,
Map<String,String> oldFieldNameToNewFieldNameMap)
Deprecated.
A method to update outer query aggregations & postAggregations.
|
Set<Aggregation> |
updateQueryAggs(Set<Aggregation> outerAggregations,
Map<String,String> oldFieldNameToNewFieldNameMap,
Map<String,Aggregation> oldNameToNewAggregationMapping)
Deprecated.
Update the outer query aggs if their respective inner post agg names are updated.
|
TemplateDruidQuery |
updateTemplateDruidQuery(TemplateDruidQuery query,
com.fasterxml.jackson.databind.JsonNode metricFilterObject,
DimensionDictionary dimensionDictionary,
LogicalTable table,
DataApiRequest apiRequest)
Deprecated.
Method to update a given query by changing aggregators to filteredAggregators and updating postAggs to reference
the filteredAggregators.
|
void |
validateDuplicateMetrics(com.fasterxml.jackson.databind.node.ArrayNode metricsJsonArray)
Deprecated.
This method checks if the metric query contains duplicate metrics and throws a BadApiRequestException in case
it does find duplicate metrics.
|
public void validateDuplicateMetrics(com.fasterxml.jackson.databind.node.ArrayNode metricsJsonArray)
MetricsFilterSetBuilder
validateDuplicateMetrics
in interface MetricsFilterSetBuilder
metricsJsonArray
- A JSONArray containing JSONObjects with name and filter. For Example :
[{"filter":{"AND":{"dim2|id-in":["abc","xyz"],"dim3|id-in":["mobile","tablet"]}},"name":"metric1"},
{"filter":{},"name":"metric2"}]
public LogicalMetric getFilteredLogicalMetric(LogicalMetric logicalMetric, com.fasterxml.jackson.databind.JsonNode metricFilterObject, DimensionDictionary dimensionDictionary, LogicalTable table, DataApiRequest apiRequest) throws DimensionRowNotFoundException
MetricsFilterSetBuilder
getFilteredLogicalMetric
in interface MetricsFilterSetBuilder
logicalMetric
- The LogicalMetric that needs to be transformed into a filtered Logical MetricmetricFilterObject
- A JSON object containing the filter for a given metric. For example:
{"AND":{"dim2|id-in":["abc","xyz"],"dim3|id-in":["mobile","tablet"]}},"name":"metric"
dimensionDictionary
- Dimension dictionary to look the dimension up intable
- The logical table for the data requestapiRequest
- The data api request that will be used to generate the filtersDimensionRowNotFoundException
- if the dimension mentioned in the
metric filter is not foundpublic TemplateDruidQuery updateOuterQuery(TemplateDruidQuery outerQuery, Map<String,String> oldFieldNameToNewFieldNameMap)
updateOuterQuery
in interface MetricsFilterSetBuilder
outerQuery
- Outer query of a Logical MetricoldFieldNameToNewFieldNameMap
- Map which contains mapping old name --> new name of the post
aggs from the nested query. Eg: foo --> foo-dim1334dim2445public Set<Aggregation> updateQueryAggs(Set<Aggregation> outerAggregations, Map<String,String> oldFieldNameToNewFieldNameMap, Map<String,Aggregation> oldNameToNewAggregationMapping)
updateQueryAggs
in interface MetricsFilterSetBuilder
outerAggregations
- Outer query aggregationsoldFieldNameToNewFieldNameMap
- Map which contains mapping old name --> new name of the
post aggs from the nested query. Eg: foo --> foo-dim1334dim2445oldNameToNewAggregationMapping
- Empty Map to keep old name as key and new aggregation as valuepublic Collection<PostAggregation> updateNestedQueryPostAggs(Collection<PostAggregation> nestedQueryPostAggs, Map<String,String> oldFieldNameToNewFieldNameMap, String filterSuffix)
updateNestedQueryPostAggs
in interface MetricsFilterSetBuilder
nestedQueryPostAggs
- A set of all the nested query post aggregationsoldFieldNameToNewFieldNameMap
- Empty Map to store the mapping old name --> new name
of the post aggs. Eg: foo --> foo-dim1334dim2445filterSuffix
- Suffix which is appended to the postAgg name to generate new postAgg namepublic TemplateDruidQuery updateTemplateDruidQuery(TemplateDruidQuery query, com.fasterxml.jackson.databind.JsonNode metricFilterObject, DimensionDictionary dimensionDictionary, LogicalTable table, DataApiRequest apiRequest) throws DimensionRowNotFoundException
MetricsFilterSetBuilder
updateTemplateDruidQuery
in interface MetricsFilterSetBuilder
query
- Template druid query of a given Logical Metric. Can also be the nested query but can only contain
Sketch aggregations.metricFilterObject
- Metric filter associated with the metricdimensionDictionary
- Dimension dictionary to look the dimension up intable
- The logical table for the data requestapiRequest
- The data api request that will be used to generate the filtersDimensionRowNotFoundException
- if the dimension row in the metric
filter is not found.public PostAggregation replacePostAggregation(SketchSetOperationPostAggFunction func, PostAggregation postAggregation, Map<String,List<FilteredAggregation>> filteredAggDictionary)
MetricsFilterSetBuilder
replacePostAggregation
in interface MetricsFilterSetBuilder
func
- Sketch operation function Ex: INTERSECT, UNIONpostAggregation
- Post aggregation which needs to be replacedfilteredAggDictionary
- Dictionary which holds aggregator name as key and list of FilteredAggregation as
valuepublic PostAggregation replacePostAggWithPostAggFromMap(PostAggregation postAggregation, Map<String,Aggregation> oldNameToNewAggregationMapping)
MetricsFilterSetBuilder
replacePostAggWithPostAggFromMap
in interface MetricsFilterSetBuilder
postAggregation
- Outer query post aggregation that needs to be updatedoldNameToNewAggregationMapping
- Map with old aggname as key and new aggregation as valuepublic Set<FilteredAggregation> getFilteredAggregation(com.fasterxml.jackson.databind.JsonNode filter, Aggregation aggregation, DimensionDictionary dimensionDictionary, LogicalTable table, DataApiRequest apiRequest) throws DimensionRowNotFoundException
MetricsFilterSetBuilder
getFilteredAggregation
in interface MetricsFilterSetBuilder
filter
- Filter to be used in generating FilteredAggregationaggregation
- Aggregation that needs to be wrapped with Filter in order to generate the
FilteredAggregationdimensionDictionary
- Dimension dictionary to look the dimension up intable
- The logical table for the data requestapiRequest
- The data api request that will be used to generate the filtersDimensionRowNotFoundException
- if the dimension row in the metric
filter is not found.public String generateMetricName(String filterString)
MetricsFilterSetBuilder
generateMetricName
in interface MetricsFilterSetBuilder
filterString
- Single dimension filter stringpublic Set<Dimension> gatherFilterDimensions(Filter filter)
gatherFilterDimensions
in interface MetricsFilterSetBuilder
filter
- Filter object whose dimensions are to be collectedpublic Set<Dimension> gatherFilterDimensions(Filter filter, Set<Dimension> dimensions)
MetricsFilterSetBuilder
gatherFilterDimensions
in interface MetricsFilterSetBuilder
filter
- filter whose dimensions need to be collecteddimensions
- Set of dimensions belonging to a filter. Empty when the method is first called.Copyright © 2016–2018 Yahoo! Inc.. All rights reserved.