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

[jira] [Updated] (DRILL-5954) ListVector shadows "offsets" from BaseRepeatedValueVector

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

Paul Rogers updated DRILL-5954:
-------------------------------
    Summary: ListVector shadows "offsets" from BaseRepeatedValueVector  (was: ListVector derives from BaseRepeatedValueVector, shadows offsets)

> 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
>             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)