diff --git a/maven-projects/info/pom.xml b/maven-projects/info/pom.xml
index 3df2b5bab..2f993e6f7 100644
--- a/maven-projects/info/pom.xml
+++ b/maven-projects/info/pom.xml
@@ -39,8 +39,8 @@
graphar-info
- 11
- 11
+ 17
+ 17
UTF-8
2.3.0
4.27.1
@@ -94,12 +94,22 @@
- 1.7
+ 1.14.0
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.11.0
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 3.5.0
+
org.apache.maven.plugins
maven-shade-plugin
diff --git a/maven-projects/info/src/main/java/org/apache/graphar/info/ChunkInfoReader.java b/maven-projects/info/src/main/java/org/apache/graphar/info/ChunkInfoReader.java
new file mode 100644
index 000000000..a4acfb80f
--- /dev/null
+++ b/maven-projects/info/src/main/java/org/apache/graphar/info/ChunkInfoReader.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.graphar.info;
+// based on
+// https://github.com/apache/incubator-graphar/blob/main/cpp/src/graphar/chunk_info_reader.cc
+public class ChunkInfoReader {
+ private static final VertexInfo cachedVertexInfo = null;
+ private static final PropertyGroup cachedPropertyGroup = null;
+
+ public static String getChunk(long index) {
+ long chunkIndex = chunkExists(index);
+ String chunkBasePath =
+ cachedVertexInfo.getPropertyGroupPrefix(cachedPropertyGroup) + "/chunk";
+ return chunkBasePath + String.valueOf(chunkIndex);
+ }
+
+ public static long chunkExists(long index) {
+ long chunkSize = cachedVertexInfo.getChunkSize();
+ int totalCount = Integer.valueOf(cachedVertexInfo.getVerticesNumFilePath());
+ long chunksCount = totalCount / chunkSize;
+ long chunkIndex = index / chunksCount;
+
+ if (chunkIndex < chunksCount) {
+ return chunkIndex;
+ }
+ throw new IndexOutOfBoundsException("Chunk Index out of Range " + String.valueOf(index));
+ }
+
+ public String getPropertyGroupChunkPath(PropertyGroup propertyGroup, long chunkIndex) {
+ // PropertyGroup will be checked in getPropertyGroupPrefix
+ return cachedVertexInfo.getPropertyGroupPrefix(propertyGroup) + "/chunk" + chunkIndex;
+ }
+}
diff --git a/maven-projects/info/src/main/java/org/apache/graphar/info/VertexInfo.java b/maven-projects/info/src/main/java/org/apache/graphar/info/VertexInfo.java
index d32475623..b1a0ec83a 100644
--- a/maven-projects/info/src/main/java/org/apache/graphar/info/VertexInfo.java
+++ b/maven-projects/info/src/main/java/org/apache/graphar/info/VertexInfo.java
@@ -103,7 +103,7 @@ public String getPropertyGroupPrefix(PropertyGroup propertyGroup) {
public String getPropertyGroupChunkPath(PropertyGroup propertyGroup, long chunkIndex) {
// PropertyGroup will be checked in getPropertyGroupPrefix
- return getPropertyGroupPrefix(propertyGroup) + "/chunk" + chunkIndex;
+ return getPropertyGroupPrefix(propertyGroup) + "chunk" + chunkIndex;
}
public String getVerticesNumFilePath() {
diff --git a/maven-projects/pom.xml b/maven-projects/pom.xml
index b7c1b09ec..d7ab6d107 100644
--- a/maven-projects/pom.xml
+++ b/maven-projects/pom.xml
@@ -72,7 +72,7 @@
-->
0.12.0-SNAPSHOT
- 2.20.0
+ 2.46.1
java