You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "FiV0 (via GitHub)" <gi...@apache.org> on 2024/11/26 19:13:55 UTC
[I] [Java] StructVector throws with ExtensionType [arrow-java]
FiV0 opened a new issue, #87:
URL: https://github.com/apache/arrow-java/issues/87
### Describe the bug, including details regarding any error messages, version, and platform.
Currently when creating a struct vector with a child being an extension type things throw:
```java
@Test
public void testStructVectorWithExtensionTypes() {
TestExtensionType.UuidType uuidType = new TestExtensionType.UuidType();
Field uuidField = new Field("struct_child", FieldType.nullable(uuidType), null);
Field structField = new Field("struct", FieldType.nullable(new ArrowType.Struct()), List.of(uuidField));
// throws
StructVector s1 = new StructVector(structField, allocator, null);
// doesn't throw
StructVector s2 = (StructVector) structField.createVector(allocator);
s1.close();
s2.close();
}
```
I am mainly running into this while trying to create a `TransferPair`.
```java
@Test
public void testStructVectorTransferPairWithExtensionType() {
TestExtensionType.UuidType uuidType = new TestExtensionType.UuidType();
Field uuidField = new Field("uuid_child", FieldType.nullable(uuidType), null);
Field structField = new Field("struct", FieldType.nullable(new ArrowType.Struct()), List.of(uuidField));
StructVector s1 = (StructVector) structField.createVector(allocator);
TestExtensionType.UuidVector uuidVector = s1.addOrGet("uuid_child", FieldType.nullable(uuidType), TestExtensionType.UuidVector.class);
s1.setValueCount(1);
uuidVector.set(0, new UUID(1, 2));
s1.setIndexDefined(0);
TransferPair tp = s1.getTransferPair(structField, allocator);
final StructVector toVector = (StructVector) tp.getTo();
assertEquals(s1.getField(), toVector.getField());
assertEquals(s1.getField().getChildren().get(0), toVector.getField().getChildren().get(0));
// also fails but probably another issue
// assertEquals(s1.getValueCount(), toVector.getValueCount());
// assertEquals(s1, toVector);
s1.close();
toVector.close();
}
```
### Component(s)
Java
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org