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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .idea/inspectionProfiles/Druid.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,9 @@ public ExtractionType getExtractionType()

private static SearchQueryBuilder basicD(final BenchmarkSchemaInfo basicSchema)
{
final QuerySegmentSpec intervalSpec = new MultipleIntervalSegmentSpec(Collections.singletonList(basicSchema.getDataInterval()));
final QuerySegmentSpec intervalSpec = new MultipleIntervalSegmentSpec(
Collections.singletonList(basicSchema.getDataInterval())
);

final List<String> dimUniformFilterVals = new ArrayList<>();
final int resultNum = (int) (100000 * 0.1);
Expand All @@ -296,9 +298,6 @@ private static SearchQueryBuilder basicD(final BenchmarkSchemaInfo basicSchema)
dimFilters.add(new InDimFilter(dimName, dimUniformFilterVals, null));
dimFilters.add(new SelectorDimFilter(dimName, "3", null));
dimFilters.add(new BoundDimFilter(dimName, "100", "10000", true, true, true, null, null));
dimFilters.add(new InDimFilter(dimName, dimUniformFilterVals, null));
dimFilters.add(new InDimFilter(dimName, dimUniformFilterVals, null));
dimFilters.add(new InDimFilter(dimName, dimUniformFilterVals, null));

return Druids.newSearchQueryBuilder()
.dataSource("blah")
Expand Down
7 changes: 5 additions & 2 deletions codestyle/checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,16 @@

<suppress checks="Indentation" files="[\\/]target[\\/]generated-test-sources[\\/]" />
<suppress checks="Indentation" files="ProtoTestEventWrapper.java" />
<suppress checks="Regex" files="ProtoTestEventWrapper.java" />
<suppress checks="Regexp" id="argumentLineBreaking" files="ProtoTestEventWrapper.java" />

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

<!-- extendedset is a fork of Alessandro Colantonio's CONCISE (COmpressed 'N' Composable Integer SEt) repository and licensed to ASF under a CLA is not true. -->
<!-- extendedset is a fork of Alessandro Colantonio's CONCISE (COmpressed 'N' Composable Integer SEt) repository
and licensed to ASF under a CLA is not true. -->
<suppress checks="Header" files="[\\/]extendedset[\\/]" />

<suppress checks="Regexp" id="duplicateLine" files="[\\/]src[\\/]test[\\/]" />

<!-- See https://github.com/checkstyle/checkstyle/issues/5510 and the ImportOrder definition in checkstyle.xml -->
<suppress checks="ImportOrder" message="^'java\..*'.*" />

Expand Down
8 changes: 8 additions & 0 deletions codestyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@
</module>

<module name="Regexp">
<property name="id" value="argumentLineBreaking"/>
<property
name="format"
value='(?&lt;!ImmutableMap.of|Types.mapOf|orderedMap|makeSelectResults|makeListOfPairs)\(\s*\n +([^,\n\(\{"&lt;/]+|[^,\n\(\{" /]+&gt; [a-zA-Z0-9_]+)\, ++[^,\n/]+'
Expand Down Expand Up @@ -277,5 +278,12 @@ If you encouter a map-like or a pair-accepting method that is reported by this&#
checkstyle rule, you should add it as an exception in the corresponding rule in&#10;
codestyle/checkstyle.xml.&#10;"/>
</module>

<module name="Regexp">
<property name="id" value="duplicateLine"/>
<property name="format" value="^(.*;)(\r?\n\1)+$"/>
<property name="illegalPattern" value="true"/>
<property name="message" value="Duplicate line"/>
</module>
</module>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package org.apache.druid.jackson;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer;

Expand All @@ -39,7 +38,7 @@ protected CommaListJoinDeserializer()

@Override
public List<String> deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
throws IOException, JsonProcessingException
throws IOException
{
return Arrays.asList(jsonParser.getText().split(","));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

package org.apache.druid.jackson;

import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdScalarSerializer;
Expand All @@ -40,8 +39,7 @@ protected CommaListJoinSerializer()
}

@Override
public void serialize(List<String> value, JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonGenerationException
public void serialize(List<String> value, JsonGenerator jgen, SerializerProvider provider) throws IOException
{
jgen.writeString(joiner.join(value));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package org.apache.druid.indexer;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down Expand Up @@ -109,8 +108,7 @@ public DateTimeDeserializer()
}

@Override
public DateTime deserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException
public DateTime deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException
{
JsonToken t = jp.getCurrentToken();
if (t == JsonToken.VALUE_NUMBER_INT) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package org.apache.druid.query.aggregation.datasketches.tuple;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.yahoo.sketches.tuple.ArrayOfDoublesSketch;
Expand All @@ -35,7 +34,7 @@ public void serialize(
final ArrayOfDoublesSketch sketch,
final JsonGenerator generator,
final SerializerProvider provider
) throws IOException, JsonProcessingException
) throws IOException
{
generator.writeBinary(sketch.toByteArray());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,7 @@ public void close()
}
);

Closeable closeable = () -> {
if (!setupFuture.isDone() && !setupFuture.cancel(true) && !setupFuture.isDone()) {
throw new IOException("Unable to stop future");
}
};
try (final Closeable c = closeable) {
try (final Closeable ignore = () -> setupFuture.cancel(true)) {
handleRef = setupFuture.get(10, TimeUnit.SECONDS);
}
Assert.assertNotNull(handleRef);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,5 @@ public void configure(Binder binder)
{
JsonConfigProvider.bind(binder, "druid.generic", NullValueHandlingConfig.class);
binder.requestStaticInjection(NullHandling.class);
binder.requestStaticInjection(NullHandling.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer;
Expand Down Expand Up @@ -70,8 +69,7 @@ public void serialize(
DateTimeZone dateTimeZone,
JsonGenerator jsonGenerator,
SerializerProvider serializerProvider
)
throws IOException, JsonProcessingException
) throws IOException
{
jsonGenerator.writeString(dateTimeZone.getID());
}
Expand All @@ -83,7 +81,7 @@ public void serialize(
{
@Override
public void serialize(Sequence value, final JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonProcessingException
throws IOException
{
jgen.writeStartArray();
value.accumulate(
Expand Down Expand Up @@ -113,7 +111,7 @@ public Object accumulate(Object o, Object o1)
{
@Override
public void serialize(Yielder yielder, final JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonProcessingException
throws IOException
{
try {
jgen.writeStartArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package org.apache.druid.jackson;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
Expand Down Expand Up @@ -71,7 +70,7 @@ public IntervalDeserializer()

@Override
public Interval deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
throws IOException, JsonProcessingException
throws IOException
{
return Intervals.of(jsonParser.getText());
}
Expand All @@ -94,8 +93,7 @@ public DateTimeDeserializer()
}

@Override
public DateTime deserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException
public DateTime deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException
{
JsonToken t = jp.getCurrentToken();
if (t == JsonToken.VALUE_NUMBER_INT) {
Expand Down
71 changes: 35 additions & 36 deletions services/src/main/java/org/apache/druid/cli/DumpSegment.java
Original file line number Diff line number Diff line change
Expand Up @@ -343,50 +343,49 @@ private void runBitmaps(final Injector injector, final QueryableIndex index) thr
@Override
public Object apply(final OutputStream out)
{
try {
final JsonGenerator jg = objectMapper.getFactory().createGenerator(out);

jg.writeStartObject();
jg.writeObjectField("bitmapSerdeFactory", bitmapSerdeFactory);
jg.writeFieldName("bitmaps");
try (final JsonGenerator jg = objectMapper.getFactory().createGenerator(out)) {
jg.writeStartObject();

for (final String columnName : columnNames) {
final ColumnHolder columnHolder = index.getColumnHolder(columnName);
final BitmapIndex bitmapIndex = columnHolder.getBitmapIndex();

if (bitmapIndex == null) {
jg.writeNullField(columnName);
} else {
jg.writeFieldName(columnName);
jg.writeStartObject();
for (int i = 0; i < bitmapIndex.getCardinality(); i++) {
String val = NullHandling.nullToEmptyIfNeeded(bitmapIndex.getValue(i));
if (val != null) {
final ImmutableBitmap bitmap = bitmapIndex.getBitmap(i);
if (decompressBitmaps) {
jg.writeStartArray();
final IntIterator iterator = bitmap.iterator();
while (iterator.hasNext()) {
final int rowNum = iterator.next();
jg.writeNumber(rowNum);
}
jg.writeEndArray();
} else {
byte[] bytes = bitmapSerdeFactory.getObjectStrategy().toBytes(bitmap);
if (bytes != null) {
jg.writeBinary(bytes);
{
jg.writeObjectField("bitmapSerdeFactory", bitmapSerdeFactory);
jg.writeFieldName("bitmaps");
jg.writeStartObject();
{
for (final String columnName : columnNames) {
final ColumnHolder columnHolder = index.getColumnHolder(columnName);
final BitmapIndex bitmapIndex = columnHolder.getBitmapIndex();

if (bitmapIndex == null) {
jg.writeNullField(columnName);
} else {
jg.writeFieldName(columnName);
jg.writeStartObject();
for (int i = 0; i < bitmapIndex.getCardinality(); i++) {
String val = NullHandling.nullToEmptyIfNeeded(bitmapIndex.getValue(i));
if (val != null) {
final ImmutableBitmap bitmap = bitmapIndex.getBitmap(i);
if (decompressBitmaps) {
jg.writeStartArray();
final IntIterator iterator = bitmap.iterator();
while (iterator.hasNext()) {
final int rowNum = iterator.next();
jg.writeNumber(rowNum);
}
jg.writeEndArray();
} else {
byte[] bytes = bitmapSerdeFactory.getObjectStrategy().toBytes(bitmap);
if (bytes != null) {
jg.writeBinary(bytes);
}
}
}
}
jg.writeEndObject();
}
}
jg.writeEndObject();
}
jg.writeEndObject();
}

jg.writeEndObject();
jg.writeEndObject();
jg.close();
}
catch (IOException e) {
throw Throwables.propagate(e);
Expand Down