vibhatha commented on code in PR #40987:
URL: https://github.com/apache/arrow/pull/40987#discussion_r1550607845
##########
java/vector/src/test/java/org/apache/arrow/vector/ipc/BaseFileTest.java:
##########
@@ -109,12 +114,13 @@ public void tearDown() {
}
- private static short [] uint1Values = new short[]{0, 255, 1, 128, 2};
- private static char [] uint2Values = new char[]{0, Character.MAX_VALUE, 1,
Short.MAX_VALUE * 2, 2};
- private static long [] uint4Values = new long[]{0, Integer.MAX_VALUE + 1L,
1, Integer.MAX_VALUE * 2L, 2};
- private static BigInteger[] uint8Values = new
BigInteger[]{BigInteger.valueOf(0),
+ private static final short [] uint1Values = new short[]{0, 255, 1, 128, 2};
+ private static final char [] uint2Values = new char[]{0,
Character.MAX_VALUE, 1, Short.MAX_VALUE * 2, 2};
+ private static final long [] uint4Values = new long[]{0, Integer.MAX_VALUE +
1L, 1, Integer.MAX_VALUE * 2L, 2};
+ private static final BigInteger[] uint8Values = new
BigInteger[]{BigInteger.valueOf(0),
BigInteger.valueOf(Long.MAX_VALUE).multiply(BigInteger.valueOf(2)),
BigInteger.valueOf(2),
BigInteger.valueOf(Long.MAX_VALUE).add(BigInteger.valueOf(1)),
BigInteger.valueOf(2)};
+ private static final UUID[] uuidValues = new UUID[] {UUID.randomUUID(),
UUID.randomUUID(), UUID.randomUUID()};
Review Comment:
nit: Would this guarantee 3 unique values or is it irrelevant here?
##########
java/vector/src/test/java/org/apache/arrow/vector/types/pojo/TestExtensionType.java:
##########
@@ -278,7 +278,7 @@ public void testVectorCompare() {
}
}
- static class UuidType extends ExtensionType {
+ public static class UuidType extends ExtensionType {
Review Comment:
nit: should we add docs, since it's going to be public?
##########
java/vector/src/test/java/org/apache/arrow/vector/ipc/BaseFileTest.java:
##########
@@ -109,12 +114,13 @@ public void tearDown() {
}
- private static short [] uint1Values = new short[]{0, 255, 1, 128, 2};
- private static char [] uint2Values = new char[]{0, Character.MAX_VALUE, 1,
Short.MAX_VALUE * 2, 2};
- private static long [] uint4Values = new long[]{0, Integer.MAX_VALUE + 1L,
1, Integer.MAX_VALUE * 2L, 2};
- private static BigInteger[] uint8Values = new
BigInteger[]{BigInteger.valueOf(0),
+ private static final short [] uint1Values = new short[]{0, 255, 1, 128, 2};
Review Comment:
Thanks for fixing these.
##########
java/vector/src/main/java/org/apache/arrow/vector/ipc/JsonFileReader.java:
##########
@@ -98,10 +100,14 @@ public class JsonFileReader implements AutoCloseable,
DictionaryProvider {
public JsonFileReader(File inputFile, BufferAllocator allocator) throws
JsonParseException, IOException {
super();
this.allocator = allocator;
- MappingJsonFactory jsonFactory = new MappingJsonFactory(new ObjectMapper()
- //ignore case for enums
- .configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS, true)
- );
+ //ignore case for enums
+ ObjectMapper mapper = new
ObjectMapper().configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS, true);
+ mapper.registerSubtypes(
Review Comment:
@danepitkin could you please take a look? Verify this logic?
##########
java/vector/src/test/java/org/apache/arrow/vector/ipc/TestJSONFile.java:
##########
@@ -429,6 +429,27 @@ public void testWriteReadNullJSON() throws IOException {
}
}
+ @Test
+ public void testWriteReadExtensionData() throws IOException {
+ // write
+ try (VectorSchemaRoot root = writeUuidData(allocator)) {
+ File file = new File("target/mytest_extension.json");
+ writeJSON(file, root, null);
+ }
+
+ // read
+ try (BufferAllocator readerAllocator =
allocator.newChildAllocator("reader", 0, Integer.MAX_VALUE);
+ JsonFileReader reader = new JsonFileReader(new
File("target/mytest_extension.json"), readerAllocator)) {
+ Schema schema = reader.start();
+ LOGGER.debug("reading schema: " + schema);
Review Comment:
nit: necessary?
--
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]