jiangxt2 commented on code in PR #14464:
URL: https://github.com/apache/gravitino/pull/14464#discussion_r4438795273


##########
catalogs/catalog-jdbc-doris/src/test/java/org/apache/gravitino/catalog/doris/operation/TestDorisTableOperationsSqlGeneration.java:
##########
@@ -1735,6 +1738,57 @@ public void 
testCreateTablePlainStringDefaultSkipsVersionLookup() throws Excepti
     Mockito.verifyNoInteractions(versionDataSource);
   }
 
+  @Test
+  public void 
testCreateTableWithAutoIncrementAndStringDefaultSharesVersionLookupAndValidatesFirst()
+      throws Exception {
+    TestableDorisTableOperations ops = new TestableDorisTableOperations();
+    DataSource versionDataSource = 
mockVersionDataSource("doris-3.0.6.2-rc01-910c4249c5");
+    ops.setDataSource(versionDataSource);
+    JdbcColumn[] columns = {
+      JdbcColumn.builder()
+          .withName("id")
+          .withType(Types.LongType.get())
+          .withNullable(false)
+          .withAutoIncrement(true)
+          .build(),
+      JdbcColumn.builder()
+          .withName("owner")
+          .withType(Types.VarCharType.of(64))
+          .withDefaultValue(Literals.varcharLiteral(64, "O'Brien \\ \"x\""))
+          .build()
+    };
+
+    Assertions.assertThrows(
+        IllegalArgumentException.class,
+        () ->
+            ops.generateCreateTableSql(
+                "test_table",
+                columns,
+                null,
+                Collections.singletonMap(REPLICATION_FACTOR, "1"),
+                Transforms.EMPTY_TRANSFORM,
+                null,
+                Indexes.EMPTY_INDEXES));

Review Comment:
   Non-blocking: Could we add a separate case with a valid primary key on the 
auto-increment column `id` and `distribution = null`, asserting the message 
`Doris must set distribution` and `verifyNoInteractions(versionDataSource)`? 
With `Indexes.EMPTY_INDEXES`, this call fails auto-increment key validation 
before reaching distribution validation, so the existing test would still pass 
if distribution validation moved below the version lookup.



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