Oleg Zinoviev created DRILL-7355:
------------------------------------

             Summary: Reading a offset based vectors into holder may produce 
IndexOutOfBoundsException
                 Key: DRILL-7355
                 URL: https://issues.apache.org/jira/browse/DRILL-7355
             Project: Apache Drill
          Issue Type: Bug
    Affects Versions: 1.16.0
         Environment: Stack trace:

Caused by: java.lang.IndexOutOfBoundsException: index: 17, length: -799 
(expected: range(0, 524288))
        at 
io.netty.buffer.AbstractByteBuf.checkIndex0(AbstractByteBuf.java:1125)
        at io.netty.buffer.AbstractByteBuf.checkIndex(AbstractByteBuf.java:1120)
        at 
io.netty.buffer.PooledUnsafeDirectByteBuf.nioBuffer(PooledUnsafeDirectByteBuf.java:244)
        at io.netty.buffer.WrappedByteBuf.nioBuffer(WrappedByteBuf.java:734)
        at 
io.netty.buffer.UnsafeDirectLittleEndian.nioBuffer(UnsafeDirectLittleEndian.java:34)
        at io.netty.buffer.DrillBuf.nioBuffer(DrillBuf.java:364)
        at 
org.apache.drill.exec.store.ParquetOutputRecordWriter$VarCharParquetConverter.writeField(ParquetOutputRecordWriter.java:1824)
        at 
org.apache.drill.exec.store.EventBasedRecordWriter.write(EventBasedRecordWriter.java:48)
        at 
org.apache.drill.exec.physical.impl.WriterRecordBatch.innerNext(WriterRecordBatch.java:111)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:186)
        at 
org.apache.drill.exec.physical.impl.BaseRootExec.next(BaseRootExec.java:104)
        at 
org.apache.drill.exec.physical.impl.SingleSenderCreator$SingleSenderRootExec.innerNext(SingleSenderCreator.java:93)
        at 
org.apache.drill.exec.physical.impl.BaseRootExec.next(BaseRootExec.java:94)
        at 
org.apache.drill.exec.work.fragment.FragmentExecutor$1.run(FragmentExecutor.java:296)
        at 
org.apache.drill.exec.work.fragment.FragmentExecutor$1.run(FragmentExecutor.java:283)
            Reporter: Oleg Zinoviev


Var16Char, VarBinary, VarChar and VarDecimal vectors contain a UInt4 offset 
vector. When reading values into the corresponding holder, the values of their 
offset vectors are written into the "start" and "end" fields as ordinary 
integers. In the subsequent operations is not considered that originally this 
values were unsigned integers and (for example in the calculation of the buffer 
size at ParquetOutputRecordWriter) usual subtraction "end" - "start" used. This 
causes the target buffer size to be negative. 



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to