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


##########
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:
   Similarly, you can use `SHOW VARIABLES LIKE 'version_comment';` to retrieve 
the version.  
   
   I’m considering whether it would be better to store the version in the Doris 
catalog properties. This way, we could avoid having to fetch it repeatedly.
   
   @yuqi1129 Do you have some advice?



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