[FLINK-12366][table] Clean up Catalog APIs to make them more consiste…#8312
[FLINK-12366][table] Clean up Catalog APIs to make them more consiste…#8312KurtYoung merged 3 commits intoapache:masterfrom
Conversation
|
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community Review Progress
Please see the Pull Request Review Guide for a full explanation of the review process. DetailsThe Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commandsThe @flinkbot bot supports the following commands:
|
bowenli86
left a comment
There was a problem hiding this comment.
Thanks Xuefu for the PR. As we synced offline, I marked a few places for your reference:
- Since we decided a few inclusion relationship among exceptions, e.g. TableNotExistException would include DatabaseNotExistException, so does PartitionNotException, we can update javadoc of these exception classes to indicate that relationship
- minor: a few private method "isPartitionedTable" and "isPartitionedSpecValid" also have implications, e.g.
isPartitionedTable()implies that callers need to check whether the table exists or not and throw exceptions before callingisPartitionedTable(). We can add javadoc for those implications too, and can dedup the logic, e.g. with that assumptionisParitionedTable()can assume the table always exist then - a few other line comments
Best,
Bowen
...link-table-api-java/src/main/java/org/apache/flink/table/catalog/GenericInMemoryCatalog.java
Outdated
Show resolved
Hide resolved
...n/src/main/java/org/apache/flink/table/catalog/exceptions/PartitionSpecInvalidException.java
Outdated
Show resolved
Hide resolved
...-table-api-java/src/test/java/org/apache/flink/table/catalog/GenericInMemoryCatalogTest.java
Outdated
Show resolved
Hide resolved
|
Thanks, @bowenli86! Updated the PR to address above your review feedback. |
|
@KurtYoung Would be good to have you take a look, and help to merge if there's no more concerns. Thanks! |
| */ | ||
| CatalogPartition getPartition(ObjectPath tablePath, CatalogPartitionSpec partitionSpec) | ||
| throws TableNotExistException, TableNotPartitionedException, PartitionSpecInvalidException, PartitionNotExistException, CatalogException; | ||
| throws PartitionNotExistException, CatalogException; |
There was a problem hiding this comment.
I don't quite get the idea why this function will not throw TableNotExistException, but listPartitions will. These two methods are both some kind of "get some partition from table".
There was a problem hiding this comment.
In short, partition not existing includes the case of table not existing. getPartition() attempts to get a specific partition for a table. If the table doesn't exist, then of course, the partition doesn't exist.
On the other hand, listPartition() fails (throws an exception) if the table doesn't exist, which is reasonable.
Just like getTable(), which doesn't throw databasenotexistEx when db doesn't exist. The change makes the behavior consistent across board.
|
LGTM, merging this |
…nt and coherent
What is the purpose of the change
Clean up existing catalog APIs to make them more consistent and coherent
Brief change log
Verifying this change
This change is already covered by existing tests. Tests are modified to reflect the proposed changes.
Does this pull request potentially affect one of the following parts:
@Public(Evolving): (no)Documentation