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

    https://github.com/apache/drill/pull/1001#discussion_r145577107
  
    --- Diff: exec/vector/src/main/codegen/templates/ValueHolders.java ---
    @@ -33,34 +33,40 @@
      * This class is generated using freemarker and the ${.template_name} 
template.
      */
     public final class ${className} implements ValueHolder{
    -  
    +
       public static final MajorType TYPE = 
Types.${mode.name?lower_case}(MinorType.${minor.class?upper_case});
    +  public MajorType getType() {return TYPE;}
     
         <#if mode.name == "Repeated">
    -    
    +
         /** The first index (inclusive) into the Vector. **/
         public int start;
    -    
    +
         /** The last index (exclusive) into the Vector. **/
         public int end;
    -    
    +
         /** The Vector holding the actual values. **/
         public ${minor.class}Vector vector;
    -    
    +
         <#else>
         public static final int WIDTH = ${type.width};
    -    
    +
         <#if mode.name == "Optional">public int isSet;</#if>
         <#assign fields = minor.fields!type.fields />
         <#list fields as field>
         public ${field.type} ${field.name};
         </#list>
    -    
    +
    +    <#if minor.class == "VarChar">
    +    // -1: unknown, 0: not ascii, 1: is ascii
    +    public int asciiMode = -1;
    --- End diff --
    
    Drill is complex, nothing is as it seems. Drill has a very elaborate 
mechanism to rewrite byte codes to do scalar replacement. That is, holders are 
added to the Java source during code generation, but then are removed during 
byte code transforms. (Yes, that is silly given that Java 8 does a fine job on 
its own; but it is how Drill works today...)
    
    Will adding this variable change that behavior? Will the scalar replacement 
logic know to not replace this object? If so, will that hurt performance, or 
with the JVM go ahead and figure it out on its own? Is all the code that sets 
the variable inlined via code generation so that scalar replacement is possible?
    
    Yes, indeed, nothing in Drill is as simple as it seems...


---

Reply via email to