brucearctor commented on code in PR #14464:
URL: https://github.com/apache/gravitino/pull/14464#discussion_r4439257458
##########
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:
Good catch, thank you @jiangxt2! Added the case with a valid primary key on
`id` and `distribution = null` asserting `Doris must set distribution` and
`verifyNoInteractions(versionDataSource)` in e1893f206.
--
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]