Github user paul-rogers commented on a diff in the pull request:
https://github.com/apache/drill/pull/1144#discussion_r179022338
--- Diff: exec/vector/src/main/codegen/templates/VariableLengthVectors.java
---
@@ -534,15 +534,11 @@ public void setSafe(int index, byte[] bytes) {
assert index >= 0;
final int currentOffset = offsetVector.getAccessor().get(index);
- offsetVector.getMutator().setSafe(index + 1, currentOffset +
bytes.length);
- try {
- data.setBytes(currentOffset, bytes, 0, bytes.length);
- } catch (IndexOutOfBoundsException e) {
- while (data.capacity() < currentOffset + bytes.length) {
- reAlloc();
- }
- data.setBytes(currentOffset, bytes, 0, bytes.length);
+ while (data.capacity() < currentOffset + bytes.length) {
--- End diff --
If we compare this implementation to the one from, say, a year or 18 months
ago, I think we're back where we started.
This would actually be a good use case for a "checkedSetBytes" method that
does the bounds checks. Still, whether done here or in the underlying method,
the `if` statement is needed, so no savings in using a "checked" method,
---