This is an automated email from the ASF dual-hosted git repository.

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 8f82e5694058df263a072226c3852534e43b6521
Author: zy-kkk <[email protected]>
AuthorDate: Sat Oct 7 06:25:52 2023 -0500

    [improvement](jdbc catalog)Adjustment to JDBC External Table Configuration 
Based on Internal Table Settings (#25059)
    
    This pull request addresses the behavior of the `lower_case_table_names` 
parameter for jdbc catalog's based on the configuration of the internal table's 
corresponding parameter.
    
    Changes:
    - For internal tables, if `lower_case_table_names` is set to 1 or 2, 
thejdbc catalog's parameter is forcefully set to `true`.
    - For internal tables, if `lower_case_table_names` is set to 0, the jdbc 
catalog's parameter can be either `true` or `false` with a default value of 
`false`.
    
    These adjustments ensure consistency and predictability when working with 
both internal and external table configurations in Doris.
---
 docs/en/docs/lakehouse/multi-catalog/jdbc.md                       | 4 +++-
 docs/zh-CN/docs/lakehouse/multi-catalog/jdbc.md                    | 4 +++-
 .../java/org/apache/doris/datasource/jdbc/JdbcExternalCatalog.java | 7 +++++++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/docs/en/docs/lakehouse/multi-catalog/jdbc.md 
b/docs/en/docs/lakehouse/multi-catalog/jdbc.md
index 33f53f2d7c6..dbdac58f78c 100644
--- a/docs/en/docs/lakehouse/multi-catalog/jdbc.md
+++ b/docs/en/docs/lakehouse/multi-catalog/jdbc.md
@@ -67,7 +67,7 @@ When `lower_case_table_names` is set to `true`, Doris is able 
to query non-lower
 
 1. In versions before Doris 2.0.3, it is only valid for Oracle database. When 
querying, all library names and table names will be converted to uppercase 
before querying Oracle, for example:
 
-Oracle has the TEST table in the TEST space. When Doris creates the Catalog, 
set `lower_case_table_names` to `true`, then Doris can query the TEST table 
through `select * from oracle_catalog.test.test`, and Doris will automatically 
format test.test into TEST.TEST is sent to Oracle. It should be noted that this 
is the default behavior, which also means that lowercase table names in Oracle 
cannot be queried.
+   Oracle has the TEST table in the TEST space. When Doris creates the 
Catalog, set `lower_case_table_names` to `true`, then Doris can query the TEST 
table through `select * from oracle_catalog.test.test`, and Doris will 
automatically format test.test into TEST.TEST is sent to Oracle. It should be 
noted that this is the default behavior, which also means that lowercase table 
names in Oracle cannot be queried.
 
    For other databases, you still need to specify the real library name and 
table name when querying.
 
@@ -75,6 +75,8 @@ Oracle has the TEST table in the TEST space. When Doris 
creates the Catalog, set
 
    However, if the database or table names differ only in case, such as 
`Doris` and `doris`, Doris cannot query them due to ambiguity.
 
+3. When the FE parameter's `lower_case_table_names` is set to `1` or `2`, the 
JDBC Catalog's `lower_case_table_names` parameter must be set to `true`. If the 
FE parameter's `lower_case_table_names` is set to `0`, the JDBC Catalog 
parameter can be `true` or `false` and defaults to `false`. This ensures 
consistency and predictability in how Doris handles internal and external table 
configurations.
+
 ### Specify synchronization database:
 
 `only_specified_database`:
diff --git a/docs/zh-CN/docs/lakehouse/multi-catalog/jdbc.md 
b/docs/zh-CN/docs/lakehouse/multi-catalog/jdbc.md
index 39600341e88..f16a0bedd5a 100644
--- a/docs/zh-CN/docs/lakehouse/multi-catalog/jdbc.md
+++ b/docs/zh-CN/docs/lakehouse/multi-catalog/jdbc.md
@@ -73,7 +73,9 @@ JDBC Catalog 通过标准 JDBC 协议,连接其他数据源。
 
 2. 在 Doris 2.0.3 及之后的版本,对所有的数据库都有效,在查询时,会将所有的库名和表名转换为真实的名称,再去查询,如果是从老版本升级到 
2.0.3 ,需要 `Refresh <catalog_name>` 才能生效。
 
-   但是,如果数据库或者表名只有大小写不同,例如 `Doris` 和 `doris`,则 Doris 由于歧义而无法查询它们。
+    但是,如果数据库或者表名只有大小写不同,例如 `Doris` 和 `doris`,则 Doris 由于歧义而无法查询它们。
+
+3. 当 FE 参数的 `lower_case_table_names` 设置为 `1` 或 `2` 时,JDBC Catalog 的 
`lower_case_table_names` 参数必须设置为 `true`。如果 FE 参数的 `lower_case_table_names` 设置为 
`0`,则 JDBC Catalog 的参数可以为 `true` 或 `false`,默认为 `false`。这确保了 Doris 
在处理内部和外部表配置时的一致性和可预测性。
 
 ### 指定同步数据库
 
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/JdbcExternalCatalog.java
 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/JdbcExternalCatalog.java
index 0dd2cc22608..df1d442b9d6 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/JdbcExternalCatalog.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/JdbcExternalCatalog.java
@@ -19,6 +19,7 @@ package org.apache.doris.datasource.jdbc;
 
 import org.apache.doris.catalog.JdbcResource;
 import org.apache.doris.catalog.external.JdbcExternalDatabase;
+import org.apache.doris.common.Config;
 import org.apache.doris.common.DdlException;
 import org.apache.doris.datasource.CatalogProperty;
 import org.apache.doris.datasource.ExternalCatalog;
@@ -125,6 +126,12 @@ public class JdbcExternalCatalog extends ExternalCatalog {
     }
 
     public String getLowerCaseTableNames() {
+        // Forced to true if Config.lower_case_table_names has a value of 1 or 
2
+        if (Config.lower_case_table_names == 1 || 
Config.lower_case_table_names == 2) {
+            return "true";
+        }
+
+        // Otherwise, it defaults to false
         return 
catalogProperty.getOrDefault(JdbcResource.LOWER_CASE_TABLE_NAMES, "false");
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to