imbajin commented on code in PR #2321:
URL:
https://github.com/apache/incubator-hugegraph/pull/2321#discussion_r1359205548
##########
hugegraph-pd/.mvn/wrapper/MavenWrapperDownloader.java:
##########
Review Comment:
why remove them? Non-maven user could use it to build maven project
However, we should only put one on the top of the project(and remove it for
sub-module)
##########
.github/workflows/pd-store.yml:
##########
@@ -0,0 +1,216 @@
+name: "pd-store"
+
+on:
+ push:
+ branches:
+ - master
+ - 'release-*'
+ - 'test-*'
+ pull_request:
+
+jobs:
+ pd:
+ runs-on: ubuntu-20.04
Review Comment:
```suggestion
runs-on: ubuntu-latest
```
same as other pd/store ci env
##########
hugegraph-pd/.mvn/wrapper/MavenWrapperDownloader.java:
##########
Review Comment:
why remove them? Non-maven user could use it to build maven project
However, we should only put one on the top of the project(and remove it for
sub-module)
##########
hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/PartitionUtilsTest.java:
##########
@@ -17,19 +17,37 @@
package org.apache.hugegraph.pd.common;
-import org.apache.hugegraph.pd.common.PartitionUtils;
+import java.nio.charset.StandardCharsets;
+import lombok.extern.slf4j.Slf4j;
import org.junit.Assert;
import org.junit.Test;
-import lombok.extern.slf4j.Slf4j;
-
@Slf4j
public class PartitionUtilsTest extends BaseCommonTest {
+
@Test
public void testCalcHashcode() {
byte[] key = new byte[5];
long code = PartitionUtils.calcHashcode(key);
Assert.assertEquals(code, 31912L);
}
-}
\ No newline at end of file
+
+ // @Test
+ public void testHashCode() {
+ int partCount = 10;
+ int partSize = PartitionUtils.MAX_VALUE / partCount + 1;
+ int[] counter = new int[partCount];
+ for (int i = 0; i < 10000; i++) {
+ String s = String.format("BATCH-GET-UNIT-%02d", i);
+ int c =
PartitionUtils.calcHashcode(s.getBytes(StandardCharsets.UTF_8));
+
+ counter[c / partSize]++;
+
+ }
+
+ for (int i = 0; i < counter.length; i++) {
+ System.out.println(i + " " + counter[i]);
+ }
+ }
+}
Review Comment:
useful?
##########
hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/util/UnsafeUtilTest.java:
##########
@@ -51,12 +51,12 @@ public void testMoveToString() {
@Test
public void testEncodedLength() {
- assertEquals(10, UnsafeUtf8Util.encodedLength("aa中文aa"));
+ assertEquals(10, UnsafeUtf8Util.encodedLength("aa 中文 aa"));
}
@Test
public void testEncodeUtf8() {
- assertEquals(10, UnsafeUtf8Util.encodeUtf8("aa中文aa", new byte[16], 0,
16));
+ assertEquals(10, UnsafeUtf8Util.encodeUtf8("aa 中文 aa", new byte[16],
0, 16));
Review Comment:
length
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]