Class DatabricksBufferAllocator

  • All Implemented Interfaces:
    AutoCloseable, org.apache.arrow.memory.BufferAllocator

    public class DatabricksBufferAllocator
    extends Object
    implements org.apache.arrow.memory.BufferAllocator
    A BufferAllocator implementation that uses DatabricksArrowBuf for memory allocation. This allocator uses heap-based ByteBuffer storage instead of direct/off-heap memory, avoiding the need for sun.misc.Unsafe operations.

    This implementation is suitable for environments where direct memory access is restricted or where heap-based memory management is preferred.

    • Constructor Detail

      • DatabricksBufferAllocator

        public DatabricksBufferAllocator()
        Creates a root allocator with default settings.
      • DatabricksBufferAllocator

        public DatabricksBufferAllocator​(String name)
        Creates a root allocator with specified limit.
        Parameters:
        name - the allocator name
      • DatabricksBufferAllocator

        public DatabricksBufferAllocator​(String name,
                                         DatabricksBufferAllocator parent)
        Creates an allocator with full configuration.
        Parameters:
        name - the allocator name
        parent - the parent allocator (null for root)
    • Method Detail

      • buffer

        public ArrowBuf buffer​(long size)
        Specified by:
        buffer in interface org.apache.arrow.memory.BufferAllocator
      • buffer

        public ArrowBuf buffer​(long size,
                               org.apache.arrow.memory.BufferManager manager)
        Specified by:
        buffer in interface org.apache.arrow.memory.BufferAllocator
      • getRoot

        public org.apache.arrow.memory.BufferAllocator getRoot()
        Specified by:
        getRoot in interface org.apache.arrow.memory.BufferAllocator
      • newChildAllocator

        public org.apache.arrow.memory.BufferAllocator newChildAllocator​(String name,
                                                                         long initReservation,
                                                                         long maxAllocation)
        Specified by:
        newChildAllocator in interface org.apache.arrow.memory.BufferAllocator
      • newChildAllocator

        public org.apache.arrow.memory.BufferAllocator newChildAllocator​(String name,
                                                                         org.apache.arrow.memory.AllocationListener listener,
                                                                         long initReservation,
                                                                         long maxAllocation)
        Specified by:
        newChildAllocator in interface org.apache.arrow.memory.BufferAllocator
      • close

        public void close()
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface org.apache.arrow.memory.BufferAllocator
      • getAllocatedMemory

        public long getAllocatedMemory()
        Specified by:
        getAllocatedMemory in interface org.apache.arrow.memory.BufferAllocator
      • getLimit

        public long getLimit()
        Specified by:
        getLimit in interface org.apache.arrow.memory.BufferAllocator
      • getInitReservation

        public long getInitReservation()
        Specified by:
        getInitReservation in interface org.apache.arrow.memory.BufferAllocator
      • setLimit

        public void setLimit​(long newLimit)
        Specified by:
        setLimit in interface org.apache.arrow.memory.BufferAllocator
      • getPeakMemoryAllocation

        public long getPeakMemoryAllocation()
        Specified by:
        getPeakMemoryAllocation in interface org.apache.arrow.memory.BufferAllocator
      • getHeadroom

        public long getHeadroom()
        Specified by:
        getHeadroom in interface org.apache.arrow.memory.BufferAllocator
      • forceAllocate

        public boolean forceAllocate​(long size)
        Specified by:
        forceAllocate in interface org.apache.arrow.memory.BufferAllocator
      • releaseBytes

        public void releaseBytes​(long size)
        Specified by:
        releaseBytes in interface org.apache.arrow.memory.BufferAllocator
      • getListener

        public org.apache.arrow.memory.AllocationListener getListener()
        Specified by:
        getListener in interface org.apache.arrow.memory.BufferAllocator
      • getParentAllocator

        public org.apache.arrow.memory.BufferAllocator getParentAllocator()
        Specified by:
        getParentAllocator in interface org.apache.arrow.memory.BufferAllocator
      • getChildAllocators

        public Collection<org.apache.arrow.memory.BufferAllocator> getChildAllocators()
        Specified by:
        getChildAllocators in interface org.apache.arrow.memory.BufferAllocator
      • newReservation

        public org.apache.arrow.memory.AllocationReservation newReservation()
        Specified by:
        newReservation in interface org.apache.arrow.memory.BufferAllocator
      • getEmpty

        public ArrowBuf getEmpty()
        Specified by:
        getEmpty in interface org.apache.arrow.memory.BufferAllocator
      • getName

        public String getName()
        Specified by:
        getName in interface org.apache.arrow.memory.BufferAllocator
      • isOverLimit

        public boolean isOverLimit()
        Specified by:
        isOverLimit in interface org.apache.arrow.memory.BufferAllocator
      • toVerboseString

        public String toVerboseString()
        Specified by:
        toVerboseString in interface org.apache.arrow.memory.BufferAllocator
      • assertOpen

        public void assertOpen()
        Specified by:
        assertOpen in interface org.apache.arrow.memory.BufferAllocator
      • getRoundingPolicy

        public org.apache.arrow.memory.rounding.RoundingPolicy getRoundingPolicy()
        Specified by:
        getRoundingPolicy in interface org.apache.arrow.memory.BufferAllocator
      • wrapForeignAllocation

        public ArrowBuf wrapForeignAllocation​(org.apache.arrow.memory.ForeignAllocation allocation)
        Specified by:
        wrapForeignAllocation in interface org.apache.arrow.memory.BufferAllocator