Github user Ben-Zvi commented on a diff in the pull request:
https://github.com/apache/drill/pull/822#discussion_r122320539
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggTemplate.java
---
@@ -130,6 +127,7 @@
private int currentIndex = 0;
private IterOutcome outcome;
private int numGroupedRecords = 0;
+ private int currentBatchRecordCount = 0; // Performance: Avoid repeated
calls to getRecordCount()
--- End diff --
The getRecordCount() virtual method is called **per each record** ! And in
some cases this method performs several checks. Unfortunately other
inefficiencies indeed dwarf this savings. A local variable won't work, as
execution may return and come back (e.g. spill) midway processing the incoming
batch.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---