xiaozcy commented on code in PR #4131:
URL: https://github.com/apache/gravitino/pull/4131#discussion_r1675422051
##########
catalogs/catalog-jdbc-doris/src/main/java/com/datastrato/gravitino/catalog/doris/operation/DorisTableOperations.java:
##########
@@ -308,6 +311,22 @@ protected List<Index> getIndexes(Connection connection,
String databaseName, Str
}
}
+ @Override
+ protected Transform[] getTablePartitioning(
+ Connection connection, String databaseName, String tableName) throws
SQLException {
+ String showCreateTableSql = String.format("SHOW CREATE TABLE `%s`",
tableName);
+ try (Statement statement = connection.createStatement();
+ ResultSet result = statement.executeQuery(showCreateTableSql)) {
+ StringBuilder createTableSql = new StringBuilder();
+ while (result.next()) {
+ createTableSql.append(result.getString("Create Table"));
+ }
+ Optional<Transform> transform =
+ DorisUtils.extractPartitionInfoFromSql(createTableSql.toString());
Review Comment:
We did not concatenate SQL here actually. When we execute `show create
table` by JDBC, it will return the entire statement at once, which means the
above loop will actually be executed once. So splitting SQL is necessary.
Besides, passing the entire statement to
`DorisUtils.extractPartitionInfoFromSql` makes it easier for unit tests.
--
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]