javeme commented on code in PR #263:
URL: 
https://github.com/apache/incubator-hugegraph-toolchain/pull/263#discussion_r861503038


##########
hugegraph-loader/src/main/java/com/baidu/hugegraph/loader/reader/jdbc/RowFetcher.java:
##########
@@ -119,13 +130,17 @@ public List<Line> nextBatch() throws SQLException {
             return null;
         }
 
-        String select = this.source.vendor().buildSelectSql(this.source,
-                                                            this.nextStartRow);
+        String select = this.source.existsSql() ?
+                this.source.sql() : 
this.source.vendor().buildSelectSql(this.source, this.nextStartRow);
+
         LOG.debug("The sql for select is: {}", select);
 
         List<Line> batch = new ArrayList<>(this.source.batchSize() + 1);
         try (Statement stmt = this.conn.createStatement();
              ResultSet result = stmt.executeQuery(select)) {
+            if (this.source.existsSql()) {
+                readHeader(result);

Review Comment:
   prefer to keep style: "this.readHeader(result);"



##########
hugegraph-loader/src/main/java/com/baidu/hugegraph/loader/source/jdbc/JDBCSource.java:
##########
@@ -59,16 +61,24 @@ public void check() throws IllegalArgumentException {
         E.checkArgument(this.vendor != null, "The vendor can't be null");
         E.checkArgument(this.url != null, "The url can't be null");
         E.checkArgument(this.database != null, "The database can't be null");
-        E.checkArgument(this.table != null, "The table can't be null");
         E.checkArgument(this.username != null, "The username can't be null");
         E.checkArgument(this.password != null, "The password can't be null");
+        E.checkArgument(this.table != null || this.sql != null, "At least one 
of table and sql can't be null");
 
         this.schema = this.vendor.checkSchema(this);
         if (this.driver == null) {
             this.driver = this.vendor.defaultDriver();
         }
     }
 
+    public String sql() {
+        return this.sql;

Review Comment:
   can we rename to customSQL or customSelect?



##########
hugegraph-loader/src/main/java/com/baidu/hugegraph/loader/reader/jdbc/RowFetcher.java:
##########
@@ -95,6 +96,16 @@ public String[] readHeader() throws SQLException {
         return this.columns;
     }
 
+    public String[] readHeader(ResultSet rs) throws SQLException {

Review Comment:
   can mark as private?



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

Reply via email to