Skip to content

Support creating tables with table comment in Delta Lake#12452

Merged
ebyhr merged 5 commits intomasterfrom
ebi/delta-table-comment
May 27, 2022
Merged

Support creating tables with table comment in Delta Lake#12452
ebyhr merged 5 commits intomasterfrom
ebi/delta-table-comment

Conversation

@ebyhr
Copy link
Copy Markdown
Member

@ebyhr ebyhr commented May 18, 2022

Description

Support creating tables with table comment in Delta Lake. Verified the Delta Lake's compatibility with Spark locally.

Documentation

(x) No documentation is needed.

Release notes

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

# Delta Lake
* Support storing a table comment when creating new tables. ({issue}`12452`)

@cla-bot cla-bot bot added the cla-signed label May 18, 2022
@ebyhr ebyhr force-pushed the ebi/delta-table-comment branch from 376f02b to b15fb16 Compare May 18, 2022 10:29
@ebyhr ebyhr changed the title Support creating tables with table comment in Delta Lake & Kudu Support creating tables with table comment in Delta Lake May 18, 2022
@findepi
Copy link
Copy Markdown
Member

findepi commented May 18, 2022

Support creating tables with table comment in Delta Lake & Kudu. Verified the Delta Lake's compatibility with Spark locally.

Remove Kudu from the description ?

@ebyhr ebyhr force-pushed the ebi/delta-table-comment branch 2 times, most recently from 0c3745b to 3876d2d Compare May 19, 2022 01:40
@ebyhr
Copy link
Copy Markdown
Member Author

ebyhr commented May 19, 2022

CI hit #12413

@ebyhr ebyhr marked this pull request as ready for review May 19, 2022 02:44
@ebyhr ebyhr requested review from findepi, findinpath and hashhar May 20, 2022 06:00
@ebyhr ebyhr force-pushed the ebi/delta-table-comment branch 2 times, most recently from 3e946a3 to f3b6a8e Compare May 23, 2022 00:39
@ebyhr ebyhr requested a review from findinpath May 23, 2022 02:34
@ebyhr ebyhr force-pushed the ebi/delta-table-comment branch from f3b6a8e to c8c05be Compare May 24, 2022 00:50
@ebyhr
Copy link
Copy Markdown
Member Author

ebyhr commented May 24, 2022

Rebased on upstream to resolve conflicts.

@ebyhr ebyhr force-pushed the ebi/delta-table-comment branch from c8c05be to 4dbbff8 Compare May 25, 2022 02:53
@ebyhr
Copy link
Copy Markdown
Member Author

ebyhr commented May 25, 2022

Added a product test. Ready for review now.

@ebyhr ebyhr force-pushed the ebi/delta-table-comment branch from 4dbbff8 to 554fac3 Compare May 26, 2022 02:18
@ebyhr
Copy link
Copy Markdown
Member Author

ebyhr commented May 26, 2022

CI hit #12300

{
if (block.isNull(position)) {
return null;
}
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.

Does it add support for reading checkpoint files we didn't read before?
Should we have a test?

Also, should we have this for getLong, getInt, getByte methods?
If there are supposed to be called on non-null values only, we should probably
have checkArgument(block.isNull(position))` in them

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is not new support. It returned an empty character before this change.
TestCheckpointEntryIterator covers both non-empty and null cases.

Added checkArgument to those three methods.

"b6aeffad-da73-4dde-b68e-937e468b1fde",
"",
"",
null,
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.

is "name" a table name? shouldn't it be present?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@JsonProperty
public Optional<String> getComment()
{
return metadataEntry.map(MetadataEntry::getDescription);
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 metadata should be present:

Optional.ofNullable(getMetadataEntry().getDescription())

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.

remove it from table handle class, let the caller do this

assertEquals(getTableCommentOnDelta("default", tableName), "test comment");
}
finally {
onDelta().executeQuery("DROP TABLE default." + tableName);
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.

table was created on trino, so drop on trino as well

}
}

private void testInsert(String tableName, List<QueryAssert.Row> existingRows)
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.

this method is a helper method for the test above; put your new test below, so that the test and its helper remain grouped

@ebyhr ebyhr force-pushed the ebi/delta-table-comment branch from 554fac3 to 71dcb66 Compare May 27, 2022 01:25
@ebyhr ebyhr merged commit bb0d814 into master May 27, 2022
@ebyhr ebyhr deleted the ebi/delta-table-comment branch May 27, 2022 05:31
@ebyhr ebyhr mentioned this pull request May 27, 2022
@github-actions github-actions bot added this to the 383 milestone May 27, 2022
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.

3 participants