BePPPower commented on code in PR #17245: URL: https://github.com/apache/doris/pull/17245#discussion_r1121884571
########## fe/fe-core/src/main/java/org/apache/doris/catalog/JdbcResource.java: ########## @@ -144,22 +156,46 @@ public void checkProperties(Map<String, String> properties) throws AnalysisExcep protected void setProperties(Map<String, String> properties) throws DdlException { Preconditions.checkState(properties != null); for (String key : properties.keySet()) { - if (!DRIVER_URL.equals(key) && !JDBC_URL.equals(key) && !USER.equals(key) && !PASSWORD.equals(key) - && !TYPE.equals(key) && !DRIVER_CLASS.equals(key)) { - throw new DdlException("JDBC resource Property of " + key + " is unknown"); + switch (key) { + case DRIVER_URL: + case JDBC_URL: + case USER: + case PASSWORD: + case TYPE: + case DRIVER_CLASS: + case ONLY_SPECIFIED_DATABASE: // optional argument + case LOWER_CASE_TABLE_NAMES: // optional argument + break; + default: + throw new DdlException("JDBC resource Property of " + key + " is unknown"); } } configs = properties; + handleOptionalArguments(); checkProperties(DRIVER_URL); checkProperties(DRIVER_CLASS); checkProperties(JDBC_URL); checkProperties(USER); checkProperties(PASSWORD); checkProperties(TYPE); + checkProperties(ONLY_SPECIFIED_DATABASE); + checkProperties(LOWER_CASE_TABLE_NAMES); this.configs.put(JDBC_URL, handleJdbcUrl(getProperty(JDBC_URL))); configs.put(CHECK_SUM, computeObjectChecksum(getProperty(DRIVER_URL))); } + /** + * This function used to handle optional arguments + * eg: only_specified_database、lower_case_table_names + */ + private void handleOptionalArguments() { + for (String s : OPTIONAL_PROPERTIES) { Review Comment: done ########## docs/zh-CN/docs/lakehouse/multi-catalog/jdbc.md: ########## @@ -173,9 +161,10 @@ CREATE CATALOG doris_catalog PROPERTIES ( --- | --- | --- | --- `user` | 是 | | 对应数据库的用户名 | `password` | 是 | | 对应数据库的密码 | -`jdbc_url ` | 是 | | JDBC 连接串 | -`driver_url ` | 是 | | JDBC Driver Jar 包名称* | -`driver_class ` | 是 | | JDBC Driver Class 名称 | +`jdbc_url` | 是 | | JDBC 连接串 | +`driver_url` | 是 | | JDBC Driver Jar 包名称* | +`driver_class` | 是 | | JDBC Driver Class 名称 | +<version since="dev">`only_specified_database`</version> | 否 | "false" | 在jdbc连接时可以指定链接到哪个database/schema, 如:mysql中jdbc_url中可以指定database, pg的jdbc_url中可以指定currentSchema,`only_specified_database`指定是否只同步指定的 database. | Review Comment: done -- 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...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org