linghengqian opened a new issue, #36081:
URL: https://github.com/apache/shardingsphere/issues/36081

   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub 
issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere 
Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more 
details. 
   If no response anymore and we cannot reproduce it on current information, we 
will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   
   - 
https://github.com/apache/shardingsphere/commit/ee301e61ca29f5bfd92976bdabafbcb137dd8593
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   - `ShardingSphere-JDBC`
   
   ### Expected behavior
   
   - When connecting to Doris FE using MySQL JDBC Driver, SQL is parsed using 
the Doris dialect. This involves the module 
`org.apache.shardingsphere:shardingsphere-parser-sql-doris`.
   - When connecting to ClickHouse Server using MySQL JDBC Driver, SQL is 
parsed using the ClickHouse dialect. This involves the module 
`org.apache.shardingsphere:shardingsphere-parser-sql-clickhouse`.
   
   ### Actual behavior
   
   - When connecting to ClickHouse Server or Doris FE using MySQL JDBC Driver, 
SQL is always parsed using the MySQL dialect. This involves the module 
`org.apache.shardingsphere:shardingsphere-parser-sql-mysql`.
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   - For example, when using MySQL JDBC Driver's 
`jdbc:mysql://localhost:9030/demo_ds_0` to connect to Doris FE in the 
shardingsphere jdbc configuration file, 
`org.apache.shardingsphere.infra.database.core.type.DatabaseTypeFactory#get()` 
will find two 
`org.apache.shardingsphere.infra.database.core.type.DatabaseType`, which are,
   
     - `org.apache.shardingsphere.infra.database.mysql.type.MySQLDatabaseType`
     - `org.apache.shardingsphere.infra.database.doris.DorisDatabaseType`
   
   - Since both `org.apache.shardingsphere:shardingsphere-parser-sql-doris` and 
`org.apache.shardingsphere:shardingsphere-parser-sql-mysql` are on the 
classpath, shardingsphere will almost always use the class corresponding to the 
MySQL dialect, namely 
`org.apache.shardingsphere.sql.parser.mysql.parser.MySQLParserFacade`. 
   
   - `org.apache.shardingsphere.sql.parser.doris.parser.DorisParserFacade` is 
completely ignored.
   - The metadata obtained by the MySQL JDBC Driver should be appropriately 
judged in 
`org.apache.shardingsphere.infra.database.DatabaseTypeEngine#getStorageType(javax.sql.DataSource)`.
 I'm referring to exactly 
https://doris.apache.org/docs/3.0/db-connect/database-connect and 
https://clickhouse.com/docs/interfaces/mysql .
   
   ```shell
   Welcome to the MySQL monitor.  Commands end with ; or \g.                    
           
   Your MySQL connection id is 236                                              
           
   Server version: 5.7.99 Doris version doris-2.0.3-rc06-37d31a5                
           
   Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. 
           
   Oracle is a registered trademark of Oracle Corporation and/or its 
affiliates. Other names may be trademarks of their respective owners.           
                          Type 'help;' or '\h' for help. Type '\c' to clear the 
current input statement.          
   
   mysql> 
   ```
   
   ```shell
   Welcome to the MySQL monitor.  Commands end with ; or \g.
   Your MySQL connection id is 4
   Server version: 20.2.1.1-ClickHouse
   
   Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
   
   Oracle is a registered trademark of Oracle Corporation and/or its
   affiliates. Other names may be trademarks of their respective
   owners.
   
   Type 'help;' or '\h' for help. Type '\c' to clear the current input 
statement.
   
   mysql>
   ```
   
   - 
`org.apache.shardingsphere.infra.database.clickhouse.type.ClickHouseDatabaseType`
 happens to lack support for MySQL Interface.
   
   ### Example codes for reproduce this issue (such as a github link).
   
   - This is actually an undocumented bug in 
`org.apache.shardingsphere.test.natived.jdbc.databases.DorisFETest` from the 
master branch. An early investigation came from 
https://github.com/apache/shardingsphere/issues/29052 .
   - By the way, I don't know if MariaDB has this bug. It seems that the unit 
tests for MariaDB integration intentionally use the MySQL dialect.
   


-- 
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: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to