-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Core: Support registerTable with REST session catalog #6512
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
Core: Support registerTable with REST session catalog #6512
Conversation
e2b1ce6 to
48e9e48
Compare
|
CI failure will be fixed with #6511 |
48e9e48 to
e12ef3a
Compare
core/src/main/java/org/apache/iceberg/jdbc/JdbcTableOperations.java
Outdated
Show resolved
Hide resolved
| .create(); | ||
| } | ||
|
|
||
| private boolean isValidIdentifier(TableIdentifier tableIdentifier) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
b35f367 to
9b38a8c
Compare
core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java
Outdated
Show resolved
Hide resolved
| .withProperties(tableProperties) | ||
| .withPartitionSpec(metadata.spec()) | ||
| .withSortOrder(metadata.sortOrder()) | ||
| .create(); |
There was a problem hiding this comment.
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.
rdblue
left a comment
There was a problem hiding this 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.
8784571 to
1477f27
Compare
Hi @rdblue, Thanks for the review. If I understood correctly, you wanted to introduce a new Please let me know if this is not what you intended to convey. |
|
CI Failure will be fixed by #6589 |
|
Thanks @rdblue for the review, I have addressed the comments. However, there are a few open conversations. |
core/src/main/java/org/apache/iceberg/rest/requests/RegisterTableRequest.java
Outdated
Show resolved
Hide resolved
|
(Modified |
1e49855 to
cd35e0a
Compare
|
(resolved conflicts) |
cd35e0a to
1ee587f
Compare
core/src/main/java/org/apache/iceberg/rest/requests/RegisterTableRequest.java
Outdated
Show resolved
Hide resolved
1ee587f to
6c86950
Compare
|
Thanks for reviewing @bryanck, Addressed comment. |
nastra
left a comment
There was a problem hiding this 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
6c86950 to
fa2b2a9
Compare
|
Thanks @nastra for the review. Addressed comments. |
core/src/test/java/org/apache/iceberg/catalog/CatalogTests.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/apache/iceberg/catalog/CatalogTests.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/apache/iceberg/catalog/CatalogTests.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/apache/iceberg/catalog/CatalogTests.java
Outdated
Show resolved
Hide resolved
rdblue
left a comment
There was a problem hiding this 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.
fa2b2a9 to
4527e8e
Compare
|
@rdblue, thank you for reviewing. I have addressed all comments. |
|
Thanks, @krvikash! Great to have this supported in the REST catalog. |
|
Thanks @rdblue for merging. Thanks @nastra, @ajantha-bhat, @bryanck, @rdblue for the review. |
Core: Support
registerTablewith REST session catalog