File tree Expand file tree Collapse file tree
parquet-column/src/main/java/org/apache/parquet/column/values/deltastrings Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ public String memUsageString(String prefix) {
8989
9090 @ Override
9191 public void writeBytes (Binary v ) {
92- byte [] vb = v .getBytesUnsafe ();
92+ byte [] vb = v .isBackingBytesReused () ? v . getBytes () : v . getBytesUnsafe ();
9393 int length = Math .min (previous .length , vb .length );
9494 // Find the number of matching prefix bytes between this value and the previous one.
9595 // Arrays.mismatch is intrinsified by the JVM to use SIMD instructions.
@@ -99,9 +99,6 @@ public void writeBytes(Binary v) {
9999 }
100100 prefixLengthWriter .writeInteger (i );
101101 suffixWriter .writeBytes (v .slice (i , vb .length - i ));
102- // Retain an owned copy for prefix comparison with the next value.
103- // getBytesUnsafe() may return the backing array directly, so we must copy
104- // if the Binary's backing bytes may be reused by the caller.
105- previous = v .isBackingBytesReused () ? v .getBytes () : vb ;
102+ previous = vb ;
106103 }
107104}
You can’t perform that action at this time.
0 commit comments