morningman commented on code in PR #46026:
URL: https://github.com/apache/doris/pull/46026#discussion_r1899258576
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/client/JdbcClickHouseClient.java:
##########
@@ -121,4 +202,80 @@ protected Type jdbcTypeToDoris(JdbcFieldSchema
fieldSchema) {
return Type.UNSUPPORTED;
}
}
+
+ /**
+ * Determine whether to use catalog databaseterm.
+ * 1. If it is a new version of the driver (>=0.5.0) and
databaseTerm=catalog is specified in the URL,
+ * true will be returned.
+ * 2. If it is an old version driver (<0.5.0), always returns false.
+ */
+ private boolean isDatabaseTermCatalog() {
+ if (databaseTermIsCatalog == null) {
+ synchronized (this) {
+ if (databaseTermIsCatalog == null) {
+ databaseTermIsCatalog = determineDatabaseTerm();
+ }
+ }
+ }
+ return databaseTermIsCatalog;
+ }
+
+ /**
+ * Determines whether to use catalog databaseterm (lazy initialization).
+ */
+ private boolean determineDatabaseTerm() {
+ try (Connection conn = getConnection()) {
+ String jdbcUrl = conn.getMetaData().getURL();
+ // 获取驱动版本是否大于等于 0.5.0
Review Comment:
English
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/client/JdbcClickHouseClient.java:
##########
@@ -121,4 +202,80 @@ protected Type jdbcTypeToDoris(JdbcFieldSchema
fieldSchema) {
return Type.UNSUPPORTED;
}
}
+
+ /**
+ * Determine whether to use catalog databaseterm.
+ * 1. If it is a new version of the driver (>=0.5.0) and
databaseTerm=catalog is specified in the URL,
+ * true will be returned.
+ * 2. If it is an old version driver (<0.5.0), always returns false.
+ */
+ private boolean isDatabaseTermCatalog() {
Review Comment:
I suggest to check and fill the `databaseTermIsCatalog` when creating the
catalog.
(for old version, user can call `refresh` to fill this field, added to the
document).
So that we don't need to use this `synchronized` things, which make the code
hard to maintain.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]