Hisoka-X commented on code in PR #7288: URL: https://github.com/apache/seatunnel/pull/7288#discussion_r1708860041
########## seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-common/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/AbstractJdbcIT.java: ########## @@ -348,12 +375,100 @@ public void testJdbcDb(TestContainer container) protected void initCatalog() {} + protected boolean hasIndex(TablePath tablePath) { + boolean hasIndex = false; + try { + String schemaName = + (tablePath.getSchemaName() == null + || StringUtils.isBlank(tablePath.getSchemaName())) + ? tablePath.getDatabaseName() + : tablePath.getSchemaName(); + try (Connection connectionByDbName = + getConnectionByDbName(tablePath.getDatabaseName())) { + DatabaseMetaData metaData = connectionByDbName.getMetaData(); + + try (ResultSet indexes = + metaData.getIndexInfo( + null, schemaName, tablePath.getTableName(), false, false)) { + while (indexes.next()) { + String indexName = indexes.getString("INDEX_NAME"); + if (indexName != null) { + hasIndex = true; + log.info("Index found: " + indexName); + } + } + if (!hasIndex) { + log.info( + "No indexes found on the table " + + tablePath.getSchemaAndTableName()); + } + } + } + } catch (Exception e) { + log.error("Failed to get metadata", e); + } + return hasIndex; Review Comment: Why not use `Catalog::getTable`? Then check catalogtable's `tableSchema` fields. You will know the table contains index or not. This will make the test case simpler -- 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: commits-unsubscr...@seatunnel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org