Skip to content

Commit

Permalink
Testing with forced visitor swapping
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-astachowski committed Dec 6, 2024
1 parent ceabb50 commit 920c37b
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/main/java/net/snowflake/client/jdbc/ArrowResultChunk.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,25 +95,17 @@ private void addBatchData(List<ValueVector> batch) {
*/
public void readArrowStream(InputStream is) throws IOException {
ArrayList<ValueVector> valueVectors = new ArrayList<>();
Class<?> clazz = ArrowBuf.class;
try {
Field os = clazz.getDeclaredField("osName");
os.setAccessible(true);
os.set(null, "aix");
} catch (NoSuchFieldException | IllegalAccessException e) {
throw new RuntimeException(e);
}
try (ArrowStreamReader reader = new ArrowStreamReader(is, rootAllocator)) {
try (ArrowStreamReader reader = new ArrowStreamReader(is, rootAllocator)) {
root = reader.getVectorSchemaRoot();
while (reader.loadNextBatch()) {
valueVectors = new ArrayList<>();

for (FieldVector f : root.getFieldVectors()) {
// transfer will not copy data but transfer ownership of memory
// from streamReader to resultChunk
if(ByteOrder.nativeOrder().equals(ByteOrder.BIG_ENDIAN)) {
//if(ByteOrder.nativeOrder().equals(ByteOrder.BIG_ENDIAN)) {
f.accept(new EndiannessSwitchVisitor(), null);
}
//}
TransferPair t = f.getTransferPair(rootAllocator);
t.transfer();
valueVectors.add(t.getTo());
Expand Down

0 comments on commit 920c37b

Please sign in to comment.