Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion api/src/main/java/io/druid/data/input/FirehoseV2.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public interface FirehoseV2 extends Closeable
/**
* @return The current row
*/
public InputRow currRow() ;
public InputRow currRow();

/**
* Returns a Committer that will "commit" everything read up to the point at which makeCommitter() is called.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public DimensionsSpec(
dimensionSchemaMap.put(schema.getName(), schema);
}

for(SpatialDimensionSchema spatialSchema : spatialDims) {
for (SpatialDimensionSchema spatialSchema : spatialDims) {
DimensionSchema newSchema = DimensionsSpec.convertSpatialSchema(spatialSchema);
this.dimensions.add(newSchema);
dimensionSchemaMap.put(newSchema.getName(), newSchema);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
})
public interface InputRowParser<T>
{
public InputRow parse(T input) ;
public InputRow parse(T input);

public ParseSpec getParseSpec();

public InputRowParser withParseSpec(ParseSpec parseSpec) ;
public InputRowParser withParseSpec(ParseSpec parseSpec);
}
2 changes: 1 addition & 1 deletion api/src/main/java/io/druid/guice/JsonConfigurator.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public <T> T configurate(Properties props, String propertyPrefix, Class<T> clazz
try {
// If it's a String Jackson wants it to be quoted, so check if it's not an object or array and quote.
String modifiedPropValue = propValue;
if (! (modifiedPropValue.startsWith("[") || modifiedPropValue.startsWith("{"))) {
if (!(modifiedPropValue.startsWith("[") || modifiedPropValue.startsWith("{"))) {
modifiedPropValue = jsonMapper.writeValueAsString(propValue);
}
value = jsonMapper.readValue(modifiedPropValue, Object.class);
Expand Down
2 changes: 1 addition & 1 deletion api/src/test/java/io/druid/data/input/MapBasedRowTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void testGetLongMetricFromString()
{
MapBasedRow row = new MapBasedRow(
new DateTime(),
ImmutableMap.<String,Object>builder()
ImmutableMap.<String, Object>builder()
.put("k0", "-1.2")
.put("k1", "1.23")
.put("k2", "1.8")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public void testDimensionsSpecSerde() throws Exception

List<SpatialDimensionSchema> expectedSpatials = Arrays.asList(
new SpatialDimensionSchema("DDT", null),
new SpatialDimensionSchema("DDT2", Arrays.asList("A","B")),
new SpatialDimensionSchema("IMPR", Arrays.asList("S","P","Q","R"))
new SpatialDimensionSchema("DDT2", Arrays.asList("A", "B")),
new SpatialDimensionSchema("IMPR", Arrays.asList("S", "P", "Q", "R"))
);

Assert.assertEquals(expected, actual);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static Collection<Object[]> constructorFeeder() throws IOException
final List<Object[]> args = new ArrayList<>();
for (int numSkipHeadRows = 0; numSkipHeadRows < 3; numSkipHeadRows++) {
for (List<String> texts : inputTexts) {
args.add(new Object[] { texts, numSkipHeadRows });
args.add(new Object[] {texts, numSkipHeadRows});
}
}

Expand Down
9 changes: 4 additions & 5 deletions api/src/test/java/io/druid/guice/PolyBindTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,10 @@ public void configure(Binder binder)
gogoSallyBinder.addBinding("a").to(GoA.class);
gogoSallyBinder.addBinding("b").to(GoB.class);

PolyBind.createChoice(
binder, "billy", Key.get(Gogo.class, Names.named("reverse")), Key.get(GoB.class)
);
final MapBinder<String,Gogo> annotatedGogoBinder = PolyBind.optionBinder(
binder, Key.get(Gogo.class, Names.named("reverse"))
PolyBind.createChoice(binder, "billy", Key.get(Gogo.class, Names.named("reverse")), Key.get(GoB.class));
final MapBinder<String, Gogo> annotatedGogoBinder = PolyBind.optionBinder(
binder,
Key.get(Gogo.class, Names.named("reverse"))
);
annotatedGogoBinder.addBinding("a").to(GoB.class);
annotatedGogoBinder.addBinding("b").to(GoA.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void setup() throws IOException
int rowToAccess = rand.nextInt(vals.length);
// Skip already selected rows if any
while (filter.get(rowToAccess)) {
rowToAccess = (rowToAccess+1) % vals.length;
rowToAccess = (rowToAccess + 1) % vals.length;
}
filter.set(rowToAccess);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public VSizeIndexedInts apply(int[] input)
int rowToAccess = rand.nextInt(rows.size());
// Skip already selected rows if any
while (filter.get(rowToAccess)) {
rowToAccess = (rowToAccess+1) % rows.size();
rowToAccess = (rowToAccess + 1) % rows.size();
}
filter.set(rowToAccess);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ public static void main(String[] args) throws Exception
control.clearCPUData();
Thread.sleep(5000);
control.startCPUSampling(null);
for(int i = 0; i < numEvents; i++) {
for (int i = 0; i < numEvents; i++) {
//parsedMap = parser.parse(fjp.nestedInputs.get(i));
parsedMap = fjp.parseFlat(forcedParser);
//parsedMap = fjp.parseFlat(parser);
//parsedMap = fjp.parseNested(nestedPar);
if(parsedMap != null) {
if (parsedMap != null) {
j++;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public Object get()
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void hammerQueue(BenchmarkPool pool, Blackhole blackhole) throws IOException
{
try(ResourceHolder<Object> holder = pool.pool.take()){
try (ResourceHolder<Object> holder = pool.pool.take()) {
blackhole.consume(holder);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,11 @@ public void setup() throws IOException
queryBuilder.threshold(threshold);
stringQuery = queryBuilder.build();

TopNQueryBuilder longBuilder = SCHEMA_QUERY_MAP.get("basic").get("long");
TopNQueryBuilder longBuilder = SCHEMA_QUERY_MAP.get("basic").get("long");
longBuilder.threshold(threshold);
longQuery = longBuilder.build();

TopNQueryBuilder floatBuilder = SCHEMA_QUERY_MAP.get("basic").get("float");
TopNQueryBuilder floatBuilder = SCHEMA_QUERY_MAP.get("basic").get("float");
floatBuilder.threshold(threshold);
floatQuery = floatBuilder.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public int columnCacheSizeBytes()
@Setup
public void setup() throws IOException
{
log.info("SETUP CALLED AT " + + System.currentTimeMillis());
log.info("SETUP CALLED AT " + System.currentTimeMillis());

if (ComplexMetrics.getSerdeForType("hyperUnique") == null) {
ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde(HyperLogLogHash.getDefault()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public int columnCacheSizeBytes()
@Setup
public void setup() throws IOException
{
log.info("SETUP CALLED AT " + + System.currentTimeMillis());
log.info("SETUP CALLED AT " + System.currentTimeMillis());

if (ComplexMetrics.getSerdeForType("hyperUnique") == null) {
ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde(HyperLogLogHash.getDefault()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static <T, QueryType extends Query<T>> QueryRunner<T> makeQueryRunner(
segmentId, adapter.getDataInterval().getStart(),
factory.createRunner(adapter)
),
(QueryToolChest<T, Query<T>>)factory.getToolchest()
(QueryToolChest<T, Query<T>>) factory.getToolchest()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public void setupDummyCluster()

Random r = new Random(1234);
segments = new ArrayList<>(n);
for(int i = 0; i < n; ++i) {
final DateTime t = t0.minusHours(r.nextInt(365 * 24) - 365*12);
for (int i = 0; i < n; ++i) {
final DateTime t = t0.minusHours(r.nextInt(365 * 24) - 365 * 12);
segments.add(createSegment(t));
}
}
Expand All @@ -85,7 +85,7 @@ DataSegment createSegment(DateTime t)
public double measureCostStrategySingle() throws InterruptedException
{
double totalCost = 0;
for(DataSegment s : segments) {
for (DataSegment s : segments) {
totalCost += CostBalancerStrategy.computeJointSegmentsCost(segment, s);
}
return totalCost;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void testCacheKey()
@Test
public void testContains()
{
final PolygonBound triangle = PolygonBound.from(new float[]{1f, 4f, 7f}, new float[]{ 1f, 4f, 1f});
final PolygonBound triangle = PolygonBound.from(new float[]{1f, 4f, 7f}, new float[]{1f, 4f, 1f});
final float delta = 1e-5f;

Assert.assertTrue(triangle.contains(new float[]{1f, 1f}));
Expand All @@ -64,11 +64,11 @@ public void testContains()
Assert.assertFalse(triangle.contains(new float[]{1f, 5f}));
Assert.assertTrue(triangle.contains(new float[]{3f, 2f}));

final PolygonBound rightTriangle = PolygonBound.from(new float[]{1f, 1f, 5f}, new float[]{ 1f, 5f, 1f});
final PolygonBound rightTriangle = PolygonBound.from(new float[]{1f, 1f, 5f}, new float[]{1f, 5f, 1f});

Assert.assertTrue(rightTriangle.contains(new float[]{1f, 5f}));
Assert.assertTrue(rightTriangle.contains(new float[]{2f, 4f}));
Assert.assertTrue(rightTriangle.contains(new float[]{2f - delta , 4f}));
Assert.assertTrue(rightTriangle.contains(new float[]{2f - delta, 4f}));
Assert.assertFalse(rightTriangle.contains(new float[]{2f + delta, 4f}));
Assert.assertTrue(rightTriangle.contains(new float[]{2f, 4f - delta}));
Assert.assertFalse(rightTriangle.contains(new float[]{2f, 4f + delta}));
Expand Down
8 changes: 8 additions & 0 deletions codestyle/checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@
<suppress checks="UnusedImports" files="[\\/]target[\\/]generated-test-sources[\\/]" />
<suppress checks="AvoidStarImport" files="[\\/]target[\\/]generated-test-sources[\\/]" />
<suppress checks="FileTabCharacter" files="[\\/]target[\\/]generated-test-sources[\\/]" />

<suppress checks="WhitespaceAfter" files="[\\/]target[\\/]generated-test-sources[\\/]" />
<suppress checks="WhitespaceAround" files="[\\/]target[\\/]generated-test-sources[\\/]" />
<suppress checks="ParenPad" files="[\\/]target[\\/]generated-test-sources[\\/]" />
<suppress checks="SingleSpaceSeparator" files="[\\/]target[\\/]generated-test-sources[\\/]" />
<suppress checks="NoWhitespaceBefore" files="[\\/]target[\\/]generated-test-sources[\\/]" />
<suppress checks="NoWhitespaceAfter" files="[\\/]target[\\/]generated-test-sources[\\/]" />

<suppress checks="LeftCurly" files="[\\/]target[\\/]generated-test-sources[\\/]" />
<suppress checks="RightCurly" files="[\\/]target[\\/]generated-test-sources[\\/]" />

Expand Down
22 changes: 22 additions & 0 deletions codestyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,28 @@
<property name="tokens" value="LITERAL_TRY,LITERAL_CATCH,LITERAL_FINALLY,CLASS_DEF,METHOD_DEF,CTOR_DEF,LITERAL_FOR,LITERAL_WHILE,STATIC_INIT,INSTANCE_INIT"/>
</module>

<module name="WhitespaceAfter"/>
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyMethods" value="true"/>
<property name="allowEmptyLambdas" value="true"/>
<property name="allowEmptyTypes" value="true"/>
</module>
<module name="ParenPad"/>
<module name="SingleSpaceSeparator"/>
<module name="NoWhitespaceBefore">
<property name="tokens" value="COMMA,SEMI,POST_INC,POST_DEC,ELLIPSIS,METHOD_REF"/>
</module>
<module name="NoWhitespaceBefore">
<property name="tokens" value="DOT"/>
<property name="allowLineBreaks" value="true"/>
</module>
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceAfter">
<property name="tokens" value="DOT"/>
<property name="allowLineBreaks" value="false"/>
</module>

<module name="Regexp">
<property name="format" value="com\.google\.common\.io\.Closer"/>
<property name="illegalPattern" value="true"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public boolean isDone()
public void close() throws IOException
{
Closer closer = Closer.create();
while(!pQueue.isEmpty()) {
while (!pQueue.isEmpty()) {
closer.register(pQueue.remove());
}
closer.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,17 @@ private <OutType> Yielder<OutType> makeYielder(
final OutType retVal;
final boolean finalFinalValue;

if(!yielder.isDone()) {
if (!yielder.isDone()) {
retVal = combiningAccumulator.getRetVal();
finalYielder = null;
finalFinalValue = false;
} else {
if(!finalValue && combiningAccumulator.accumulatedSomething()) {
if (!finalValue && combiningAccumulator.accumulatedSomething()) {
combiningAccumulator.accumulateLastValue();
retVal = combiningAccumulator.getRetVal();
finalFinalValue = true;

if(!combiningAccumulator.yielded()) {
if (!combiningAccumulator.yielded()) {
return Yielders.done(retVal, yielder);
} else {
finalYielder = Yielders.done(null, yielder);
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/io/druid/common/utils/JodaUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static ArrayList<Interval> condenseIntervals(Iterable<Interval> intervals

if (currInterval.abuts(next)) {
currInterval = new Interval(currInterval.getStart(), next.getEnd());
} else if(currInterval.overlaps(next)) {
} else if (currInterval.overlaps(next)) {
DateTime nextEnd = next.getEnd();
DateTime currEnd = currInterval.getEnd();
currInterval = new Interval(
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/io/druid/common/utils/PropUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static int getPropertyAsInt(Properties props, String property, Integer de
return Integer.parseInt(retVal);
}
catch (NumberFormatException e) {
throw new ISE(e, "Property[%s] is expected to be an int, it is not[%s].",property, retVal);
throw new ISE(e, "Property[%s] is expected to be an int, it is not[%s].", property, retVal);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public void testCreateSplatted()
iterators,
Ordering.<Integer>natural()
);
Assert.assertEquals(mergedLists.size(),Iterables.size(actualIterable));
Assert.assertEquals(mergedLists.size(), Iterables.size(actualIterable));
Set actualHashset = Sets.newHashSet(actualIterable);
Assert.assertEquals(actualHashset,mergedLists);
Assert.assertEquals(actualHashset, mergedLists);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void setUp()
peekIterator = EasyMock.createMock(PeekingIterator.class);
comparator = EasyMock.createMock(Comparator.class);
binaryFn = EasyMock.createMock(BinaryFn.class);
testingIterator = CombiningIterator.create(peekIterator,comparator,binaryFn);
testingIterator = CombiningIterator.create(peekIterator, comparator, binaryFn);
}

@After
Expand All @@ -62,7 +62,7 @@ public void testHasNext()
EasyMock.replay(peekIterator);
boolean actual = testingIterator.hasNext();
EasyMock.verify(peekIterator);
Assert.assertEquals("The hasNext function is broken",expected,actual);
Assert.assertEquals("The hasNext function is broken", expected, actual);
}

@Test
Expand All @@ -75,7 +75,7 @@ public void testFalseBranchNext()
EasyMock.replay(peekIterator);
Object res = testingIterator.next();
EasyMock.verify(peekIterator);
Assert.assertNull("Should be null",res);
Assert.assertNull("Should be null", res);
}

@Test
Expand All @@ -102,7 +102,7 @@ public void testNext()
EasyMock.replay(comparator);

String actual = testingIterator.next();
Assert.assertEquals(resString,actual);
Assert.assertEquals(resString, actual);

EasyMock.verify(peekIterator);
EasyMock.verify(comparator);
Expand Down
12 changes: 6 additions & 6 deletions common/src/test/java/io/druid/collections/IntListTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void testExceptionInGet()
@Test
public void testToArray()
{
int[] inputArray = {1,3,4};
int[] inputArray = {1, 3, 4};
IntList list = new IntList();
for (int i = 0; i < inputArray.length; i++) {
list.add(inputArray[i]);
Expand All @@ -97,24 +97,24 @@ public void testNullCaseGetBaseList()
{
final int intSize = 2;
IntList list = new IntList(intSize);
list.set(2 * intSize,100);
list.set(2 * intSize, 100);
IntBuffer outBuffer;
outBuffer = list.getBaseList(0);
Assert.assertNull("Should be Null",outBuffer);
Assert.assertNull("Should be Null", outBuffer);
}

@Test
public void testGetBaseList()
{
int listSize = 2;
IntList list = new IntList(listSize);
int[] expectedArray = {1,2};
int[] expectedArray = {1, 2};
list.add(expectedArray[0]);
list.add(expectedArray[1]);
IntBuffer outputBuffer = list.getBaseList(0);
Assert.assertEquals("Buffer size does not match",2, outputBuffer.limit());
Assert.assertEquals("Buffer size does not match", 2, outputBuffer.limit());
int[] actualArray = new int[outputBuffer.capacity()];
outputBuffer.get(actualArray);
Assert.assertArrayEquals("Arrays are not matching",expectedArray, actualArray);
Assert.assertArrayEquals("Arrays are not matching", expectedArray, actualArray);
}
}
Loading