xtdb / xtdb

An immutable database for application development and time-travel data compliance, with SQL and XTQL. Developed by @juxt

Home Page:https://xtdb.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TansferPair doesn't preserve nullability of children in struct vectors.

FiV0 opened this issue · comments

Only changing nullability of struct vector currently also results in the children potentially changing nullability

    @Test
    fun `test non nullability preserved in children` () {
        val intField = Field("int", FieldType.notNullable(MinorType.BIGINT.type), emptyList())
        val structField = Field("my-struct", FieldType.notNullable(STRUCT_TYPE), listOf(intField))
        val vector = structField.createVector(al)

        val newVector = vector
            .getTransferPair(Field(structField.name, FieldType.nullable(structField.type), structField.children), al)
            .also { it.transfer() }
            .to as FieldVector

        // passes
        assertEquals(structField.children[0], intField)
        // fails
        assertEquals(newVector.field.children[0], intField)
    }