Skip to content

Commit

Permalink
fix: initial functional archery test
Browse files Browse the repository at this point in the history
  • Loading branch information
vibhatha committed Jun 18, 2024
1 parent bf0f6fd commit ab51fb1
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 199 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package org.apache.arrow.tools;

import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.File;
Expand Down Expand Up @@ -153,15 +154,15 @@ static void write(FieldVector parent, File file) throws IOException {

static void writeInput(File testInFile, BufferAllocator allocator) throws IOException {
try (BufferAllocator vectorAllocator =
allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE);
allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE);
NonNullableStructVector parent = NonNullableStructVector.empty("parent", vectorAllocator)) {
writeData(COUNT, parent);
write(parent.getChild("root"), testInFile);
}
}

static void writeVariableWidthViewInput(File testInFile, BufferAllocator allocator, int count)
throws FileNotFoundException, IOException {
throws IOException {
try (BufferAllocator vectorAllocator =
allocator.newChildAllocator("original view vectors", 0, Integer.MAX_VALUE);
NonNullableStructVector parent = NonNullableStructVector.empty("parent", vectorAllocator)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import org.apache.arrow.vector.complex.writer.BigIntWriter;
import org.apache.arrow.vector.complex.writer.Float8Writer;
import org.apache.arrow.vector.complex.writer.IntWriter;
import org.apache.commons.cli.ParseException;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -350,9 +349,9 @@ public void testInvalid() throws Exception {
}

@Test
public void testJSONRoundTripWithVariableWidthView() throws Exception {
public void testValidateVariableWidthView() throws Exception {
final int valueCount = 256;
final int multiplier = 1;
final int multiplier = 2;

for (int i = 1; i < multiplier; i++) {
File testInFile = new File(testFolder, "testIn.arrow");
Expand Down Expand Up @@ -404,41 +403,4 @@ public void testJSONRoundTripWithVariableWidthView() throws Exception {
integration.run(args3);
}
}

@Test
public void t2() throws ParseException, IOException {
File testInFile =
new File(
"/home/vibhatha/Documents/Work/Apache_Arrow/json_readers/failures/java_producing.arrow");
File testJSONFile = new File(testFolder, "testOut.json");
testJSONFile.delete();
File testOutFile = new File(testFolder, "testOut.arrow");
testOutFile.delete();

System.out.println(testJSONFile.getAbsolutePath());

Integration integration = new Integration();

// convert it to json
String[] args1 = {
"-arrow",
testInFile.getAbsolutePath(),
"-json",
testJSONFile.getAbsolutePath(),
"-command",
Command.ARROW_TO_JSON.name()
};
integration.run(args1);

// convert back to arrow
String[] args2 = {
"-arrow",
testOutFile.getAbsolutePath(),
"-json",
testJSONFile.getAbsolutePath(),
"-command",
Command.JSON_TO_ARROW.name()
};
integration.run(args2);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1761,8 +1761,7 @@ public void exportCDataBuffers(List<ArrowBuf> buffers, ArrowBuf buffersPtr, long
* @param index position of the element in the vector
* @return array of bytes
*/
public static byte[] get(
final ArrowBuf viewBuffer, final List<ArrowBuf> dataBuffers, int index, boolean isView) {
public static byte[] get(final ArrowBuf viewBuffer, final List<ArrowBuf> dataBuffers, int index) {
final int dataLength = viewBuffer.getInt((long) index * ELEMENT_SIZE);
byte[] result = new byte[dataLength];
if (dataLength > INLINE_SIZE) {
Expand Down
Loading

0 comments on commit ab51fb1

Please sign in to comment.