Copilot commented on code in PR #763: URL: https://github.com/apache/incubator-graphar/pull/763#discussion_r2358781223
########## maven-projects/info/src/main/java/org/apache/graphar/info/type/FileType.java: ########## @@ -24,7 +24,21 @@ public enum FileType { PARQUET, ORC; + public String toString() { + switch (this) { + case CSV: + return "csv"; + case PARQUET: + return "parquet"; + case ORC: + return "orc"; + default: + throw new IllegalArgumentException("Unknown file type: " + this); + } + } + public static FileType fromString(String fileType) { + System.out.println(fileType); Review Comment: Debug print statement should be removed from production code. This appears to be leftover debugging code that will pollute the console output. ```suggestion ``` ########## maven-projects/info/src/main/java/org/apache/graphar/info/saver/impl/LocalFileSystemYamlGraphSaver.java: ########## @@ -17,12 +17,22 @@ * under the License. */ -package org.apache.graphar.info.loader; +package org.apache.graphar.info.saver.impl; import java.io.IOException; -import org.apache.graphar.info.GraphInfo; +import java.io.Writer; +import java.net.URI; +import java.nio.file.FileSystems; +import java.nio.file.Files; +import java.nio.file.Path; +import org.apache.graphar.info.saver.BaseGraphInfoSaver; -@FunctionalInterface -public interface GraphLoader { - public GraphInfo load(String graphYamlPath) throws IOException; +public class LocalFileSystemYamlGraphSaver extends BaseGraphInfoSaver { + + public Writer writeYaml(URI uri) throws IOException { + Path outputPath = FileSystems.getDefault().getPath(uri.toString()); + Files.createDirectories(outputPath.getParent()); + Files.createFile(outputPath); Review Comment: Calling `Files.createFile()` on a path that already exists will throw a `FileAlreadyExistsException`. The code should check if the file exists first or use `Files.createFile()` with appropriate options to handle existing files. ```suggestion if (!Files.exists(outputPath)) { Files.createFile(outputPath); } ``` ########## maven-projects/info/src/main/java/org/apache/graphar/info/GraphInfo.java: ########## @@ -37,6 +35,23 @@ public class GraphInfo { private final Map<String, VertexInfo> vertexType2VertexInfo; private final Map<String, EdgeInfo> edgeConcat2EdgeInfo; private final VersionInfo version; + private final Map<String, URI> types2StoreUri; + + public GraphInfo( + String name, + Map<URI, VertexInfo> vertexInfos, + Map<URI, EdgeInfo> edgeInfos, + URI uri, + String version) { + this( + name, + new ArrayList<>(vertexInfos.values()), + new ArrayList<>(edgeInfos.values()), + uri, + version); + vertexInfos.forEach((key, value) -> types2StoreUri.put(value.getType() + ".vertex", key)); + edgeInfos.forEach((key, value) -> types2StoreUri.put(value.getConcat() + ".edge", key)); Review Comment: The `types2StoreUri` map is not initialized before being used. This will cause a NullPointerException when these forEach operations are executed. -- 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: commits-unsubscr...@graphar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@graphar.apache.org For additional commands, e-mail: commits-h...@graphar.apache.org