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/12/18 20:32:00 UTC

[jira] [Created] (DRILL-6038) List vector "child" metadata not updated when types added

Paul Rogers created DRILL-6038:
----------------------------------

             Summary: List vector "child" metadata not updated when types added
                 Key: DRILL-6038
                 URL: https://issues.apache.org/jira/browse/DRILL-6038
             Project: Apache Drill
          Issue Type: Bug
    Affects Versions: 1.10.0
            Reporter: Paul Rogers


The obscure {{ListVector}}, like all vectors, provides metadata in the form of a {{MaterializedField}}. The {{MaterializedField}} has a list of children, typically used in maps to describe the fields that make up the map.

{{ListVector}} appears to use the children to describe the members of the list, but does so incorrectly. When a list vector is first created, the metadata describes the fact that the vector has no type:

{noformat}
`a`(LIST:OPTIONAL) [`[DEFAULT]`(LATE:OPTIONAL)]
{noformat}

Lists start out as a list of nothing. But, to do useful work, they must become a list of something by calling {{setChildVector(ValueVector childVector)}}. This method does, in fact, replace the child vector so that the list becomes, say, a list of BIGINT.

But, this method does not update the metadata, it is still as shown above. (A reference search shows that the method is not even called, except in the new code.)

Existing code seems to call {{addOrGetVector()}}, which is awkward for code that wants control over child vector allocation. Further, the code has two bugs:

{code}
      assert field.equals(vector.getField());
{code}

As it turns out, the {{equals()}} method on fields compares equality at the level of Protobuf internal states. What is probably wanted is {{assert field == vector.getField();}} or {{assert field.isEquivalent(vector.getField());}}

{code}
      getField().addChild(field);
{code}

This adds the type to the child list, *but does not remove the default entry*, leading to a list with two children.

Clearly, this code is very seldom used...



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