Skip to content

Commit

Permalink
Merge pull request apache#2583 from guobingkun/fix_multiple_specs_2
Browse files Browse the repository at this point in the history
update querySegmentSpec when passing query to getQueryRunner
  • Loading branch information
fjy committed Mar 3, 2016
2 parents 9e74772 + 4a58462 commit d06c1c5
Show file tree
Hide file tree
Showing 4 changed files with 231 additions and 43 deletions.
12 changes: 12 additions & 0 deletions processing/src/test/java/io/druid/query/QueryRunnerTestHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,18 @@ public void remove()
};
}

public static <T, QueryType extends Query<T>> QueryRunner<T> makeQueryRunner(
QueryRunnerFactory<T, QueryType> factory,
String resourceFileName
)
{
return makeQueryRunner(
factory,
segmentId,
new IncrementalIndexSegment(TestIndex.makeRealtimeIndex(resourceFileName), segmentId)
);
}

public static <T, QueryType extends Query<T>> QueryRunner<T> makeQueryRunner(
QueryRunnerFactory<T, QueryType> factory,
Segment adapter
Expand Down
2 changes: 1 addition & 1 deletion processing/src/test/java/io/druid/segment/TestIndex.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public static QueryableIndex mergedRealtimeIndex()
}
}

private static IncrementalIndex makeRealtimeIndex(final String resourceFilename)
public static IncrementalIndex makeRealtimeIndex(final String resourceFilename)
{
final URL resource = TestIndex.class.getClassLoader().getResource(resourceFilename);
if (resource == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import io.druid.query.QuerySegmentWalker;
import io.druid.query.QueryToolChest;
import io.druid.query.SegmentDescriptor;
import io.druid.query.spec.SpecificSegmentSpec;
import io.druid.segment.indexing.DataSchema;
import io.druid.segment.indexing.RealtimeTuningConfig;
import io.druid.segment.realtime.plumber.Committers;
Expand Down Expand Up @@ -192,7 +193,9 @@ public <T> QueryRunner<T> getQueryRunnerForSegments(final Query<T> query, final
public QueryRunner<T> apply(SegmentDescriptor spec)
{
final FireChief retVal = partitionChiefs.get(spec.getPartitionNumber());
return retVal == null ? new NoopQueryRunner<T>() : retVal.getQueryRunner(query);
return retVal == null
? new NoopQueryRunner<T>()
: retVal.getQueryRunner(query.withQuerySegmentSpec(new SpecificSegmentSpec(spec)));
}
}
)
Expand Down
Loading

0 comments on commit d06c1c5

Please sign in to comment.