diff --git a/docs/src/main/sphinx/connector/clickhouse.rst b/docs/src/main/sphinx/connector/clickhouse.rst index 10b4b9939d3a..a23497de5bef 100644 --- a/docs/src/main/sphinx/connector/clickhouse.rst +++ b/docs/src/main/sphinx/connector/clickhouse.rst @@ -190,5 +190,6 @@ statements, the connector supports the following features: * :doc:`/sql/create-schema` * :doc:`/sql/drop-schema` * :doc:`/sql/alter-schema` +* :doc:`/sql/comment` .. include:: alter-schema-limitation.fragment diff --git a/plugin/trino-clickhouse/src/main/java/io/trino/plugin/clickhouse/ClickHouseClient.java b/plugin/trino-clickhouse/src/main/java/io/trino/plugin/clickhouse/ClickHouseClient.java index 4854d479b7e2..469d1cf2ad3b 100644 --- a/plugin/trino-clickhouse/src/main/java/io/trino/plugin/clickhouse/ClickHouseClient.java +++ b/plugin/trino-clickhouse/src/main/java/io/trino/plugin/clickhouse/ClickHouseClient.java @@ -315,6 +315,17 @@ public void renameColumn(ConnectorSession session, JdbcTableHandle handle, JdbcC } } + @Override + public void setColumnComment(ConnectorSession session, JdbcTableHandle handle, JdbcColumnHandle column, Optional comment) + { + String sql = format( + "ALTER TABLE %s COMMENT COLUMN %s '%s'", + quoted(handle.asPlainTable().getRemoteTableName()), + quoted(column.getColumnName()), + comment.orElse("")); + execute(session, sql); + } + @Override public ResultSet getTables(Connection connection, Optional schemaName, Optional tableName) throws SQLException diff --git a/plugin/trino-clickhouse/src/test/java/io/trino/plugin/clickhouse/TestClickHouseConnectorTest.java b/plugin/trino-clickhouse/src/test/java/io/trino/plugin/clickhouse/TestClickHouseConnectorTest.java index 6b08e6fc6520..ec2572401349 100644 --- a/plugin/trino-clickhouse/src/test/java/io/trino/plugin/clickhouse/TestClickHouseConnectorTest.java +++ b/plugin/trino-clickhouse/src/test/java/io/trino/plugin/clickhouse/TestClickHouseConnectorTest.java @@ -78,7 +78,6 @@ protected boolean hasBehavior(TestingConnectorBehavior connectorBehavior) return false; case SUPPORTS_COMMENT_ON_TABLE: - case SUPPORTS_COMMENT_ON_COLUMN: return false; case SUPPORTS_ARRAY: