Skip to content

[Java] Cannot create StructVector with dense-union child #40773

@jarohen

Description

@jarohen

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

I cannot create a StructVector with a dense-union child - it fails with the following stack trace:

java.lang.UnsupportedOperationException: Unknown type: DENSEUNION
	at org.apache.arrow.vector.complex.impl.NullableStructWriter.<init>(NullableStructWriter.java:258)
	at org.apache.arrow.vector.complex.StructVector.<init>(StructVector.java:69)
	at xtdb.vector.StructVectorWriterTest.struct with DUV child(StructVectorWriterTest.kt:101)

Test code is essentially:

Field child = new Field("child", FieldType.notNullable(new ArrowType.Union(UnionMode.Dense, null)), emptyList());
Field struct = new Field("foo", FieldType.notNullable(ArrowType.Struct.INSTANCE), List.of(child));

try(RootAllocator allocator = new RootAllocator();
   StructVector structVec = new StructVector(struct, allocator, null)) {
            
   System.out.println("working!");
}

I suspect it's a case of adding DENSEUNION to the switch in the NullableStructWriter constructor, with a similar implementation to the sparse UNION?

Cheers,

James

Component(s)

Java

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions