diff --git a/src/main/java/net/snowflake/client/core/arrow/EndiannessSwitchVisitor.java b/src/main/java/net/snowflake/client/core/arrow/EndiannessSwitchVisitor.java index 97cd94a20..10d1ca0a4 100644 --- a/src/main/java/net/snowflake/client/core/arrow/EndiannessSwitchVisitor.java +++ b/src/main/java/net/snowflake/client/core/arrow/EndiannessSwitchVisitor.java @@ -19,8 +19,9 @@ import org.apache.arrow.vector.complex.UnionVector; public class EndiannessSwitchVisitor implements VectorVisitor { + private static final byte[] bytes = new byte[64]; + private static void flipBytes(ArrowBuf buf, int offset, int length) { - byte[] bytes = new byte[length]; buf.getBytes(offset, bytes, 0, length); for (int i = 0; i < length / 2; i++) { byte tmp = bytes[i]; diff --git a/src/main/java/net/snowflake/client/jdbc/ArrowResultChunk.java b/src/main/java/net/snowflake/client/jdbc/ArrowResultChunk.java index 25da08e2c..60444e55b 100644 --- a/src/main/java/net/snowflake/client/jdbc/ArrowResultChunk.java +++ b/src/main/java/net/snowflake/client/jdbc/ArrowResultChunk.java @@ -103,9 +103,9 @@ public void readArrowStream(InputStream is) throws IOException { 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());