zy-kkk opened a new issue, #31440:
URL: https://github.com/apache/doris/issues/31440

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Description
   
   In the current design of `JdbcExecutor`, the logic for handling all data 
sources is encapsulated in a single Java class. This design has several issues, 
including the use of `if-else` statements for multi-data source handling 
strategies, data reading logic that uses `getObject` followed by type 
conversion, and the organization of private methods that may lead to 
maintenance and scalability issues. These problems could affect code 
readability, maintainability, and performance.
   
   ### Solution
   
   - **Multi-Data Source Handling Strategy**: Adopt an abstract class and 
subclass design pattern. Define an abstract base class `BaseJdbcExecutor` to 
handle logic common to all data sources. Create subclasses for each specific 
data source (such as `MySQLJdbcExecutor`, `OracleJdbcExecutor`, etc.) that 
implement or override logic specific to that data source.
   - **Data Reading Logic**: Use the specific `get` methods (like `getString`, 
`getLocalDate`, etc.) based on the column's data type directly, to avoid 
unnecessary type conversions and improve performance and accuracy of type 
matching.
   - **Organization of Private Methods**: Move private methods that are only 
needed in specific data source subclasses to the respective subclasses, 
reducing the complexity of the base class and clarifying the responsibilities 
of each subclass.
   
   I will do it in the following parts:
   
   - [ ] Factory Class & MySQL Executor 
https://github.com/apache/doris/pull/31406
   - [ ] Oracle Executor
   - [ ] PG Executor
   - [ ] SQLServer Executor
   - [ ] ClickHouse Executor
   - [ ] Trino Executor
   - [ ] SAP HANA Executor
   - [ ] OceanBase Executor
   - [ ] Optimize Base Executor
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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