Skip to content

Add support for editing column comments on Iceberg tables#11143

Merged
findepi merged 1 commit intotrinodb:masterfrom
findinpath:iceberg-column-comment
Feb 23, 2022
Merged

Add support for editing column comments on Iceberg tables#11143
findepi merged 1 commit intotrinodb:masterfrom
findinpath:iceberg-column-comment

Conversation

@findinpath
Copy link
Copy Markdown
Contributor

@findinpath findinpath commented Feb 22, 2022

Description

Enable the Trino users to execute commands like the following:

COMMENT ON COLUMN iceberg_table.some_column IS 'A textual description of the purpose of some_column'

Relevant connector test: io.trino.testing.AbstractTestDistributedQueries#testCommentColumn

Is this change a fix, improvement, new feature, refactoring, or other?

This change is a new feature.

Is this a change to the core query engine, a connector, client library, or the SPI interfaces? (be specific)

This change affect only the Iceberg connector.

How would you describe this change to a non-technical end user or system administrator?

This PR adds the ability to edit comments for Iceberg table columns.

Related issues, pull requests, and links

PRs depending on this change: #11072

Documentation

(x) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.

Release notes

( ) No release notes entries required.
(x) Release notes entries required with the following suggested text:

# Iceberg
* Add support for editing column comments

@cla-bot cla-bot bot added the cla-signed label Feb 22, 2022
@findinpath findinpath requested review from alexjo2144, findepi, losipiuk and phd3 and removed request for findepi February 22, 2022 09:05
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to update the comment both in the metastore and via the Iceberg updateColumnDoc?

If we don't need the metastore's comment set we can move this code up to IcebergMetadata and make it catalog agnostic.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I inspired myself in the implementation from the updateTableComment method which does also talk to the metastore.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove both, as it leads to inconsistent state if the icebergTable.updateSchema().updateColumnDoc fails.

let's reconsider with a followup

@findinpath findinpath force-pushed the iceberg-column-comment branch from 1d84209 to 37de02a Compare February 22, 2022 16:32
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove both, as it leads to inconsistent state if the icebergTable.updateSchema().updateColumnDoc fails.

let's reconsider with a followup

protected boolean hasBehavior(TestingConnectorBehavior connectorBehavior)
{
switch (connectorBehavior) {
case SUPPORTS_COMMENT_ON_COLUMN:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a follow-up can you please add tests for CREATE TABLE with column comment?

see

// TODO: comment set when creating a table
// assertUpdate("CREATE TABLE " + tableName + "(a integer COMMENT 'new column comment')");
// assertThat(getColumnComment(tableName, "a")).isEqualTo("new column comment");
// assertUpdate("DROP TABLE " + tableName);

@findinpath
Copy link
Copy Markdown
Contributor Author

Created #11161 follow-up issue for ditching metastore updates for COMMENT on Iceberg table/column.

@mosabua
Copy link
Copy Markdown
Member

mosabua commented Feb 23, 2022

Do we need to document this in the Iceberg connector SQL support section or somewhere? If not .. I dont see any other docs for this.

@findinpath
Copy link
Copy Markdown
Contributor Author

@mosabua there is a link towards Schema and table management document within the https://trino.io/docs/current/connector/iceberg.html#sql-support section.
The COMMENT statement works same as for the other connectors now. https://trino.io/docs/current/sql/comment.html

I think that in this case (the current change just added a minor missing functionality for the Iceberg connector) there is no need for extra documentation. If there is a need to enrich the docs I can gladly take care of it.

@mosabua
Copy link
Copy Markdown
Member

mosabua commented Feb 25, 2022

Thanks for checking that out. I agree @findinpath .. we are good ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants