Hisoka-X commented on code in PR #8869: URL: https://github.com/apache/seatunnel/pull/8869#discussion_r1976818997
########## seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/JdbcUrlUtil.java: ########## @@ -22,31 +22,146 @@ import lombok.Data; import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; import java.util.Optional; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.stream.Collectors; public final class JdbcUrlUtil { private static final Pattern URL_PATTERN = Pattern.compile( "^(?<url>jdbc:.+?//(?<host>.+?):(?<port>\\d+?))(/(?<database>.*?))*(?<suffix>\\?.*)*$"); + private static final Pattern SQLSERVER_URL_PATTERN = + Pattern.compile( + "^(?<url>jdbc:sqlserver://([a-zA-Z0-9.-]+)(?::(\\d+))?(;(?<param>[^=]+)\\s*=(?<value>[^;]+);?)*)$"); + + private static final Pattern ORACLE_URL_PATTERN = + Pattern.compile( + "^(?<url>jdbc:oracle:thin:@(//)?(?<host>[^:]+):(?<port>\\d+))(/(?<database>.*?))*(?<suffix>\\?.*)*$"); + + private static final Pattern HANA_URL_PATTERN = + Pattern.compile("^(?<url>jdbc:sap://(?<host>[^:]+):(?<port>\\d+)/?(?<params>.*?))$"); Review Comment: Change `JdbcUrlUtil` as abstract class? Then each implement class can hold pattern by themself. ########## seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/Catalog.java: ########## @@ -161,21 +179,55 @@ default List<CatalogTable> getTables(ReadonlyConfig config) throws CatalogExcept if (StringUtils.isBlank(tablePatternStr)) { return Collections.emptyList(); } - Pattern databasePattern = - Pattern.compile(config.get(ConnectorCommonOptions.DATABASE_PATTERN)); - Pattern tablePattern = Pattern.compile(config.get(ConnectorCommonOptions.TABLE_PATTERN)); - List<String> allDatabase = this.listDatabases(); - allDatabase.removeIf(s -> !databasePattern.matcher(s).matches()); + Pattern tablePattern = Pattern.compile(config.get(CatalogOptions.TABLE_PATTERN)); + List<String> allDatabaseOrSchema; List<TablePath> tablePaths = new ArrayList<>(); - for (String databaseName : allDatabase) { - tableNames = this.listTables(databaseName); + boolean isOracle = "Oracle".equals(this.name()); Review Comment: We should not do this kind special check in api. ########## seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/Catalog.java: ########## @@ -58,6 +61,10 @@ default Optional<Factory> getFactory() { */ void open() throws CatalogException; + default Logger getLogger() { + return null; + } Review Comment: why need this? -- 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...@seatunnel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org