Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/901#discussion_r132824832
  
    --- Diff: 
exec/vector/src/main/java/org/apache/drill/exec/vector/BaseValueVector.java ---
    @@ -133,5 +134,21 @@ public static boolean checkBufRefs(final ValueVector 
vv) {
       public BufferAllocator getAllocator() {
         return allocator;
       }
    +
    +  public static void fillBitsVector(UInt1Vector bits, int valueCount) {
    +
    +    // Create a new bits vector, all values non-null
    +
    +    bits.allocateNew(valueCount);
    +    UInt1Vector.Mutator bitsMutator = bits.getMutator();
    +    for (int i = 0; i < valueCount; i++) {
    +      bitsMutator.set(i, 1);
    +    }
    --- End diff --
    
    Sadly, Netty's `PlatformDependent` provides no equivalent of `memset`. Some 
tricks we could do, if tests show we have a performance issue:
    
    * Use `setLong()` to write the value 0x01010101010101L every 8 values, with 
bytes for the last < 8 values.
    * Create a heap buffer of some length n, filled with 0x01, and do a copy 
from that buffer to the direct memory, as many times as needed.
    
    Since both of these will make the code much more complex, let's measure to 
see the cost of the simple solution before we try them.
    
    Also, at a higher level, we should not even need this trick. A 
properly-designed value vector hierarchy would treat a non-nullable vector as a 
nullable vector that always returns `false` for `isNull()`. This is what the 
new readers do and it vastly simplifies the code.
    
    Sometimes it helps to go back to basics and remember Abstractions 101: 
well-designed abstractions are our friend.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to