Inspection fixes (#4809)

This commit is contained in:
Roman Leventov 2017-09-15 19:48:29 -05:00 committed by Charles Allen
parent 0fe734805b
commit 3f92184dd8
14 changed files with 20 additions and 17 deletions

View File

@ -101,7 +101,7 @@ public class TimestampAggregationSelectTest
temporaryFolder temporaryFolder
); );
selector = new TestObjectColumnSelector(values); selector = new TestObjectColumnSelector<>(values);
selectorFactory = EasyMock.createMock(ColumnSelectorFactory.class); selectorFactory = EasyMock.createMock(ColumnSelectorFactory.class);
EasyMock.expect(selectorFactory.makeObjectColumnSelector("test")).andReturn(selector); EasyMock.expect(selectorFactory.makeObjectColumnSelector("test")).andReturn(selector);
EasyMock.replay(selectorFactory); EasyMock.replay(selectorFactory);
@ -144,7 +144,7 @@ public class TimestampAggregationSelectTest
" }\n" + " }\n" +
"]"; "]";
ZipFile zip = new ZipFile(new File(this.getClass().getClassLoader().getResource("druid.sample.tsv.zip").toURI())); ZipFile zip = new ZipFile(new File(this.getClass().getClassLoader().getResource("druid.sample.tsv.zip").toURI()));
Sequence seq = helper.createIndexAndRunQueryOnSegment( Sequence<?> seq = helper.createIndexAndRunQueryOnSegment(
zip.getInputStream(zip.getEntry("druid.sample.tsv")), zip.getInputStream(zip.getEntry("druid.sample.tsv")),
recordParser, recordParser,
aggregator, aggregator,

View File

@ -111,7 +111,7 @@ public class TimestampGroupByAggregationTest
temporaryFolder temporaryFolder
); );
selector = new TestObjectColumnSelector(values); selector = new TestObjectColumnSelector<>(values);
selectorFactory = EasyMock.createMock(ColumnSelectorFactory.class); selectorFactory = EasyMock.createMock(ColumnSelectorFactory.class);
EasyMock.expect(selectorFactory.makeObjectColumnSelector("test")).andReturn(selector); EasyMock.expect(selectorFactory.makeObjectColumnSelector("test")).andReturn(selector);
EasyMock.replay(selectorFactory); EasyMock.replay(selectorFactory);

View File

@ -123,7 +123,7 @@ public class TimestampMinMaxAggregatorTest
String json = "{\"type\":\"" + aggType + "\",\"name\":\"" + aggType + "\",\"fieldName\":\"test\"}"; String json = "{\"type\":\"" + aggType + "\",\"name\":\"" + aggType + "\",\"fieldName\":\"test\"}";
aggregatorFactory = mapper.readValue(json, aggClass); aggregatorFactory = mapper.readValue(json, aggClass);
selector = new TestObjectColumnSelector(values); selector = new TestObjectColumnSelector<>(values);
selectorFactory = EasyMock.createMock(ColumnSelectorFactory.class); selectorFactory = EasyMock.createMock(ColumnSelectorFactory.class);
EasyMock.expect(selectorFactory.makeObjectColumnSelector("test")).andReturn(selector); EasyMock.expect(selectorFactory.makeObjectColumnSelector("test")).andReturn(selector);
EasyMock.replay(selectorFactory); EasyMock.replay(selectorFactory);

View File

@ -66,7 +66,8 @@ public class VarianceAggregatorTest
{ {
selector = new TestFloatColumnSelector(values); selector = new TestFloatColumnSelector(values);
colSelectorFactory = EasyMock.createMock(ColumnSelectorFactory.class); colSelectorFactory = EasyMock.createMock(ColumnSelectorFactory.class);
EasyMock.expect(colSelectorFactory.makeObjectColumnSelector("nilly")).andReturn(new TestObjectColumnSelector(0.0f)); EasyMock.expect(colSelectorFactory.makeObjectColumnSelector("nilly"))
.andReturn(new TestObjectColumnSelector<>(new Object[] {0.0f}));
EasyMock.expect(colSelectorFactory.makeFloatColumnSelector("nilly")).andReturn(selector); EasyMock.expect(colSelectorFactory.makeFloatColumnSelector("nilly")).andReturn(selector);
EasyMock.replay(colSelectorFactory); EasyMock.replay(colSelectorFactory);
} }

View File

@ -223,7 +223,7 @@ public class ScanQuery extends BaseQuery<ScanResultValue>
* .build(); * .build();
* </code></pre> * </code></pre>
* *
* @see io.druid.query.scan.ScanQuery * @see ScanQuery
*/ */
public static class ScanQueryBuilder public static class ScanQueryBuilder
{ {

View File

@ -54,9 +54,9 @@ public class Capabilities
return this; return this;
} }
public io.druid.segment.Capabilities build() public Capabilities build()
{ {
return new io.druid.segment.Capabilities( return new Capabilities(
dimensionValuesSorted dimensionValuesSorted
); );
} }

View File

@ -240,7 +240,9 @@ public class JavaScriptAggregatorTest
@Test @Test
public void testAggregateStrings() public void testAggregateStrings()
{ {
final TestObjectColumnSelector ocs = new TestObjectColumnSelector("what", null, new String[]{"hey", "there"}); final TestObjectColumnSelector ocs = new TestObjectColumnSelector<>(
new Object[]{"what", null, new String[]{"hey", "there"}}
);
final JavaScriptAggregator agg = new JavaScriptAggregator( final JavaScriptAggregator agg = new JavaScriptAggregator(
Collections.<ObjectColumnSelector>singletonList(ocs), Collections.<ObjectColumnSelector>singletonList(ocs),
JavaScriptAggregatorFactory.compileScript( JavaScriptAggregatorFactory.compileScript(

View File

@ -23,13 +23,13 @@ import io.druid.segment.ObjectColumnSelector;
/** /**
*/ */
public class TestObjectColumnSelector implements ObjectColumnSelector public class TestObjectColumnSelector<T> implements ObjectColumnSelector
{ {
private final Object[] objects; private final Object[] objects;
private int index = 0; private int index = 0;
public TestObjectColumnSelector(Object... objects) public TestObjectColumnSelector(T[] objects)
{ {
this.objects = objects; this.objects = objects;
} }

View File

@ -60,7 +60,7 @@ public class DoubleFirstAggregationTest
combiningAggFactory = (DoubleFirstAggregatorFactory) doubleFirstAggFactory.getCombiningFactory(); combiningAggFactory = (DoubleFirstAggregatorFactory) doubleFirstAggFactory.getCombiningFactory();
timeSelector = new TestLongColumnSelector(times); timeSelector = new TestLongColumnSelector(times);
valueSelector = new TestDoubleColumnSelectorImpl(doubleValues); valueSelector = new TestDoubleColumnSelectorImpl(doubleValues);
objectSelector = new TestObjectColumnSelector(pairs); objectSelector = new TestObjectColumnSelector<>(pairs);
colSelectorFactory = EasyMock.createMock(ColumnSelectorFactory.class); colSelectorFactory = EasyMock.createMock(ColumnSelectorFactory.class);
EasyMock.expect(colSelectorFactory.makeLongColumnSelector(Column.TIME_COLUMN_NAME)).andReturn(timeSelector); EasyMock.expect(colSelectorFactory.makeLongColumnSelector(Column.TIME_COLUMN_NAME)).andReturn(timeSelector);
EasyMock.expect(colSelectorFactory.makeDoubleColumnSelector("nilly")).andReturn(valueSelector); EasyMock.expect(colSelectorFactory.makeDoubleColumnSelector("nilly")).andReturn(valueSelector);

View File

@ -60,7 +60,7 @@ public class FloatFirstAggregationTest
combiningAggFactory = (FloatFirstAggregatorFactory) floatFirstAggregatorFactory.getCombiningFactory(); combiningAggFactory = (FloatFirstAggregatorFactory) floatFirstAggregatorFactory.getCombiningFactory();
timeSelector = new TestLongColumnSelector(times); timeSelector = new TestLongColumnSelector(times);
valueSelector = new TestFloatColumnSelector(floats); valueSelector = new TestFloatColumnSelector(floats);
objectSelector = new TestObjectColumnSelector(pairs); objectSelector = new TestObjectColumnSelector<>(pairs);
colSelectorFactory = EasyMock.createMock(ColumnSelectorFactory.class); colSelectorFactory = EasyMock.createMock(ColumnSelectorFactory.class);
EasyMock.expect(colSelectorFactory.makeLongColumnSelector(Column.TIME_COLUMN_NAME)).andReturn(timeSelector); EasyMock.expect(colSelectorFactory.makeLongColumnSelector(Column.TIME_COLUMN_NAME)).andReturn(timeSelector);
EasyMock.expect(colSelectorFactory.makeFloatColumnSelector("nilly")).andReturn(valueSelector); EasyMock.expect(colSelectorFactory.makeFloatColumnSelector("nilly")).andReturn(valueSelector);

View File

@ -59,7 +59,7 @@ public class LongFirstAggregationTest
combiningAggFactory = (LongFirstAggregatorFactory) longFirstAggFactory.getCombiningFactory(); combiningAggFactory = (LongFirstAggregatorFactory) longFirstAggFactory.getCombiningFactory();
timeSelector = new TestLongColumnSelector(times); timeSelector = new TestLongColumnSelector(times);
valueSelector = new TestLongColumnSelector(longValues); valueSelector = new TestLongColumnSelector(longValues);
objectSelector = new TestObjectColumnSelector(pairs); objectSelector = new TestObjectColumnSelector<>(pairs);
colSelectorFactory = EasyMock.createMock(ColumnSelectorFactory.class); colSelectorFactory = EasyMock.createMock(ColumnSelectorFactory.class);
EasyMock.expect(colSelectorFactory.makeLongColumnSelector(Column.TIME_COLUMN_NAME)).andReturn(timeSelector); EasyMock.expect(colSelectorFactory.makeLongColumnSelector(Column.TIME_COLUMN_NAME)).andReturn(timeSelector);
EasyMock.expect(colSelectorFactory.makeLongColumnSelector("nilly")).andReturn(valueSelector); EasyMock.expect(colSelectorFactory.makeLongColumnSelector("nilly")).andReturn(valueSelector);

View File

@ -60,7 +60,7 @@ public class DoubleLastAggregationTest
combiningAggFactory = (DoubleLastAggregatorFactory) doubleLastAggFactory.getCombiningFactory(); combiningAggFactory = (DoubleLastAggregatorFactory) doubleLastAggFactory.getCombiningFactory();
timeSelector = new TestLongColumnSelector(times); timeSelector = new TestLongColumnSelector(times);
valueSelector = new TestDoubleColumnSelectorImpl(doubles); valueSelector = new TestDoubleColumnSelectorImpl(doubles);
objectSelector = new TestObjectColumnSelector(pairs); objectSelector = new TestObjectColumnSelector<>(pairs);
colSelectorFactory = EasyMock.createMock(ColumnSelectorFactory.class); colSelectorFactory = EasyMock.createMock(ColumnSelectorFactory.class);
EasyMock.expect(colSelectorFactory.makeLongColumnSelector(Column.TIME_COLUMN_NAME)).andReturn(timeSelector); EasyMock.expect(colSelectorFactory.makeLongColumnSelector(Column.TIME_COLUMN_NAME)).andReturn(timeSelector);
EasyMock.expect(colSelectorFactory.makeDoubleColumnSelector("nilly")).andReturn(valueSelector); EasyMock.expect(colSelectorFactory.makeDoubleColumnSelector("nilly")).andReturn(valueSelector);

View File

@ -60,7 +60,7 @@ public class FloatLastAggregationTest
combiningAggFactory = (FloatLastAggregatorFactory) floatLastAggregatorFactory.getCombiningFactory(); combiningAggFactory = (FloatLastAggregatorFactory) floatLastAggregatorFactory.getCombiningFactory();
timeSelector = new TestLongColumnSelector(times); timeSelector = new TestLongColumnSelector(times);
valueSelector = new TestFloatColumnSelector(floats); valueSelector = new TestFloatColumnSelector(floats);
objectSelector = new TestObjectColumnSelector(pairs); objectSelector = new TestObjectColumnSelector<>(pairs);
colSelectorFactory = EasyMock.createMock(ColumnSelectorFactory.class); colSelectorFactory = EasyMock.createMock(ColumnSelectorFactory.class);
EasyMock.expect(colSelectorFactory.makeLongColumnSelector(Column.TIME_COLUMN_NAME)).andReturn(timeSelector); EasyMock.expect(colSelectorFactory.makeLongColumnSelector(Column.TIME_COLUMN_NAME)).andReturn(timeSelector);
EasyMock.expect(colSelectorFactory.makeFloatColumnSelector("nilly")).andReturn(valueSelector); EasyMock.expect(colSelectorFactory.makeFloatColumnSelector("nilly")).andReturn(valueSelector);

View File

@ -59,7 +59,7 @@ public class LongLastAggregationTest
combiningAggFactory = (LongLastAggregatorFactory) longLastAggFactory.getCombiningFactory(); combiningAggFactory = (LongLastAggregatorFactory) longLastAggFactory.getCombiningFactory();
timeSelector = new TestLongColumnSelector(times); timeSelector = new TestLongColumnSelector(times);
valueSelector = new TestLongColumnSelector(longValues); valueSelector = new TestLongColumnSelector(longValues);
objectSelector = new TestObjectColumnSelector(pairs); objectSelector = new TestObjectColumnSelector<>(pairs);
colSelectorFactory = EasyMock.createMock(ColumnSelectorFactory.class); colSelectorFactory = EasyMock.createMock(ColumnSelectorFactory.class);
EasyMock.expect(colSelectorFactory.makeLongColumnSelector(Column.TIME_COLUMN_NAME)).andReturn(timeSelector); EasyMock.expect(colSelectorFactory.makeLongColumnSelector(Column.TIME_COLUMN_NAME)).andReturn(timeSelector);
EasyMock.expect(colSelectorFactory.makeLongColumnSelector("nilly")).andReturn(valueSelector); EasyMock.expect(colSelectorFactory.makeLongColumnSelector("nilly")).andReturn(valueSelector);