From 5b77567acf9947708f350d10ac59c825ce392884 Mon Sep 17 00:00:00 2001 From: zyguan Date: Mon, 24 Apr 2023 06:14:52 +0000 Subject: [PATCH] discard the extended checksum part in row values Signed-off-by: zyguan --- src/main/java/org/tikv/common/codec/RowV2.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/tikv/common/codec/RowV2.java b/src/main/java/org/tikv/common/codec/RowV2.java index 6893894a7b..b61718fd67 100644 --- a/src/main/java/org/tikv/common/codec/RowV2.java +++ b/src/main/java/org/tikv/common/codec/RowV2.java @@ -78,6 +78,7 @@ private void fromBytes(byte[] rowData) { this.numNotNullCols = cdi.readUnsignedShort(); this.numNullCols = cdi.readUnsignedShort(); int cursor = 6; + int dataLen = 0; if (this.large) { int numCols = this.numNotNullCols + this.numNullCols; int colIDsLen = numCols * 4; @@ -93,6 +94,9 @@ private void fromBytes(byte[] rowData) { this.offsets32[i] = cdi.readInt(); } cursor += offsetsLen; + if (numCols > 0) { + dataLen = this.offsets[numCols - 1]; + } } else { int numCols = this.numNotNullCols + this.numNullCols; int colIDsLen = numCols; @@ -106,8 +110,11 @@ private void fromBytes(byte[] rowData) { this.offsets[i] = cdi.readUnsignedShort(); } cursor += offsetsLen; + if (numCols > 0) { + dataLen = this.offsets[numCols - 1]; + } } - this.data = Arrays.copyOfRange(rowData, cursor, rowData.length); + this.data = Arrays.copyOfRange(rowData, cursor, cursor + dataLen); } private void writeShortArray(CodecDataOutput cdo, int[] arr) {