Venki Korukanti created DRILL-2088:
--------------------------------------

             Summary: BitVector.Mutator.setValueCount() fails with invalid 
buffer access
                 Key: DRILL-2088
                 URL: https://issues.apache.org/jira/browse/DRILL-2088
             Project: Apache Drill
          Issue Type: Bug
            Reporter: Venki Korukanti


Run the following physical plan:

{code}
{
    head:{
        type:"APACHE_DRILL_PHYSICAL",
        version:"1",
        generator:{
            type:"manual"
        }
    },
    graph:[
        {
            @id:1,
            pop:"mock-scan",
            url: "http://apache.org";,
            entries:[
                {records: 100, types: [
                  {name: "blue", type: "BIT", mode: "REQUIRED"},
                  {name: "red", type: "BIGINT", mode: "REQUIRED"},
                  {name: "green", type: "INT", mode: "OPTIONAL"}
                ]}
            ]
        },
        {
            @id:2,
            child: 1,
            pop:"selection-vector-remover"
        },
        {
            @id: 3,
            child: 2,
            pop: "screen"
        }
    ]
}
{code}

It fails with:

{code}
Failure while running fragment., index: 0, length: 8192 (expected: range(0, 
1024))
{code}

Couple of issues:
1. We don't transfer valueCapacity as part of TransferPair.transfer(). This 
causes the vector that got the buffers to have 0 as valueCapacity. During the 
realloc of vector that got the buffer, we rely on valueCapacity to decide 
whether to realloc or not.

2. When BitVector.Mutator.setValueCount() is called we try to reallocate the 
buffer as the valueCapacity is zero. As part of realloc, we allocate a buffer 
of size 1028bytes and try to copy the existing buffer. Problem is existing 
buffer has size more than 1028bytes and we fail in copying. 




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to