xiaozcy commented on code in PR #4131:
URL: https://github.com/apache/gravitino/pull/4131#discussion_r1675664751
##########
catalogs/catalog-jdbc-doris/src/main/java/com/datastrato/gravitino/catalog/doris/utils/DorisUtils.java:
##########
@@ -65,4 +76,40 @@ public static Map<String, String>
extractPropertiesFromSql(String createTableSql
}
return properties;
}
+
+ public static Optional<Transform> extractPartitionInfoFromSql(String
createTableSql) {
+ try {
+ String[] lines = createTableSql.split("\n");
+ for (String line : lines) {
+ if (line.contains(PARTITION_BY)) {
Review Comment:
done
##########
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:
done
--
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]