[ 
https://issues.apache.org/jira/browse/DRILL-5954?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul Rogers resolved DRILL-5954.
--------------------------------
    Resolution: Fixed

Fixed in a prior commit.

> ListVector shadows "offsets" from BaseRepeatedValueVector
> ---------------------------------------------------------
>
>                 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
>
> 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
(v7.6.3#76005)

Reply via email to