Skip to content

Commit

Permalink
Support setting column comments in ClickHouse
Browse files Browse the repository at this point in the history
  • Loading branch information
ebyhr authored and hashhar committed Jan 18, 2022
1 parent 7bf8da9 commit 242bbba
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/src/main/sphinx/connector/clickhouse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,17 @@ public void renameColumn(ConnectorSession session, JdbcTableHandle handle, JdbcC
}
}

@Override
public void setColumnComment(ConnectorSession session, JdbcTableHandle handle, JdbcColumnHandle column, Optional<String> 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<String> schemaName, Optional<String> tableName)
throws SQLException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 242bbba

Please sign in to comment.