Copilot commented on code in PR #683:
URL: 
https://github.com/apache/incubator-hugegraph-toolchain/pull/683#discussion_r2464765768


##########
hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/FileLoadTest.java:
##########
@@ -2029,15 +2033,15 @@ public void testLoadIncrementalModeAndLoadFailure()
            throws IOException, InterruptedException {
         ioUtil.write("vertex_person.csv",
                      "name,age,city",
-                     "marko,应该是数字,Beijing",
+                     "marko,应该是数字,Beijing",

Review Comment:
   Corrected full-width comma to half-width comma in test data string.
   ```suggestion
                        "marko,应该是数字,Beijing",
   ```



##########
hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/FileLoadTest.java:
##########
@@ -2029,15 +2033,15 @@ public void testLoadIncrementalModeAndLoadFailure()
            throws IOException, InterruptedException {
         ioUtil.write("vertex_person.csv",
                      "name,age,city",
-                     "marko,应该是数字,Beijing",
+                     "marko,应该是数字,Beijing",
                      "vadas,27,Hongkong",
                      "josh,32,Beijing",
                      "peter,35,Shanghai",
                      "\"li,nary\",26,\"Wu,han\"");
         ioUtil.write("vertex_software.csv", GBK,
                      "name,lang,price",
                      "office,C#,999",
-                     "lop,java,应该是数字",
+                     "lop,java,应该是数字",

Review Comment:
   Corrected full-width comma to half-width comma in test data string.
   ```suggestion
                        "lop,java,应该是数字",
   ```



##########
hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/FileLoadTest.java:
##########
@@ -2150,14 +2159,14 @@ public void testLoadIncrementalModeAndLoadFailure()
         personFailureLines = FileUtils.readLines(personFailureFile,
                                                  Constants.CHARSET);
         Assert.assertEquals(2, personFailureLines.size());
-        Assert.assertEquals("marko,应该是数字,Beijing",
+        Assert.assertEquals("marko,应该是数字,Beijing",
                             personFailureLines.get(1));
 
         File softwareFailureFile = files[2];
         List<String> softwareFailureLines = FileUtils.readLines(
                                             softwareFailureFile, GBK);
         Assert.assertEquals(2, softwareFailureLines.size());
-        Assert.assertEquals("lop,java,应该是数字", softwareFailureLines.get(1));
+        Assert.assertEquals("lop,java,应该是数字", softwareFailureLines.get(1));

Review Comment:
   Corrected full-width comma to half-width comma in test assertion string.
   ```suggestion
           Assert.assertEquals("lop,java,应该是数字", softwareFailureLines.get(1));
   ```



##########
hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/FileLoadTest.java:
##########
@@ -2084,13 +2090,13 @@ public void testLoadIncrementalModeAndLoadFailure()
         assert files != null;
         Arrays.sort(files, Comparator.comparing(File::getName));
         Assert.assertNotNull(files);
-        Assert.assertEquals(2, files.length);
+        //Assert.assertEquals(2, files.length);
 
         File personFailureFile = files[0];
         List<String> personFailureLines = 
FileUtils.readLines(personFailureFile,
                                                               
Constants.CHARSET);
         Assert.assertEquals(2, personFailureLines.size());
-        Assert.assertEquals("marko,应该是数字,Beijing",
+        Assert.assertEquals("marko,应该是数字,Beijing",

Review Comment:
   Corrected full-width comma to half-width comma in test assertion string.
   ```suggestion
           Assert.assertEquals("marko,应该是数字,Beijing",
   ```



##########
hugegraph-loader/src/main/java/org/apache/hugegraph/loader/reader/jdbc/Fetcher.java:
##########
@@ -0,0 +1,80 @@
+/*
+ * 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.hugegraph.loader.reader.jdbc;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.List;
+
+import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
+import org.apache.hugegraph.loader.exception.LoadException;
+import org.apache.hugegraph.loader.reader.line.Line;
+import org.apache.hugegraph.loader.source.jdbc.JDBCSource;
+
+public abstract class Fetcher {
+
+
+    protected JDBCSource source;
+    protected Connection conn;
+    private static final Logger LOG = Log.logger(Fetcher.class);
+
+    public Fetcher(JDBCSource source) throws SQLException {
+        this.source = source;
+        this.conn = this.connect();
+    }
+
+    public JDBCSource getSource() {
+        return source;
+    }
+
+    public Connection getConn() {
+        return conn;
+    }
+
+    private Connection connect() throws SQLException {
+        String url = this.getSource().vendor().buildUrl(this.source);
+        if (url == null) {
+            throw new LoadException("Invalid url !");
+        }
+        LOG.info("Connect to database {}", url);
+        String driverName = this.source.driver();
+        String username = this.source.username();
+        String password = this.source.password();
+        try {
+            Class.forName(driverName);
+        } catch (ClassNotFoundException e) {
+            throw new LoadException("Invalid driver class '%s'", e, 
driverName);
+        }
+        return DriverManager.getConnection(url,
+                username,
+                password);
+    }
+
+    ;

Review Comment:
   Remove unnecessary semicolon after method closing brace.
   ```suggestion
   
   ```



##########
hugegraph-loader/src/main/java/org/apache/hugegraph/loader/filter/util/ShortIdConfig.java:
##########
@@ -0,0 +1,108 @@
+/*
+ * 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.hugegraph.loader.filter.util;
+
+import org.apache.hugegraph.loader.exception.LoadException;
+import org.apache.hugegraph.structure.constant.DataType;
+
+import com.beust.jcommander.IStringConverter;
+
+public class ShortIdConfig {
+
+    private String vertexLabel;
+    private String idFieldName;
+    private DataType idFieldType;
+    private String primaryKeyField;
+
+    private long labelID;
+
+    public String getVertexLabel() {
+        return vertexLabel;
+    }
+
+    public String getIdFieldName() {
+        return idFieldName;
+    }
+
+    public DataType getIdFieldType() {
+        return idFieldType;
+    }
+
+    public void setPrimaryKeyField(String primaryKeyField) {
+        this.primaryKeyField = primaryKeyField;
+    }
+
+    public String getPrimaryKeyField() {
+        return primaryKeyField;
+    }
+
+    public long getLabelID() {
+        return labelID;
+    }
+
+    public void setLabelID(long labelID) {
+        this.labelID = labelID;
+    }
+
+    public static class ShortIdConfigConverter implements 
IStringConverter<ShortIdConfig> {
+
+        @Override
+        public ShortIdConfig convert(String s) {
+            String[] sp = s.split(":");
+            ShortIdConfig config = new ShortIdConfig();
+            config.vertexLabel = sp[0];
+            config.idFieldName = sp[1];
+            String a = DataType.BYTE.name();

Review Comment:
   Unused variable 'a' should be removed as it serves no purpose in the code.
   ```suggestion
   
   ```



-- 
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]

Reply via email to