All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xtdb.arrow.FixedSizeBinaryVector.kt Maven / Gradle / Ivy

There is a newer version: 2.0.0-beta4
Show newest version
package xtdb.arrow

import org.apache.arrow.memory.BufferAllocator
import org.apache.arrow.vector.types.pojo.ArrowType
import xtdb.api.query.IKeyFn
import java.nio.ByteBuffer

class FixedSizeBinaryVector(
    al: BufferAllocator,
    override val name: String,
    override var nullable: Boolean,
    byteWidth: Int
) : FixedWidthVector(al, byteWidth) {

    override val arrowType = ArrowType.FixedSizeBinary(byteWidth)

    override fun getBytes(idx: Int): ByteBuffer = getBytes0(idx)

    override fun getObject0(idx: Int, keyFn: IKeyFn<*>) = getByteArray(idx)

    override fun writeObject0(value: Any) = when (value) {
        is ByteBuffer -> writeBytes(value)
        is ByteArray -> writeBytes(ByteBuffer.wrap(value))
        else -> TODO("unknown type: ${value::class.simpleName}")
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy