Respect forceHashAggregation in queryContext (#5533)

* Respect forceHashAggregation in queryContext

* address comment
This commit is contained in:
Jihoon Son 2018-03-28 14:15:38 -07:00 committed by Jonathan Wei
parent db508cf3ca
commit 024e0a9cca
2 changed files with 13 additions and 13 deletions

View File

@ -91,7 +91,7 @@ public class GroupByQueryEngineV2
final GroupByQuery query,
final StorageAdapter storageAdapter,
final NonBlockingPool<ByteBuffer> intermediateResultsBufferPool,
final GroupByQueryConfig config
final GroupByQueryConfig querySpecificConfig
)
{
if (storageAdapter == null) {
@ -150,10 +150,10 @@ public class GroupByQueryEngineV2
final ByteBuffer buffer = bufferHolder.get();
// Check array-based aggregation is applicable
if (isArrayAggregateApplicable(config, query, dims, storageAdapter, buffer)) {
if (isArrayAggregateApplicable(querySpecificConfig, query, dims, storageAdapter, buffer)) {
return new ArrayAggregateIterator(
query,
config,
querySpecificConfig,
cursor,
buffer,
fudgeTimestamp,
@ -165,7 +165,7 @@ public class GroupByQueryEngineV2
} else {
return new HashAggregateIterator(
query,
config,
querySpecificConfig,
cursor,
buffer,
fudgeTimestamp,
@ -186,14 +186,14 @@ public class GroupByQueryEngineV2
}
private static boolean isArrayAggregateApplicable(
GroupByQueryConfig config,
GroupByQueryConfig querySpecificConfig,
GroupByQuery query,
GroupByColumnSelectorPlus[] dims,
StorageAdapter storageAdapter,
ByteBuffer buffer
)
{
if (config.isForceHashAggregation()) {
if (querySpecificConfig.isForceHashAggregation()) {
return false;
}
@ -276,7 +276,7 @@ public class GroupByQueryEngineV2
public GroupByEngineIterator(
final GroupByQuery query,
final GroupByQueryConfig config,
final GroupByQueryConfig querySpecificConfig,
final Cursor cursor,
final ByteBuffer buffer,
final DateTime fudgeTimestamp,
@ -285,7 +285,7 @@ public class GroupByQueryEngineV2
)
{
this.query = query;
this.querySpecificConfig = config.withOverrides(query);
this.querySpecificConfig = querySpecificConfig;
this.cursor = cursor;
this.buffer = buffer;
this.keySerde = new GroupByEngineKeySerde(dims);
@ -413,7 +413,7 @@ public class GroupByQueryEngineV2
public HashAggregateIterator(
GroupByQuery query,
GroupByQueryConfig config,
GroupByQueryConfig querySpecificConfig,
Cursor cursor,
ByteBuffer buffer,
DateTime fudgeTimestamp,
@ -421,7 +421,7 @@ public class GroupByQueryEngineV2
boolean allSingleValueDims
)
{
super(query, config, cursor, buffer, fudgeTimestamp, dims, allSingleValueDims);
super(query, querySpecificConfig, cursor, buffer, fudgeTimestamp, dims, allSingleValueDims);
final int dimCount = query.getDimensions().size();
stack = new int[dimCount];
@ -564,7 +564,7 @@ public class GroupByQueryEngineV2
public ArrayAggregateIterator(
GroupByQuery query,
GroupByQueryConfig config,
GroupByQueryConfig querySpecificConfig,
Cursor cursor,
ByteBuffer buffer,
DateTime fudgeTimestamp,
@ -573,7 +573,7 @@ public class GroupByQueryEngineV2
int cardinality
)
{
super(query, config, cursor, buffer, fudgeTimestamp, dims, allSingleValueDims);
super(query, querySpecificConfig, cursor, buffer, fudgeTimestamp, dims, allSingleValueDims);
this.cardinality = cardinality;
if (dims.length == 1) {
this.dim = dims[0];

View File

@ -352,6 +352,6 @@ public class GroupByStrategyV2 implements GroupByStrategy
StorageAdapter storageAdapter
)
{
return GroupByQueryEngineV2.process(query, storageAdapter, bufferPool, configSupplier.get());
return GroupByQueryEngineV2.process(query, storageAdapter, bufferPool, configSupplier.get().withOverrides(query));
}
}