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

    https://github.com/apache/drill/pull/984#discussion_r145556819
  
    --- Diff: exec/vector/src/main/codegen/templates/FixedValueVectors.java ---
    @@ -908,6 +908,15 @@ public void generateTestData(int count) {
         }
     
       <#else> <#-- type.width <= 8 -->
    +    @Override
    +    public void add(Object value) {
    +      int index = accessor.getValueCount();
    +      int valueCount = index + 1;
    +      setValueCount(valueCount);
    +
    +      set(index, (${type.javaType}) value);
    --- End diff --
    
    I don't think this will work as you hope it will -- for obscure reasons 
that we've all learned the hard way...
    
    * The accessor does not keep an ongoing count of values. Rather, the value 
count comes from the writer index which is set only at the end of a write.
    * This method sets the value count, but doing so is, in general, expensive.
    * Vectors in a batch must be kept in sync. This adds a value to one vector, 
but does not coordinate across a set of vectors.
    * Not all values can be set by casting. Works for some numeric values, but 
does not handle, say, `add(10)` when the item is a byte or a short because of 
the need for a two-step cast: `(byte)(int) value`.
    * Does not handle conversions for date or decimal.
    
    Yes, this is all a colossal pain in the neck. But, it is the reason that 
the `RowSet` classes were created.
    
    We can talk in person about how to move this idea forward effectively.


---

Reply via email to