You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "chenlinzhong (via GitHub)" <gi...@apache.org> on 2023/04/19 02:22:41 UTC

[GitHub] [doris] chenlinzhong commented on a diff in pull request #18799: [feature](graph)Support querying data from the Nebula graph database

chenlinzhong commented on code in PR #18799:
URL: https://github.com/apache/doris/pull/18799#discussion_r1170740738


##########
fe/java-udf/src/main/java/org/apache/doris/udf/JdbcExecutor.java:
##########
@@ -244,49 +260,58 @@ public static Object convertClickHouseArray(Object obj) {
     private void init(String driverUrl, String sql, int batchSize, String driverClass, String jdbcUrl, String jdbcUser,
             String jdbcPassword, TJdbcOperation op, TOdbcTableType tableType) throws UdfRuntimeException {
         try {
-            ClassLoader parent = getClass().getClassLoader();
-            ClassLoader classLoader = UdfUtils.getClassLoader(driverUrl, parent);
-            druidDataSource = JdbcDataSource.getDataSource().getSource(jdbcUrl + jdbcUser + jdbcPassword);
-            if (druidDataSource == null) {
-                DruidDataSource ds = new DruidDataSource();
-                ds.setDriverClassLoader(classLoader);
-                ds.setDriverClassName(driverClass);
-                ds.setUrl(jdbcUrl);
-                ds.setUsername(jdbcUser);
-                ds.setPassword(jdbcPassword);
-                ds.setMinIdle(minIdleSize);
-                ds.setInitialSize(minPoolSize);
-                ds.setMaxActive(maxPoolSize);
-                ds.setMaxWait(5000);
-                ds.setTimeBetweenEvictionRunsMillis(maxIdelTime);
-                ds.setMinEvictableIdleTimeMillis(maxIdelTime / 2);
-                druidDataSource = ds;
-                // here is a cache of datasource, which using the string(jdbcUrl + jdbcUser +
-                // jdbcPassword) as key.
-                // and the default datasource init = 1, min = 1, max = 100, if one of connection idle
-                // time greater than 10 minutes. then connection will be retrieved.
-                JdbcDataSource.getDataSource().putSource(jdbcUrl + jdbcUser + jdbcPassword, ds);
-            }
-            conn = druidDataSource.getConnection();
-            if (op == TJdbcOperation.READ) {
-                conn.setAutoCommit(false);
-                Preconditions.checkArgument(sql != null);
-                stmt = conn.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
-                if (tableType == TOdbcTableType.MYSQL) {
-                    stmt.setFetchSize(Integer.MIN_VALUE);
-                } else {
-                    stmt.setFetchSize(batchSize);
-                }
+            if (isGraph()) {

Review Comment:
   > why nebula cannot use DruidDataSource
   
   
   
   > why nebula cannot use DruidDataSource
   
   There are many differences between graph database and relational database, and many interfaces are not implemented



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