Skip to content

Commit

Permalink
Add support for editing column comments on Iceberg tables
Browse files Browse the repository at this point in the history
  • Loading branch information
findinpath authored and findepi committed Feb 23, 2022
1 parent 484ee43 commit 9120a45
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,12 @@ else if (strings.size() != 2) {
return new MaterializedViewFreshness(true);
}

@Override
public void setColumnComment(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnHandle column, Optional<String> comment)
{
catalog.updateColumnComment(session, ((IcebergTableHandle) tableHandle).getSchemaTableName(), ((IcebergColumnHandle) column).getColumnIdentity(), comment);
}

private Map<String, Optional<TableToken>> getMaterializedViewToken(ConnectorSession session, SchemaTableName name)
{
Map<String, Optional<TableToken>> viewToken = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,6 @@ void createMaterializedView(
Optional<ConnectorMaterializedViewDefinition> getMaterializedView(ConnectorSession session, SchemaTableName schemaViewName);

void renameMaterializedView(ConnectorSession session, SchemaTableName source, SchemaTableName target);

void updateColumnComment(ConnectorSession session, SchemaTableName schemaTableName, ColumnIdentity columnIdentity, Optional<String> comment);
}
Original file line number Diff line number Diff line change
Expand Up @@ -650,4 +650,13 @@ private List<String> listNamespaces(ConnectorSession session, Optional<String> n
}
return listNamespaces(session);
}

@Override
public void updateColumnComment(ConnectorSession session, SchemaTableName schemaTableName, ColumnIdentity columnIdentity, Optional<String> comment)
{
metastore.commentColumn(schemaTableName.getSchemaName(), schemaTableName.getTableName(), columnIdentity.getName(), comment);

Table icebergTable = loadTable(session, schemaTableName);
icebergTable.updateSchema().updateColumnDoc(columnIdentity.getName(), comment.orElse(null)).commit();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ protected QueryRunner createQueryRunner()
protected boolean hasBehavior(TestingConnectorBehavior connectorBehavior)
{
switch (connectorBehavior) {
case SUPPORTS_COMMENT_ON_COLUMN:
case SUPPORTS_TOPN_PUSHDOWN:
return false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ protected QueryRunner createQueryRunner()
protected boolean hasBehavior(TestingConnectorBehavior connectorBehavior)
{
switch (connectorBehavior) {
case SUPPORTS_COMMENT_ON_COLUMN:
case SUPPORTS_TOPN_PUSHDOWN:
return false;

Expand Down

0 comments on commit 9120a45

Please sign in to comment.