diff --git a/catalogs/catalog-jdbc-clickhouse/src/main/java/org/apache/gravitino/catalog/clickhouse/operation/ClickHouseDatabaseOperations.java b/catalogs/catalog-jdbc-clickhouse/src/main/java/org/apache/gravitino/catalog/clickhouse/operation/ClickHouseDatabaseOperations.java index db8d4f24d12..04153cb20a4 100644 --- a/catalogs/catalog-jdbc-clickhouse/src/main/java/org/apache/gravitino/catalog/clickhouse/operation/ClickHouseDatabaseOperations.java +++ b/catalogs/catalog-jdbc-clickhouse/src/main/java/org/apache/gravitino/catalog/clickhouse/operation/ClickHouseDatabaseOperations.java @@ -27,7 +27,6 @@ import java.util.List; import java.util.Set; import org.apache.gravitino.catalog.jdbc.operation.JdbcDatabaseOperations; -import org.apache.gravitino.exceptions.NoSuchSchemaException; /** Database operations for ClickHouse. */ public class ClickHouseDatabaseOperations extends JdbcDatabaseOperations { @@ -42,18 +41,6 @@ protected Set createSysDatabaseNameSet() { return ImmutableSet.of("information_schema", "INFORMATION_SCHEMA", "default", "system"); } - @Override - public boolean delete(String databaseName, boolean cascade) { - LOG.info("Beginning to drop database {}", databaseName); - try { - dropDatabase(databaseName, cascade); - LOG.info("Finished dropping database {}", databaseName); - } catch (NoSuchSchemaException e) { - return false; - } - return true; - } - @Override public List listDatabases() { List databaseNames = new ArrayList<>(); @@ -62,13 +49,12 @@ public List listDatabases() { // causing the following statement to error, // so here we manually set a system catalog connection.setCatalog(createSysDatabaseNameSet().iterator().next()); - try (Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("SHOW DATABASES")) { - while (resultSet.next()) { - String databaseName = resultSet.getString(1); - if (!isSystemDatabase(databaseName)) { - databaseNames.add(databaseName); - } + try (Statement statement = connection.createStatement(); + ResultSet resultSet = statement.executeQuery("SHOW DATABASES")) { + while (resultSet.next()) { + String databaseName = resultSet.getString(1); + if (!isSystemDatabase(databaseName)) { + databaseNames.add(databaseName); } } } diff --git a/catalogs/catalog-jdbc-clickhouse/src/main/java/org/apache/gravitino/catalog/clickhouse/operation/ClickHouseTableOperations.java b/catalogs/catalog-jdbc-clickhouse/src/main/java/org/apache/gravitino/catalog/clickhouse/operation/ClickHouseTableOperations.java index f01f85940c3..0571f3339b8 100644 --- a/catalogs/catalog-jdbc-clickhouse/src/main/java/org/apache/gravitino/catalog/clickhouse/operation/ClickHouseTableOperations.java +++ b/catalogs/catalog-jdbc-clickhouse/src/main/java/org/apache/gravitino/catalog/clickhouse/operation/ClickHouseTableOperations.java @@ -562,7 +562,7 @@ private String addColumnFieldDefinition(TableChange.AddColumn addColumn) { .append(SPACE); } - //Append comment if available after default value + // Append comment if available after default value if (StringUtils.isNotEmpty(addColumn.getComment())) { columnDefinition.append("COMMENT '").append(addColumn.getComment()).append("' "); } @@ -695,13 +695,13 @@ private String updateColumnTypeFieldDefinition( private StringBuilder appendColumnDefinition(JdbcColumn column, StringBuilder sqlBuilder) { // Add Nullable data type - String dataType=typeConverter.fromGravitino(column.dataType()); + String dataType = typeConverter.fromGravitino(column.dataType()); if (column.nullable()) { sqlBuilder.append(SPACE).append("Nullable(").append(dataType).append(")").append(SPACE); } else { sqlBuilder.append(SPACE).append(dataType).append(SPACE); } - + // ck no support alter table with set nullable // Add DEFAULT value if specified @@ -713,9 +713,9 @@ private StringBuilder appendColumnDefinition(JdbcColumn column, StringBuilder sq } // Add column auto_increment if specified -// if (column.autoIncrement()) { -// sqlBuilder.append(CLICKHOUSE_AUTO_INCREMENT).append(" "); -// } + // if (column.autoIncrement()) { + // sqlBuilder.append(CLICKHOUSE_AUTO_INCREMENT).append(" "); + // } // Add column comment if specified if (StringUtils.isNotEmpty(column.comment())) {