Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-1478

[JAVA] clear should release the buffer only if the buffer is not NULL



    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Java
    • Labels:


      In some cases we use a fake allocator in Dremio for the purpose of field materialization only. The buffers of the underlying vectors are not allocated. Fake allocator is a simple implementation of BufferAllocator interface where almost every method throws UnsupportedOperation exception and methods like getEmpty() return NULL.

      It is more like a pass-through mechanism that allows us to be able to instantiate a vector using a non-functional allocator since the constructors in vector code don't allow for the allocator itself to be NULL.

      Portions of code where we have this scenario are generic in nature and so have typical methods like close() / clear() which underneath invoke the corresponding methods on vectors.

      The clear() method in BaseDataValueVector releases the data buffer without checking if the buffer is NULL and that's where callers hit NPE.

      We don't see such problems in Arrow unit tests. My guess is that when a vector is instantiated, the buffer is still probably a valid reference returned through allocator.getEmpty() call in the constructor of BaseDataValueVector.




            • Assignee:
              siddteotia Siddharth Teotia
              siddteotia Siddharth Teotia
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: