Ben-Zvi commented on a change in pull request #1324: DRILL-6310: limit batch
size for hash aggregate
URL: https://github.com/apache/drill/pull/1324#discussion_r198711656
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java
##########
@@ -283,16 +363,23 @@ private HashAggregator createAggregatorInternal() throws
SchemaChangeException,
continue;
}
- if ( expr instanceof FunctionHolderExpression ) {
- String funcName = ((FunctionHolderExpression) expr).getName();
- if ( funcName.equals("sum") || funcName.equals("max") ||
funcName.equals("min") ) {extraNonNullColumns++;}
- }
final MaterializedField outputField =
MaterializedField.create(ne.getRef().getAsNamePart().getName(),
expr.getMajorType());
- @SuppressWarnings("resource")
- ValueVector vv = TypeHelper.getNewVector(outputField,
oContext.getAllocator());
+ @SuppressWarnings("resource") ValueVector vv =
TypeHelper.getNewVector(outputField, oContext.getAllocator());
aggrOutFieldIds[i] = container.add(vv);
aggrExprs[i] = new ValueVectorWriteExpression(aggrOutFieldIds[i], expr,
true);
+
+ if (expr instanceof FunctionHolderExpression) {
+ String funcName = ((FunctionHolderExpression) expr).getName();
+ if (funcName.equals("sum") || funcName.equals("max") ||
funcName.equals("min")) {
+ extraNonNullColumns++;
+ }
+ if (((FunctionCall) ne.getExpr()).args.get(0) instanceof SchemaPath) {
+ columnMapping.put(outputField.getName(), ((SchemaPath)
((FunctionCall) ne.getExpr()).args.get(0)).getAsNamePart().getName());
+ }
Review comment:
When I tested (TestHashAggEmitOutcome) there were cases that did not match
**SchemaPath**.
So I added here:
```
else if (((FunctionCall) ne.getExpr()).args.get(0) instanceof
FunctionCall) {
columnMapping.put(outputField.getName(), ((FunctionCall)
((FunctionCall) ne.getExpr()).args.get(0)).getName());
}
```
The execution did get there, but aI did not check further (e.g., if this was
used right in computing the row size).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services