Skip to content

Commit

Permalink
Fix the bug for check table error when dataObject is not well-formed
Browse files Browse the repository at this point in the history
#Fixes #160
  • Loading branch information
liuyou2 committed Jun 19, 2020
1 parent bf3212e commit e332e07
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,9 @@ private long getTotalCount(Map<String, String> proObjectMap, Connection conn, L

private PreparedStatement getStatement(Connection conn, String dataObject) throws SQLException {
String dataScape = dataObject.contains("{") ? "Partition" : "Table";
String dbName = dataObject.split("\\.")[0];
String tableName = dataObject.split("\\.")[1];
String[] dataObjectArray = dataObject.split("\\.");
String dbName = dataObjectArray[0];
String tableName = dataObjectArray[1];
if(dataScape.equals("Partition")) {
Pattern pattern = Pattern.compile("\\{([^\\}]+)\\}");
Matcher matcher = pattern.matcher(dataObject);
Expand All @@ -174,11 +175,13 @@ private PreparedStatement getStatement(Connection conn, String dataObject) throw
pstmt.setString(2, tableName);
pstmt.setString(3, partitionName);
return pstmt;
} else {
} else if(dataObjectArray.length == 2){
PreparedStatement pstmt = conn.prepareCall(SQL_SOURCE_TYPE_JOB_TABLE);
pstmt.setString(1, dbName);
pstmt.setString(2, tableName);
return pstmt;
}else {
throw new SQLException("Incorrect input format for dataObject "+ dataObject);
}
}

Expand Down

0 comments on commit e332e07

Please sign in to comment.