You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by "Paul Rogers (JIRA)" <ji...@apache.org> on 2017/11/12 00:08:00 UTC

[jira] [Created] (DRILL-5954) ListVector derives from BaseRepeatedValueVector, shadows offsets

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}}:

{code}
public class ListVector extends BaseRepeatedValueVector {

  private UInt4Vector offsets;
...
{code}

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

{code}
public abstract class BaseRepeatedValueVector ... {

  protected final UInt4Vector offsets;
...
{code}

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?

{code}
  public ListVector(MaterializedField field, BufferAllocator allocator, CallBack callBack) {
    ...
    offsets = getOffsetVector();
...
{code}

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



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)