yuqi1129 commented on code in PR #11731:
URL: https://github.com/apache/gravitino/pull/11731#discussion_r3498437914


##########
catalogs/catalog-jdbc-doris/src/main/java/org/apache/gravitino/catalog/doris/operation/DorisTableOperations.java:
##########
@@ -228,28 +234,153 @@ private static void validateDistribution(Distribution 
distribution, JdbcColumn[]
     }
   }
 
+  /**
+   * Validates that the Doris server version supports AUTO_INCREMENT columns. 
AUTO_INCREMENT was
+   * introduced in Doris 2.1.0. On older versions, the SQL parser does not 
recognize the
+   * AUTO_INCREMENT keyword and returns a syntax error.
+   */
+  private void validateAutoIncrementVersion(JdbcColumn[] columns) {
+    boolean hasAutoIncrement = 
Arrays.stream(columns).anyMatch(Column::autoIncrement);
+    if (!hasAutoIncrement) {
+      return;
+    }
+    Preconditions.checkState(dataSource != null, "dataSource is required for 
version validation");
+    String version = null;
+    try (Connection connection = dataSource.getConnection();
+        Statement stmt = connection.createStatement();
+        ResultSet rs = stmt.executeQuery("SELECT VERSION()")) {

Review Comment:
   I'm afraid that information like version is not so suitable to store in 
catalog properties. About performance consideration, we haven't got detailed 
statistics about whether version-fetching is a time-consumting operations, so I 
am inclined to leave it as it is.  If we did find that, it would largely 
influence the API output, and we could just start the refactor work. 



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