morningman commented on code in PR #17245:
URL: https://github.com/apache/doris/pull/17245#discussion_r1121833205


##########
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:
   ditto



##########
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:
   Not all optional properties using `false` as default.
   So better use `if else` or `switch` to handle them separately



##########
docs/en/docs/lakehouse/multi-catalog/jdbc.md:
##########
@@ -176,6 +164,7 @@ Currently, Jdbc Catalog only support to use 5.x version of 
JDBC jar package to c
 | `jdbc_url `     | Yes             |               | JDBC connection string   
                          |
 | `driver_url `   | Yes             |               | JDBC Driver Jar          
                          |
 | `driver_class ` | Yes             |               | JDBC Driver Class        
                          |
+| <version since="dev">`only_specified_database`</version> | No             |  
   "false"          | When the JDBC is connected, you can specify which 
database/schema to connect. For example, you can specify the DataBase in mysql 
`jdbc_url`; you can specify the CurrentSchema in PG `jdbc_url`, 
`only_specified_database` specifies whether only the database is specified 
simultaneously.                                  |

Review Comment:
   And you forgot the add `lower_case_table_names` doc



##########
docs/en/docs/lakehouse/multi-catalog/jdbc.md:
##########
@@ -176,6 +164,7 @@ Currently, Jdbc Catalog only support to use 5.x version of 
JDBC jar package to c
 | `jdbc_url `     | Yes             |               | JDBC connection string   
                          |
 | `driver_url `   | Yes             |               | JDBC Driver Jar          
                          |
 | `driver_class ` | Yes             |               | JDBC Driver Class        
                          |
+| <version since="dev">`only_specified_database`</version> | No             |  
   "false"          | When the JDBC is connected, you can specify which 
database/schema to connect. For example, you can specify the DataBase in mysql 
`jdbc_url`; you can specify the CurrentSchema in PG `jdbc_url`, 
`only_specified_database` specifies whether only the database is specified 
simultaneously.                                  |

Review Comment:
   do not support this type of `<version>`
   you have to explain it below, as `driver_url`



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

Reply via email to