Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for COMMENT ON COLUMN statement #2516

Merged
merged 2 commits into from Jun 28, 2020

Conversation

ebyhr
Copy link
Member

@ebyhr ebyhr commented Jan 15, 2020

Fixes #2242

@martint
Copy link
Member

martint commented Jan 16, 2020

Syntax looks good. It's consistent with COMMENT ON TABLE and the eventual direction we're going with this. See (#200 (comment) for previous discussions)

@Test
public void testCommentColumn()
{
assertStatement("COMMENT ON COLUMN a.b IS 'test'", new Comment(Comment.Type.COLUMN, QualifiedName.of("a", "b"), Optional.of("test")));
Copy link
Member

Choose a reason for hiding this comment

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

Add tests for other forms of column names: E.g., catalog.schema.table.column, schema.table.column, column, etc.

@@ -58,6 +61,23 @@ public String getName()

metadata.setTableComment(session, tableHandle.get(), statement.getComment());
}
else if (statement.getType() == Comment.Type.COLUMN) {
QualifiedObjectName tableName = createQualifiedObjectName(session, statement, statement.getName().getPrefix().get());
Optional<TableHandle> tableHandle = metadata.getTableHandle(session, tableName);
Copy link
Member

Choose a reason for hiding this comment

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

This needs to check if the name has a single part. E.g., if the user enters COMMENT ON foo IS ...

@martint martint removed their assignment Jun 25, 2020
@ebyhr ebyhr force-pushed the comment-on-column branch 2 times, most recently from 9e06768 to 2a96c46 Compare June 28, 2020 05:38
@ebyhr
Copy link
Member Author

ebyhr commented Jun 28, 2020

Updated.

@ebyhr ebyhr merged commit 4df88ad into trinodb:master Jun 28, 2020
@ebyhr ebyhr deleted the comment-on-column branch June 28, 2020 08:13
@ebyhr ebyhr mentioned this pull request Jun 28, 2020
8 tasks
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.

Add support for comment on column
3 participants