jtuglu1 commented on code in PR #18515:
URL: https://github.com/apache/druid/pull/18515#discussion_r2343561196
##########
server/src/test/java/org/apache/druid/metadata/SQLMetadataConnectorTest.java:
##########
@@ -305,6 +307,43 @@ public void testIsTransientException()
);
}
+ @ParameterizedTest
+ @ValueSource(booleans = {true, false})
+ public void testIndexIdentifierTruncation(boolean truncate)
+ {
+ String longTableName = "this_is_an_extremely_long_table_name_for_testing";
+ String identifierTemplate = "idx_%1$s_datasource_active";
+
+ tablesConfig = MetadataStorageTablesConfig.fromBase(longTableName,
truncate);
+ MetadataStorageConnectorConfig config =
+ MetadataStorageConnectorConfig.create("connectURI", "user",
"password", Collections.emptyMap());
+
+ TestSQLMetadataConnector testSQLMetadataConnector = new
TestSQLMetadataConnector(
+ Suppliers.ofInstance(config),
+ Suppliers.ofInstance(tablesConfig),
+ CentralizedDatasourceSchemaConfig.create()
+ )
+ {
+ @Override
+ public int indexIdentifierLengthLimit()
+ {
+ return 30;
+ }
+ };
+
+ if (truncate) {
+ Assert.assertEquals(
+ "idx_this_is__datasource_active",
+ testSQLMetadataConnector.getIndexIdentifier(identifierTemplate,
longTableName)
Review Comment:
I'll switch the test to test `createIndex` behavior directly if we're ok
with the `createIndex` changes. Otherwise, I'll leave this as-is for now.
--
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]