Can't create a StructVector with a NullVector child

Open
#690 1 comment 0 reactions 1 assignee View on GitHub

@jbonofre is already working on this.

Since Mar 24, 2025.

Assessment

This issue has not been assessed yet.

Description

Type: bug
Describe the bug, including details regarding any error messages, version, and platform.

repro (against 18.1.0):

    @Test
    public void testStructWithNullVectorChild() {
        var field = new Field(
                "foo", FieldType.notNullable(ArrowType.Struct.INSTANCE),
                List.of(
                        new Field("null", FieldType.nullable(ArrowType.Null.INSTANCE), List.of())
                )
        );
        try (var al = new RootAllocator()) {
            try (var vec = new StructVector(field, al, null)) {
                // boom
            }
        }
    }

error:

Unknown type: NULL
java.lang.UnsupportedOperationException: Unknown type: NULL
	at org.apache.arrow.vector.complex.impl.NullableStructWriter.<init>(NullableStructWriter.java:279)
	at org.apache.arrow.vector.complex.StructVector.<init>(StructVector.java:74)
	at xtdb.api.XtdbHelloWorldTest.testStructWithNullVectorChild(XtdbHelloWorldTest.java:58)

Context here is that I'm actually calling vec.getTransferPair(field, al) on an existing vector, but the above is a more minimal repro

Cheers folks!

James

Dominant language
Java
Stars
95
Forks
154
Avg merge
2d 10h
Merged PRs (30d)
11

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/arrow-java

All issues in apache/arrow-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.