EMsnap commented on code in PR #6979: URL: https://github.com/apache/inlong/pull/6979#discussion_r1053911832
########## inlong-sort/sort-connectors/jdbc/src/main/java/org/apache/inlong/sort/jdbc/internal/JdbcMultiBatchingComm.java: ########## @@ -173,4 +174,47 @@ private static RowData getPrimaryKey(RowData row, RowData.FieldGetter[] fieldGet return pkRow; } + public static JdbcOptions getExecJdbcOptions(JdbcOptions jdbcOptions, String tableIdentifier) { + JdbcOptions jdbcExecOptions = + JdbcOptions.builder() + .setDBUrl(jdbcOptions.getDbURL() + "/" + getDatabaseNameFromIdentifier(tableIdentifier)) + .setTableName(getTableNameFromIdentifier(tableIdentifier)) + .setDialect(jdbcOptions.getDialect()) + .setParallelism(jdbcOptions.getParallelism()) + .setConnectionCheckTimeoutSeconds(jdbcOptions.getConnectionCheckTimeoutSeconds()) + .setDriverName(jdbcOptions.getDriverName()) + .setUsername(jdbcOptions.getUsername().orElse("")) + .setPassword(jdbcOptions.getPassword().orElse("")) + .build(); + return jdbcExecOptions; + } + + /** + * Get table name From tableIdentifier + * tableIdentifier maybe: ${dbName}.${tbName} or ${dbName}.${schemaName}.${tbName} + * + * @param tableIdentifier The table identifier for which to get table name. + */ + public static String getTableNameFromIdentifier(String tableIdentifier) { + String[] fileArray = tableIdentifier.split("\\."); Review Comment: please use a name that has the right meaning ########## inlong-sort/sort-connectors/jdbc/src/main/java/org/apache/inlong/sort/jdbc/internal/JdbcMultiBatchingComm.java: ########## @@ -173,4 +174,47 @@ private static RowData getPrimaryKey(RowData row, RowData.FieldGetter[] fieldGet return pkRow; } + public static JdbcOptions getExecJdbcOptions(JdbcOptions jdbcOptions, String tableIdentifier) { + JdbcOptions jdbcExecOptions = + JdbcOptions.builder() + .setDBUrl(jdbcOptions.getDbURL() + "/" + getDatabaseNameFromIdentifier(tableIdentifier)) + .setTableName(getTableNameFromIdentifier(tableIdentifier)) + .setDialect(jdbcOptions.getDialect()) + .setParallelism(jdbcOptions.getParallelism()) + .setConnectionCheckTimeoutSeconds(jdbcOptions.getConnectionCheckTimeoutSeconds()) + .setDriverName(jdbcOptions.getDriverName()) + .setUsername(jdbcOptions.getUsername().orElse("")) + .setPassword(jdbcOptions.getPassword().orElse("")) + .build(); + return jdbcExecOptions; + } + + /** + * Get table name From tableIdentifier + * tableIdentifier maybe: ${dbName}.${tbName} or ${dbName}.${schemaName}.${tbName} + * + * @param tableIdentifier The table identifier for which to get table name. + */ + public static String getTableNameFromIdentifier(String tableIdentifier) { + String[] fileArray = tableIdentifier.split("\\."); Review Comment: Maybe IdentifierArray? -- 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...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org