drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Rogers (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DRILL-5954) ListVector derives from BaseRepeatedValueVector, shadows offsets
Date Sun, 12 Nov 2017 00:08:00 GMT
Paul Rogers created DRILL-5954:

             Summary: ListVector derives from BaseRepeatedValueVector, shadows offsets
                 Key: DRILL-5954
                 URL: https://issues.apache.org/jira/browse/DRILL-5954
             Project: Apache Drill
          Issue Type: Bug
    Affects Versions: 1.8.0
            Reporter: Paul Rogers
            Assignee: Paul Rogers
            Priority: Minor
             Fix For: 1.13.0

The Drill vector class {{ListVector}} derives from {{BaseRepeatedValueVector}}:

public class ListVector extends BaseRepeatedValueVector {

  private UInt4Vector offsets;

Note that the {{offsets}} member shadows a member of the same type in the super class:

public abstract class BaseRepeatedValueVector ... {

  protected final UInt4Vector offsets;

In Java, shadowing an existing field is considered bad practice as it is never clear which
field any particular bit of code references.

In this case, it appears to be that the {{ListVector}} version is simply a reference to the
base class version. Perhaps because someone didn't understand {{protected}} mode in Java?

  public ListVector(MaterializedField field, BufferAllocator allocator, CallBack callBack)
    offsets = getOffsetVector();

A quick experiment shows that the {{ListVector}} version can simply be removed.

This message was sent by Atlassian JIRA

View raw message