Merge pull request #1108 from metamx/improve-groupby-perf

Improve groupby by removing conversion to case insensitive row
This commit is contained in:
Fangjin Yang 2015-02-12 11:45:20 -08:00
commit 90bc62eb5c
2 changed files with 14 additions and 5 deletions

View File

@ -23,6 +23,8 @@ import com.metamx.common.ISE;
import com.metamx.common.Pair;
import com.metamx.common.guava.Accumulator;
import io.druid.collections.StupidPool;
import io.druid.data.input.MapBasedInputRow;
import io.druid.data.input.MapBasedRow;
import io.druid.data.input.Row;
import io.druid.data.input.Rows;
import io.druid.granularity.QueryGranularity;
@ -104,10 +106,18 @@ public class GroupByQueryHelper
public IncrementalIndex accumulate(IncrementalIndex accumulated, T in)
{
if (in instanceof Row) {
if (in instanceof MapBasedRow) {
try {
accumulated.add(Rows.toCaseInsensitiveInputRow((Row) in, dimensions));
} catch(IndexSizeExceededException e) {
MapBasedRow row = (MapBasedRow) in;
accumulated.add(
new MapBasedInputRow(
row.getTimestamp(),
dimensions,
row.getEvent()
)
);
}
catch (IndexSizeExceededException e) {
throw new ISE(e.getMessage());
}
} else {

View File

@ -131,8 +131,7 @@ public class EventReceiverFirehoseFactory implements FirehoseFactory<MapInputRow
final List<InputRow> rows = Lists.newArrayList();
for (final Map<String, Object> event : events) {
// Might throw an exception. We'd like that to happen now, instead of while adding to the row buffer.
InputRow row = parser.parse(event);
rows.add(Rows.toCaseInsensitiveInputRow(row, row.getDimensions()));
rows.add(parser.parse(event));
}
try {