You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by bitblender <gi...@git.apache.org> on 2017/06/19 15:18:52 UTC

[GitHub] drill pull request #840: DRILL-5517: Size-aware set methods in value vectors

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

    https://github.com/apache/drill/pull/840#discussion_r122526465
  
    --- Diff: exec/vector/src/main/codegen/templates/FixedValueVectors.java ---
    @@ -806,10 +998,32 @@ public void generateTestDataAlt(int size) {
         }
     
       </#if> <#-- type.width -->
    +    /**
    +     * Backfill missing offsets from the given last written position to the
    +     * given current write position. Used by the "new" size-safe column
    +     * writers to allow skipping values. The <tt>set()</tt> and <tt>setSafe()</tt>
    +     * <b>do not</b> fill empties. See DRILL-5529 and DRILL-xxxx.
    +     * @param lastWrite the position of the last valid write: the offset
    +     * to be copied forward
    +     * @param index the current write position filling occurs up to,
    +     * but not including, this position
    +     */
    +
    +    public void fillEmptiesBounded(int lastWrite, int index)
    +            throws VectorOverflowException {
    +      for (int i = lastWrite; i < index; i++) {
    +    <#if type.width <= 8>
    --- End diff --
    
    You can avoid an extra op in the loop by adjusting the bounds of the induction variable. The compiler's  induction variable analysis might automatically figure this one out.
    
    public void fillEmptiesBounded(int lastWrite, int index)
                throws VectorOverflowException {
          for (int i = lastWrite + 1; i <= index; i++) {
            setSafe(i, (int) 0);                                            <-- one less addition in the loop and less register pressure
          }
        }


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