apache / apache/arrow-java

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

未关闭
#830 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
Type: bug
主要语言
Java
星标
94
派生
152
平均合并
3 天 16 小时
30 天内合并 PR
11

描述

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

added test case to TestStructVector:

```java

@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.(NullableStructWriter.java:279)
at org.apache.arrow.vector.complex.StructVector.(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

贡献指南

打开贡献指南

调研方向

从 TestStructVector.testStructVectorTransferPairWithNullType 开始,并将其与 testStructVectorTransferPairWithExtensionType 进行比较。跟踪 StructVector.getTransferPair 到 StructVector.java 和 NullableStructWriter.java,然后运行针对性的 TestStructVector 测试;当包含 NullVector 的 struct 能够在不出现 Unknown type: NULL 异常的情况下完成传输,并且回归测试通过时,即完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
data
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
58/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。