use of org.apache.drill.exec.physical.config.HashAggregate in project drill by apache.
the class TestNullInputMiniPlan method testHashAggEmpty.
@Test
public void testHashAggEmpty() throws Exception {
final PhysicalOperator hashAgg = new HashAggregate(null, AggPrelBase.OperatorPhase.PHASE_1of1, parseExprs("a", "a"), parseExprs("sum(b)", "b_sum"), 1.0f);
testSingleInputNullBatchHandling(hashAgg);
}
use of org.apache.drill.exec.physical.config.HashAggregate in project drill by apache.
the class BasicPhysicalOpUnitTest method testSimpleHashAgg.
@Test
public void testSimpleHashAgg() {
HashAggregate aggConf = new HashAggregate(null, AggPrelBase.OperatorPhase.PHASE_1of1, parseExprs("a", "a"), parseExprs("sum(b)", "b_sum"), 1.0f);
List<String> inputJsonBatches = Lists.newArrayList("[{\"a\": 5, \"b\" : 1 }]", "[{\"a\": 5, \"b\" : 5},{\"a\": 3, \"b\" : 8}]");
legacyOpTestBuilder().physicalOperator(aggConf).inputDataStreamJson(inputJsonBatches).baselineColumns("b_sum", "a").baselineValues(6l, 5l).baselineValues(8l, 3l).go();
}
use of org.apache.drill.exec.physical.config.HashAggregate in project drill by axbaretto.
the class TestNullInputMiniPlan method testHashAggEmpty.
@Test
public void testHashAggEmpty() throws Exception {
final PhysicalOperator hashAgg = new HashAggregate(null, AggPrelBase.OperatorPhase.PHASE_1of1, parseExprs("a", "a"), parseExprs("sum(b)", "b_sum"), 1.0f);
testSingleInputNullBatchHandling(hashAgg);
}
use of org.apache.drill.exec.physical.config.HashAggregate in project drill by apache.
the class TestHashAggBatch method createHashAggPhysicalOperator.
private HashAggregate createHashAggPhysicalOperator(AggPrelBase.OperatorPhase phase) {
final List<NamedExpression> keyExpressions = Lists.newArrayList(new NamedExpression(SchemaPath.getSimplePath(FIRST_NAME_COL), new FieldReference(FIRST_NAME_COL)), new NamedExpression(SchemaPath.getSimplePath(LAST_NAME_COL), new FieldReference(LAST_NAME_COL)));
final List<NamedExpression> aggExpressions = Lists.newArrayList(new NamedExpression(new FunctionCall("sum", ImmutableList.of(SchemaPath.getSimplePath(STUFF_COL)), new ExpressionPosition(null, 0)), new FieldReference(TOTAL_STUFF_COL)));
return new HashAggregate(null, phase, keyExpressions, aggExpressions, 0.0f);
}
use of org.apache.drill.exec.physical.config.HashAggregate in project drill by apache.
the class TestHashAggBatch method batchSumTest.
private void batchSumTest(int totalCount, int maxInputBatchSize, AggPrelBase.OperatorPhase phase) throws Exception {
final HashAggregate hashAggregate = createHashAggPhysicalOperator(phase);
final List<RowSet> inputRowSets = buildInputRowSets(TypeProtos.MinorType.INT, TypeProtos.DataMode.REQUIRED, totalCount, maxInputBatchSize);
final MockRecordBatch.Builder rowSetBatchBuilder = new MockRecordBatch.Builder();
inputRowSets.forEach(rowSet -> rowSetBatchBuilder.sendData(rowSet));
final MockRecordBatch inputRowSetBatch = rowSetBatchBuilder.build(fragContext);
final RowSet expectedRowSet = buildIntExpectedRowSet(totalCount);
opTestBuilder().physicalOperator(hashAggregate).combineOutputBatches().unordered().addUpstreamBatch(inputRowSetBatch).addExpectedResult(expectedRowSet).go();
}
Aggregations