Skip to content

[FLINK-12366][table] Clean up Catalog APIs to make them more consiste…#8312

Merged
KurtYoung merged 3 commits intoapache:masterfrom
xuefuz:xuefu1
May 6, 2019
Merged

[FLINK-12366][table] Clean up Catalog APIs to make them more consiste…#8312
KurtYoung merged 3 commits intoapache:masterfrom
xuefuz:xuefu1

Conversation

@xuefuz
Copy link
Contributor

@xuefuz xuefuz commented Apr 29, 2019

…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

  • Clean up API signature regarding exception thrown
  • Improve error handling

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:

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (no)
  • The serializers: (no)
  • The runtime per-record code paths (performance sensitive): (no)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (no)
  • The S3 file system connector: (no)

Documentation

  • Does this pull request introduce a new feature? (no)
  • If yes, how is the feature documented? (avaDocs)

@flinkbot
Copy link
Collaborator

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.

Details
The 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 commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

Copy link
Member

@bowenli86 bowenli86 left a comment

Choose a reason for hiding this comment

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

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 calling isPartitionedTable(). We can add javadoc for those implications too, and can dedup the logic, e.g. with that assumption isParitionedTable() can assume the table always exist then
  • a few other line comments

Best,
Bowen

@xuefuz
Copy link
Contributor Author

xuefuz commented Apr 29, 2019

Thanks, @bowenli86! Updated the PR to address above your review feedback.

Copy link
Member

@bowenli86 bowenli86 left a comment

Choose a reason for hiding this comment

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

LGTM, +1

@bowenli86
Copy link
Member

@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;
Copy link
Contributor

Choose a reason for hiding this comment

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

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".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

@KurtYoung
Copy link
Contributor

LGTM, merging this

@KurtYoung KurtYoung merged commit 099106d into apache:master May 6, 2019
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