You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "zy-kkk (via GitHub)" <gi...@apache.org> on 2023/06/07 15:08:26 UTC

[GitHub] [doris] zy-kkk opened a new pull request, #20566: [Refactor](External) Move Common ODBC Methods to JDBC Class and Add Default config to Disable ODBC Creation

zy-kkk opened a new pull request, #20566:
URL: https://github.com/apache/doris/pull/20566

   ## Proposed changes
   
   Issue Number: close #xxx
   
   This PR addresses the refactoring of common methods that were originally located within the ODBC classes, but were used by the JDBC classes. These methods have now been moved to the JDBC classes to improve code readability and maintainability. 
   
   In addition, we have disabled the creation of ODBC external tables by default. However, this will not affect the existing usage of ODBC. You can still enable the ODBC external tables through the `enable_odbc_table` setting. Please be aware that we plan to completely remove the ODBC external tables in future versions, so we recommend using the JDBC Catalog as a priority.
   
   Please note that these changes do not alter the existing behavior of the application. They are intended to make the code more clean, efficient, and manageable.
   
   
   ```
   mysql> CREATE EXTERNAL TABLE `baseall_oracle` (
       ->   `k1` decimal(9, 3) NOT NULL COMMENT "",
       ->   `k2` char(10) NOT NULL COMMENT "",
       ->   `k3` datetime NOT NULL COMMENT "",
       ->   `k5` varchar(20) NOT NULL COMMENT "",
       ->   `k6` double NOT NULL COMMENT ""
       -> ) ENGINE=ODBC
       -> COMMENT "ODBC"
       -> PROPERTIES (
       -> "host" = "192.168.0.1",
       -> "port" = "8086",
       -> "user" = "test",
       -> "password" = "test",
       -> "database" = "test",
       -> "table" = "baseall",
       -> "driver" = "Oracle 19 ODBC driver",
       -> "odbc_type" = "oracle"
       -> );
   ERROR 1105 (HY000): errCode = 2, detailMessage = Do not support odbc external table, please set enable_odbc_table as true
   mysql> CREATE EXTERNAL RESOURCE `oracle_odbc`
       -> PROPERTIES (
       -> "type" = "odbc_catalog",
       -> "host" = "192.168.0.1",
       -> "port" = "8086",
       -> "user" = "test",
       -> "password" = "test",
       -> "database" = "test",
       -> "odbc_type" = "oracle",
       -> "driver" = "Oracle 19 ODBC driver"
       -> );
   ERROR 1105 (HY000): errCode = 2, detailMessage = Do not support odbc external table, please set enable_odbc_table as true
   ```
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   
   


-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] zy-kkk commented on pull request #20566: [Refactor](External) Move Common ODBC Methods to JDBC Class and Add Default config to Disable ODBC Creation

Posted by "zy-kkk (via GitHub)" <gi...@apache.org>.
zy-kkk commented on PR #20566:
URL: https://github.com/apache/doris/pull/20566#issuecomment-1581022965

   run buildall


-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] morningman commented on a diff in pull request #20566: [Refactor](External) Move Common ODBC Methods to JDBC Class and Add Default config to Disable ODBC Creation

Posted by "morningman (via GitHub)" <gi...@apache.org>.
morningman commented on code in PR #20566:
URL: https://github.com/apache/doris/pull/20566#discussion_r1225090144


##########
fe/fe-core/src/main/java/org/apache/doris/analysis/CreateResourceStmt.java:
##########
@@ -93,6 +94,9 @@ public void analyze(Analyzer analyzer) throws UserException {
         if (resourceType == ResourceType.SPARK && !isExternal) {
             throw new AnalysisException("Spark is external resource");
         }
+        if (resourceType == ResourceType.ODBC_CATALOG && !Config.enable_odbc_table) {
+            throw new AnalysisException("Do not support odbc external table, please set enable_odbc_table as true");

Review Comment:
   ```suggestion
               throw new AnalysisException("ODBC table is deprecated, use JDBC instead. Or you can set `enable_odbc_table=true` in fe.conf to enable ODBC again.");
   ```



##########
fe/fe-common/src/main/java/org/apache/doris/common/Config.java:
##########
@@ -1766,6 +1766,12 @@ public class Config extends ConfigBase {
     @ConfField(mutable = false, expType = ExperimentalType.EXPERIMENTAL)
     public static boolean enable_fqdn_mode = false;
 
+    /**
+     * enable use odbc table
+     */
+    @ConfField(mutable = true, masterOnly = true)
+    public static boolean enable_odbc_table = false;

Review Comment:
   use `description` field in `ConfField` annotation to add document of this config.



##########
fe/fe-core/src/main/java/org/apache/doris/analysis/CreateTableStmt.java:
##########
@@ -626,6 +626,9 @@ private void analyzeEngineName() throws AnalysisException {
         if (engineName.equals("mysql") || engineName.equals("odbc") || engineName.equals("broker")
                 || engineName.equals("elasticsearch") || engineName.equals("hive")
                 || engineName.equals("iceberg") || engineName.equals("hudi") || engineName.equals("jdbc")) {
+            if (engineName.equals("odbc") && !Config.enable_odbc_table) {
+                throw new AnalysisException("Do not support odbc external table, please set enable_odbc_table as true");

Review Comment:
   ditto



-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] zy-kkk merged pull request #20566: [Refactor](External) Move Common ODBC Methods to JDBC Class and Add Default config to Disable ODBC Creation

Posted by "zy-kkk (via GitHub)" <gi...@apache.org>.
zy-kkk merged PR #20566:
URL: https://github.com/apache/doris/pull/20566


-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] zy-kkk commented on pull request #20566: [Refactor](External) Move Common ODBC Methods to JDBC Class and Add Default config to Disable ODBC Creation

Posted by "zy-kkk (via GitHub)" <gi...@apache.org>.
zy-kkk commented on PR #20566:
URL: https://github.com/apache/doris/pull/20566#issuecomment-1586523845

   run buildall


-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #20566: [Refactor](External) Move Common ODBC Methods to JDBC Class and Add Default config to Disable ODBC Creation

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20566:
URL: https://github.com/apache/doris/pull/20566#issuecomment-1586805640

   PR approved by anyone and no changes requested.


-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] zy-kkk commented on pull request #20566: [Refactor](External) Move Common ODBC Methods to JDBC Class and Add Default config to Disable ODBC Creation

Posted by "zy-kkk (via GitHub)" <gi...@apache.org>.
zy-kkk commented on PR #20566:
URL: https://github.com/apache/doris/pull/20566#issuecomment-1587064961

   run buildall


-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] zy-kkk commented on pull request #20566: [Refactor](External) Move Common ODBC Methods to JDBC Class and Add Default config to Disable ODBC Creation

Posted by "zy-kkk (via GitHub)" <gi...@apache.org>.
zy-kkk commented on PR #20566:
URL: https://github.com/apache/doris/pull/20566#issuecomment-1588422263

   run buildall


-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] zy-kkk commented on pull request #20566: [Refactor](External) Move Common ODBC Methods to JDBC Class and Add Default config to Disable ODBC Creation

Posted by "zy-kkk (via GitHub)" <gi...@apache.org>.
zy-kkk commented on PR #20566:
URL: https://github.com/apache/doris/pull/20566#issuecomment-1582067686

   run buildall


-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #20566: [Refactor](External) Move Common ODBC Methods to JDBC Class and Add Default config to Disable ODBC Creation

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20566:
URL: https://github.com/apache/doris/pull/20566#issuecomment-1586805551

   PR approved by at least one committer and no changes requested.


-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org