Skip to content

Commit 6a4a1b3

Browse files
committed
Avoid mutating the value of byte buffer literal
1 parent 0b4ef10 commit 6a4a1b3

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

api/src/main/java/org/apache/iceberg/expressions/SerializationProxies.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.io.ObjectStreamException;
2222
import java.io.Serializable;
2323
import java.nio.ByteBuffer;
24+
import java.nio.ByteOrder;
2425

2526
/**
2627
* Stand-in classes for expression classes in Java Serialization.
@@ -92,7 +93,8 @@ static class BoundingBoxLiteralProxy extends FixedLiteralProxy {
9293

9394
@Override
9495
Object readResolve() throws ObjectStreamException {
95-
return new Literals.BoundingBoxLiteral(ByteBuffer.wrap(bytes()));
96+
return new Literals.BoundingBoxLiteral(
97+
ByteBuffer.wrap(bytes()).order(ByteOrder.LITTLE_ENDIAN));
9698
}
9799
}
98100
}

api/src/main/java/org/apache/iceberg/expressions/UnboundPredicate.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
package org.apache.iceberg.expressions;
2020

2121
import java.nio.ByteBuffer;
22-
import java.nio.ByteOrder;
2322
import java.util.List;
2423
import java.util.Locale;
2524
import java.util.Set;
@@ -292,7 +291,6 @@ public String toString() {
292291
case ST_DISJOINT:
293292
{
294293
ByteBuffer serializedBoundingBox = (ByteBuffer) literal().value();
295-
serializedBoundingBox.order(ByteOrder.LITTLE_ENDIAN);
296294
BoundingBox boundingBox = BoundingBox.fromByteBuffer(serializedBoundingBox);
297295
String functionName = op().name().toLowerCase(Locale.ROOT);
298296
return functionName + "(" + term() + ", " + boundingBox + ")";

0 commit comments

Comments
 (0)