Skip to content

Conversation

@krvikash
Copy link
Contributor

@krvikash krvikash commented Jan 2, 2023

Core: Support registerTable with REST session catalog

@github-actions github-actions bot added the core label Jan 2, 2023
@krvikash krvikash force-pushed the rest-catalog-resiter-table-support branch from e2b1ce6 to 48e9e48 Compare January 2, 2023 11:26
@krvikash
Copy link
Contributor Author

krvikash commented Jan 2, 2023

CI failure will be fixed with #6511

.create();
}

private boolean isValidIdentifier(TableIdentifier tableIdentifier) {
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need this, given that it always returns true? I know we do the same in BaseMetastoreCatalog where catalog implementations can override this behavior but I don't think we need this here in particular.
You might rather want to call checkIdentifierIsValid(..) in this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I have copied isValidIdentifier from BaseMetastoreCatalog implementation. Thanks for the input. I will use checkIdentifierIsValid over here.

@Override
public void invalidateTable(SessionContext context, TableIdentifier ident) {}

@Override
Copy link
Member

Choose a reason for hiding this comment

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

Just wondering why can't we remove this method and let it use the parent implementation.
Other catalogs do the same.

Copy link
Member

Choose a reason for hiding this comment

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

oh.. This is SessionCatalog, not the Catalog. So, there is no parent implementation.
I think this logic can be moved to BaseSessionCatalog. So, it can help if there are some more implementations in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, @ajantha-bhat for the input. Yes, moving implementation logic makes sense to BaseSessionCatalog. I will update the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see that all the method's implementation is in RESTSessionCatalog.java. IMO we should keep registerTable implementation in RESTSessionCatalog.java as well. WDYT?

@krvikash krvikash force-pushed the rest-catalog-resiter-table-support branch 2 times, most recently from b35f367 to 9b38a8c Compare January 10, 2023 16:21
.withProperties(tableProperties)
.withPartitionSpec(metadata.spec())
.withSortOrder(metadata.sortOrder())
.create();
Copy link
Contributor

Choose a reason for hiding this comment

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

This discards all table data and older schemas, specs, and sort orders. I think this needs to preserve the table metadata completely.

Copy link
Contributor

@rdblue rdblue left a comment

Choose a reason for hiding this comment

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

This is a great start, but the main issue is that it discards the table data and all metadata that isn't current. That's a pretty big problem.

If we want to support register, then I think the protocol itself should support register and accept a complete serialized TableMetadata object, rather than using the change-based API.

@krvikash krvikash force-pushed the rest-catalog-resiter-table-support branch 3 times, most recently from 8784571 to 1477f27 Compare January 14, 2023 19:38
@krvikash
Copy link
Contributor Author

If we want to support register, then I think the protocol itself should support register

Hi @rdblue, Thanks for the review. If I understood correctly, you wanted to introduce a new RESTRequest for registerTable similar to what we have CreateTableRequest. I have introduced a new RegisterTableRequest and used it for regsiterTable. I have updated the test case as well where I am verifying verify metadata like specs, sortOrders, history, snapshots ...

Please let me know if this is not what you intended to convey.

@krvikash
Copy link
Contributor Author

CI Failure will be fixed by #6589

TestJdbcCatalog > testRegisterTable() FAILED
    org.junit.ComparisonFailure: Name must match expected:<[test_jdbc_catalog.]newdb.table> but was:<[]newdb.table>
        at org.junit.Assert.assertEquals(Assert.java:117)
TestNessieCatalog > testRegisterTable() FAILED
    org.junit.ComparisonFailure: Name must match expected:<ne[ssie.ne]wdb.table> but was:<ne[]wdb.table>
        at org.junit.Assert.assertEquals(Assert.java:117)

@krvikash krvikash requested review from ajantha-bhat, nastra and rdblue and removed request for ajantha-bhat, nastra and rdblue January 17, 2023 10:29
@krvikash
Copy link
Contributor Author

Thanks @rdblue for the review, I have addressed the comments. However, there are a few open conversations.

@krvikash
Copy link
Contributor Author

(Modified RegisterTableRequest methods)

@krvikash krvikash force-pushed the rest-catalog-resiter-table-support branch from 1e49855 to cd35e0a Compare June 27, 2023 18:46
@krvikash
Copy link
Contributor Author

(resolved conflicts)

@krvikash krvikash force-pushed the rest-catalog-resiter-table-support branch from cd35e0a to 1ee587f Compare June 27, 2023 18:53
@krvikash krvikash force-pushed the rest-catalog-resiter-table-support branch from 1ee587f to 6c86950 Compare June 27, 2023 19:40
@krvikash
Copy link
Contributor Author

Thanks for reviewing @bryanck, Addressed comment.

Copy link
Contributor

@nastra nastra left a comment

Choose a reason for hiding this comment

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

this LGTM, just a few small things to make CI happy

@krvikash krvikash force-pushed the rest-catalog-resiter-table-support branch from 6c86950 to fa2b2a9 Compare June 28, 2023 18:17
@krvikash
Copy link
Contributor Author

Thanks @nastra for the review. Addressed comments.

@nastra nastra requested review from bryanck and rdblue June 29, 2023 06:47
Copy link
Contributor

@rdblue rdblue left a comment

Choose a reason for hiding this comment

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

Almost there! Looks like the only blocker is validating that the original metadata file is used. Just drop that assertion and this should be ready.

@krvikash krvikash force-pushed the rest-catalog-resiter-table-support branch from fa2b2a9 to 4527e8e Compare July 4, 2023 04:23
@krvikash
Copy link
Contributor Author

krvikash commented Jul 4, 2023

@rdblue, thank you for reviewing. I have addressed all comments.

@krvikash krvikash requested a review from rdblue July 4, 2023 18:41
@rdblue rdblue merged commit f3826bd into apache:master Jul 4, 2023
@rdblue
Copy link
Contributor

rdblue commented Jul 4, 2023

Thanks, @krvikash! Great to have this supported in the REST catalog.

@krvikash
Copy link
Contributor Author

krvikash commented Jul 5, 2023

Thanks @rdblue for merging. Thanks @nastra, @ajantha-bhat, @bryanck, @rdblue for the review.

@krvikash krvikash deleted the rest-catalog-resiter-table-support branch July 5, 2023 04:00
zhongyujiang pushed a commit to zhongyujiang/iceberg that referenced this pull request Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants