'Unknown type: NULL' when initialising a NullableStructWriter from a struct with NullVector children

Open
#830 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
58/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
java
Domain
data

Research direction

Start with TestStructVector.testStructVectorTransferPairWithNullType and compare it with testStructVectorTransferPairWithExtensionType. Trace StructVector.getTransferPair into StructVector.java and NullableStructWriter.java, then run the focused TestStructVector tests; done when a struct containing a NullVector transfers without the Unknown type: NULL exception and the regression test passes.

Written by the indexing model from the issue text.

Description

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

added test case to TestStructVector:


  @Test
  public void testStructVectorTransferPairWithNullType() {
    Field uuidField = new Field("null", FieldType.nullable(ArrowType.Null.INSTANCE), null);
    Field structField =
            new Field("struct", FieldType.nullable(new ArrowType.Struct()), List.of(uuidField));

    try(StructVector s1 = (StructVector) structField.createVector(allocator)) {
        NullVector nullVector =
                s1.addOrGet("null", FieldType.nullable(ArrowType.Null.INSTANCE), NullVector.class);
        s1.setValueCount(1);
        nullVector.setNull(0);
        s1.setIndexDefined(0);

        TransferPair tp = s1.getTransferPair(structField, allocator);
        try (StructVector toVector = (StructVector) tp.getTo()) {
            assertEquals(s1.getField(), toVector.getField());
        }
    }
  }

got this:

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 org.apache.arrow.vector.complex.StructVector.getTransferPair(StructVector.java:261)
	at org.apache.arrow.vector.TestStructVector.testStructVectorTransferPairWithNullType(TestStructVector.java:389)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)

expected: similar result to testStructVectorTransferPairWithExtensionType

Cheers!

James

our issue: xtdb/xtdb#4693

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.