Github user sachouche commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1060#discussion_r162828788
  
    --- Diff: exec/vector/src/main/codegen/templates/NullableValueVectors.java 
---
    @@ -68,96 +85,441 @@
     
       private final UInt1Vector bits = new UInt1Vector(bitsField, allocator);
       private final ${valuesName} values = new ${minor.class}Vector(field, 
allocator);
    +  private final Mutator mutator      = new MutatorImpl();
    +  private final Accessor accessor    = new AccessorImpl();
    +
    +  <#if type.major == "VarLen" && minor.class == "VarChar">
    +  private final Mutator dupMutator   = new DupValsOnlyMutator();
    +  /** Accessor instance for duplicate values vector */
    +  private final Accessor dupAccessor = new DupValsOnlyAccessor();
    +  /** Optimization for cases where all values are identical */
    +  private boolean duplicateValuesOnly;
    +  /** logical number of values */
    +  private int logicalNumValues;
    +  /** logical value capacity */
    +  private int logicalValueCapacity;
    +  /** Mutator instance for duplicate values vector */
    +
    +  /** true if this vector holds the same value albeit repeated */
    +  public boolean isDuplicateValsOnly() {
    --- End diff --
    
    Tried that (that was my first attempt) but the main issue is that the Drill 
factory creates vectors based on the column metadata alone. This design has the 
advantage of enabling / rolling-back optimizations transparently from the 
consumer. I also made sure there is no performance penalty (or at least 
minimal).


---

Reply via email to