Github user paul-rogers commented on a diff in the pull request:
https://github.com/apache/drill/pull/938#discussion_r137939532
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTableTemplate.java
---
@@ -158,19 +158,17 @@ public BatchHolder(int idx) {
} finally {
if (!success) {
htContainer.clear();
- if (links != null) {
- links.clear();
- }
+ if (links != null) { links.clear();}
}
}
}
private void init(IntVector links, IntVector hashValues, int size) {
for (int i = 0; i < size; i++) {
- links.getMutator().setSafe(i, EMPTY_SLOT);
+ links.getMutator().set(i, EMPTY_SLOT);
--- End diff --
Is size ever less than the vector capacity()? Else, you can just ask the
vector for its capacity.
The `links.getMutator()` call in an inner loop is inefficient.
Instead of a single function initializing two `IntVector`s with redundant
code, can this be refactored to have a function that initializes one vector,
that is called twice?
---