Skip to content

Commit

Permalink
Whitespace and deprecation tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-mclawhorn committed Jan 3, 2017
1 parent c889d7c commit 8e2f1de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ protected static PostAggregation getNumericField(MetricField field) {
*
* @deprecated use the static version {@link #getSketchField(MetricField)} by preference
*/
@Deprecated
protected PostAggregation getSketchField(String fieldName) {
// Get the field
return getSketchField(metrics.get(fieldName).getMetricField());
Expand Down Expand Up @@ -277,10 +278,6 @@ protected static PostAggregation getSketchField(MetricField field) {
return ((ThetaSketchEstimatePostAggregation) field).getField();
}

if (field instanceof ThetaSketchEstimatePostAggregation) {
return ((ThetaSketchEstimatePostAggregation) field).getField();
}

// Check for sketches, since we require them after this point
if (!field.isSketch()) {
String message = String.format("Field must be a sketch: %s but is: %s", field.getName(), field);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import com.yahoo.bard.webservice.druid.util.ThetaSketchFieldConverter

import spock.lang.Specification
import spock.lang.Unroll

/**
* Tests the code implemented by MetricMaker, using a stub for code that is meant to be implemented by the children.
* Primarily tests the sad paths. The specifications of the children of MetricMaker test the various happy paths.
Expand Down Expand Up @@ -107,9 +108,6 @@ class MetricMakerSpec extends Specification {
FieldConverterSupplier.sketchConverter = originalConverter
}

def setup(){
}

private static final LogicalMetric DEFAULT_METRIC = new LogicalMetric(
new TemplateDruidQuery([] as Set, [] as Set),
new NoOpResultSetMapper(),
Expand Down Expand Up @@ -162,7 +160,7 @@ class MetricMakerSpec extends Specification {

def "When a metric has too few dependent metrics, an exception is thrown."(){
given: "One fewer dependent metrics than this metric depends on"
List<String> dependentMetricNames = buildDependentMetricNames(DEPENDENT_METRICS-1)
List<String> dependentMetricNames = buildDependentMetricNames(DEPENDENT_METRICS - 1)
dictionary.putAll(makeEmptyMetrics(dependentMetricNames))

when:
Expand All @@ -174,7 +172,7 @@ class MetricMakerSpec extends Specification {

def "When a claimed dependent metric does not exist in the maker's dictionary, an exception is thrown"(){
given: "A list of dependent metrics, one of which doesn't exist"
List<String> dependentMetricNames = buildDependentMetricNames(DEPENDENT_METRICS-1)
List<String> dependentMetricNames = buildDependentMetricNames(DEPENDENT_METRICS - 1)
dictionary.putAll(makeEmptyMetrics(dependentMetricNames))
dependentMetricNames.add("I don't exist!")

Expand All @@ -186,7 +184,7 @@ class MetricMakerSpec extends Specification {
}
def "When a metric has too many dependent metrics, an exception is thrown"(){
given: "One more than the number of dependent metrics this maker depends on."
List<String> dependentMetricNames = buildDependentMetricNames(maker.getDependentMetricsRequired()+1)
List<String> dependentMetricNames = buildDependentMetricNames(maker.getDependentMetricsRequired() + 1)
maker.metrics.putAll(makeEmptyMetrics(dependentMetricNames))

when:
Expand All @@ -198,7 +196,6 @@ class MetricMakerSpec extends Specification {

@Unroll
def "getNumericField returns a numeric metric #expected.type for metric named: #fromMetric.name "() {
setup:
expect:
MetricMaker.getNumericField(fromMetric.metricField) == expected

Expand All @@ -215,7 +212,6 @@ class MetricMakerSpec extends Specification {

@Unroll
def "getSketchField returns a sketch aggregation of type #expected.type for metric named: #fromMetric.name "() {
setup:
expect:
MetricMaker.getSketchField(fromMetric.metricField) == expected

Expand All @@ -229,7 +225,6 @@ class MetricMakerSpec extends Specification {

@Unroll
def "getSketchField throws error when given a non sketch based field #fromMetric.name "() {
setup:
when:
MetricMaker.getSketchField(fromMetric.metricField)

Expand Down

0 comments on commit 8e2f1de

Please sign in to comment.