From d45b26386c7aa884244a6ef4e6aad7a07bee9c04 Mon Sep 17 00:00:00 2001 From: shiyuhang0 <52435083+shiyuhang0@users.noreply.github.com> Date: Fri, 25 Feb 2022 18:13:34 +0800 Subject: [PATCH 1/6] fix bit to long bug Signed-off-by: shiyuhang <1136742008@qq.com> --- src/main/java/org/tikv/common/columnar/TiChunkColumnVector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/tikv/common/columnar/TiChunkColumnVector.java b/src/main/java/org/tikv/common/columnar/TiChunkColumnVector.java index 2ffa1028530..96e0b5c68a4 100644 --- a/src/main/java/org/tikv/common/columnar/TiChunkColumnVector.java +++ b/src/main/java/org/tikv/common/columnar/TiChunkColumnVector.java @@ -178,7 +178,7 @@ private long getLongFromBinary(int rowId) { if (bytes.length == 0) return 0; long result = 0; for (byte b : bytes) { - result = (result << 8) | b; + result = (result << 8) | (b & 0xff); } return result; } From e06928478f13a23e06f165abb9be0fabed1d32db Mon Sep 17 00:00:00 2001 From: shiyuhang <1136742008@qq.com> Date: Mon, 28 Feb 2022 13:05:15 +0800 Subject: [PATCH 2/6] [fix #537]add unit test Signed-off-by: shiyuhang <1136742008@qq.com> --- .../org/tikv/common/columnar/TiChunkColumnVectorTest.java | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/test/java/org/tikv/common/columnar/TiChunkColumnVectorTest.java diff --git a/src/test/java/org/tikv/common/columnar/TiChunkColumnVectorTest.java b/src/test/java/org/tikv/common/columnar/TiChunkColumnVectorTest.java new file mode 100644 index 00000000000..9397fc9a9a8 --- /dev/null +++ b/src/test/java/org/tikv/common/columnar/TiChunkColumnVectorTest.java @@ -0,0 +1,4 @@ +import junit.framework.TestCase; +public class TiChunkColumnVectorTest extends TestCase { + +} \ No newline at end of file From b4c6666e8eca9d352964ee3a955a5854f8757b3c Mon Sep 17 00:00:00 2001 From: shiyuhang <1136742008@qq.com> Date: Mon, 28 Feb 2022 13:06:38 +0800 Subject: [PATCH 3/6] [fix #537]add unit test Signed-off-by: shiyuhang <1136742008@qq.com> --- .../columnar/TiChunkColumnVectorTest.java | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/tikv/common/columnar/TiChunkColumnVectorTest.java b/src/test/java/org/tikv/common/columnar/TiChunkColumnVectorTest.java index 9397fc9a9a8..caac16f1e86 100644 --- a/src/test/java/org/tikv/common/columnar/TiChunkColumnVectorTest.java +++ b/src/test/java/org/tikv/common/columnar/TiChunkColumnVectorTest.java @@ -1,4 +1,24 @@ +package org.tikv.common.columnar; + +import static org.tikv.common.types.MySQLType.TypeBit; + +import java.nio.ByteBuffer; import junit.framework.TestCase; +import org.junit.Assert; +import org.junit.Test; +import org.tikv.common.types.BitType; +import org.tikv.common.types.DataType; +import org.tikv.common.types.MySQLType; + public class TiChunkColumnVectorTest extends TestCase { - -} \ No newline at end of file + + @Test + public void testGetLong() { + long expect = 32767; + ByteBuffer buffer = ByteBuffer.allocate(8); + buffer.putLong(expect); + TiChunkColumnVector tiChunkColumnVector = new TiChunkColumnVector( + BitType.BIT, -1, 1, 0, new byte[]{-1}, new long[]{0, 8}, buffer); + Assert.assertEquals(expect, tiChunkColumnVector.getLong(0)); + } +} From 6a96d17f2871d51ecb463c31c7aa1d425baffdfd Mon Sep 17 00:00:00 2001 From: shiyuhang <1136742008@qq.com> Date: Mon, 28 Feb 2022 13:08:32 +0800 Subject: [PATCH 4/6] [fix #537] delete unused import Signed-off-by: shiyuhang <1136742008@qq.com> --- .../org/tikv/common/columnar/TiChunkColumnVectorTest.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/test/java/org/tikv/common/columnar/TiChunkColumnVectorTest.java b/src/test/java/org/tikv/common/columnar/TiChunkColumnVectorTest.java index caac16f1e86..86e971df90b 100644 --- a/src/test/java/org/tikv/common/columnar/TiChunkColumnVectorTest.java +++ b/src/test/java/org/tikv/common/columnar/TiChunkColumnVectorTest.java @@ -1,14 +1,10 @@ package org.tikv.common.columnar; -import static org.tikv.common.types.MySQLType.TypeBit; - import java.nio.ByteBuffer; import junit.framework.TestCase; import org.junit.Assert; import org.junit.Test; import org.tikv.common.types.BitType; -import org.tikv.common.types.DataType; -import org.tikv.common.types.MySQLType; public class TiChunkColumnVectorTest extends TestCase { From f53c873a18a5ed7b455366d237d02e4da42c2369 Mon Sep 17 00:00:00 2001 From: Liangliang Gu Date: Mon, 28 Feb 2022 21:40:42 +0800 Subject: [PATCH 5/6] [close #542] update protobuf version to 3.16.1 (#539) Signed-off-by: shiyuhang <1136742008@qq.com> --- pom.xml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/pom.xml b/pom.xml index 71930d3efc0..3b7a796cb25 100644 --- a/pom.xml +++ b/pom.xml @@ -72,6 +72,16 @@ true + + com.google.protobuf + protobuf-java + 3.16.1 + + + com.google.protobuf + protobuf-java-util + 3.16.1 + io.perfmark perfmark-api @@ -131,6 +141,12 @@ io.grpc grpc-protobuf ${grpc.version} + + + com.google.protobuf + protobuf-java + + io.grpc @@ -141,6 +157,12 @@ io.grpc grpc-services ${grpc.version} + + + com.google.protobuf + protobuf-java-util + + io.netty From 022ac190e8d327c9116793eaab4ebdb61a9daaef Mon Sep 17 00:00:00 2001 From: shiyuhang <1136742008@qq.com> Date: Tue, 1 Mar 2022 11:02:30 +0800 Subject: [PATCH 6/6] fmt&license Signed-off-by: shiyuhang <1136742008@qq.com> --- .../columnar/TiChunkColumnVectorTest.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/tikv/common/columnar/TiChunkColumnVectorTest.java b/src/test/java/org/tikv/common/columnar/TiChunkColumnVectorTest.java index 86e971df90b..376ea25313b 100644 --- a/src/test/java/org/tikv/common/columnar/TiChunkColumnVectorTest.java +++ b/src/test/java/org/tikv/common/columnar/TiChunkColumnVectorTest.java @@ -1,3 +1,20 @@ +/* + * Copyright 2022 TiKV Project Authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + package org.tikv.common.columnar; import java.nio.ByteBuffer; @@ -13,8 +30,8 @@ public void testGetLong() { long expect = 32767; ByteBuffer buffer = ByteBuffer.allocate(8); buffer.putLong(expect); - TiChunkColumnVector tiChunkColumnVector = new TiChunkColumnVector( - BitType.BIT, -1, 1, 0, new byte[]{-1}, new long[]{0, 8}, buffer); + TiChunkColumnVector tiChunkColumnVector = + new TiChunkColumnVector(BitType.BIT, -1, 1, 0, new byte[] {-1}, new long[] {0, 8}, buffer); Assert.assertEquals(expect, tiChunkColumnVector.getLong(0)); } }