simpler sequence limiting

This commit is contained in:
fjy 2013-04-28 15:34:43 -07:00
parent 67cafaa0b1
commit 2849486251
2 changed files with 3 additions and 16 deletions

View File

@ -247,7 +247,7 @@ public abstract class QueryableNode<T extends QueryableNode> extends Registering
if (requestLogger == null) {
try {
final String loggingType = props.getProperty("druid.request.logging.type");
if(loggingType.equals("emitter")) {
if(loggingType != null && loggingType.equals("emitter")) {
setRequestLogger(Initialization.makeEmittingRequestLogger(
getProps(),
getEmitter()

View File

@ -150,7 +150,7 @@ public class GroupByQueryQueryToolChest extends QueryToolChest<Row, GroupByQuery
);
// convert millis back to timestamp according to granularity to preserve time zone information
return Sequences.filter(
return Sequences.limit(
Sequences.map(
Sequences.simple(index.iterableWithPostAggregations(query.getPostAggregatorSpecs())),
new Function<Row, Row>()
@ -163,20 +163,7 @@ public class GroupByQueryQueryToolChest extends QueryToolChest<Row, GroupByQuery
}
}
),
new Predicate<Row>()
{
private volatile int numRows = 0;
@Override
public boolean apply(@Nullable Row input)
{
if (query.getThreshold() > 0) {
return (numRows++ < query.getThreshold());
} else {
return true;
}
}
}
(query.getThreshold() > 0) ? query.getThreshold() : maxRows
);
}