xxlaykxx commented on code in PR #726:
URL: https://github.com/apache/arrow-java/pull/726#discussion_r2164297997
##########
vector/src/test/java/org/apache/arrow/vector/complex/writer/TestComplexWriter.java:
##########
@@ -2489,4 +2494,35 @@ public void unionWithVarCharAndBinaryHelpers() throws
Exception {
"row12", new String(vector.getLargeVarBinaryVector().get(11),
StandardCharsets.UTF_8));
}
}
+
+ @Test
+ public void extensionWriterReader() throws Exception {
+ // test values
+ UUID u1 = UUID.randomUUID();
+
+ try (NonNullableStructVector parent =
NonNullableStructVector.empty("parent", allocator)) {
+ // write
+
+ ComplexWriter writer = new ComplexWriterImpl("root", parent);
+ StructWriter rootWriter = writer.rootAsStruct();
+
+ {
+ ExtensionWriter extensionWriter = rootWriter.extension("uuid1", new
UuidType());
+ extensionWriter.setPosition(0);
+ extensionWriter.addExtensionTypeWriterFactory(new UuidWriterFactory());
+ extensionWriter.writeExtension(u1);
+ }
+ // read
+ StructReader rootReader = new
SingleStructReaderImpl(parent).reader("root");
+ {
+ FieldReader uuidReader = rootReader.reader("uuid1");
+ uuidReader.setPosition(0);
+ UuidHolder uuidHolder = new UuidHolder();
+ uuidReader.read(uuidHolder);
Review Comment:
added tests with read and copyAsValue usage.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]