Skip to content

Conversation

shenzhu
Copy link
Contributor

@shenzhu shenzhu commented Nov 14, 2021

What is the purpose of the change

Add renameFunction() to Catalog.

Brief change log

  • Add renameFunction() to interface Catalog.java
  • Add implementations in GenericInMemoryCatalog.java, AbstractJdbcCatalog.java, HiveCatalog.java
  • Add unit tests in CatalogTests.java.

Verifying this change

This change added tests and can be verified as follows:

Unit tests were added to CatalogTests.java to cover new function.

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): (yes / no)
  • The serializers: (no)
  • The runtime per-record code paths (performance sensitive): (no)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
  • The S3 file system connector: (no)

Documentation

  • Does this pull request introduce a new feature? (no)

@flinkbot
Copy link
Collaborator

flinkbot commented Nov 14, 2021

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

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

Automated Checks

Last check on commit e50aa0d (Sun Nov 14 00:16:48 UTC 2021)

Warnings:

  • This pull request references an unassigned Jira ticket. According to the code contribution guide, tickets need to be assigned before starting with the implementation work.

Mention the bot in a comment to re-run the automated checks.

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.


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

* @throws FunctionAlreadyExistException if the function with newFunctionName already exists
* @throws CatalogException in case of any runtime exception
*/
void renameFunction(ObjectPath functionPath, String newFunctionName, boolean ignoreIfNotExists)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a breaking change. We should avoid this by default implementing the new method to throw an exception instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a breaking change. We should avoid this by default implementing the new method to throw an exception instead.

Hey Airblader, thanks for your review!
renameFunction is a new API, and I added implementations to all classes that implement this interface, including GenericInMemoryCatalog, AbstractJdbcCatalog, HiveCatalog and TestCatalog, it shouldn't break existing code. Do you mean add a default implementation in interface like this?

default void renameFunction(ObjectPath functionPath, String newFunctionName, boolean ignoreIfNotExists) throws FunctionNotExistException, FunctionAlreadyExistException, CatalogException {
    throw new UnsupportedOperationException();
}

Thanks for your time:)

Copy link
Contributor

Choose a reason for hiding this comment

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

You modified all the implementations within Flink, but Catalog is a public API, so adding new methods is a breaking change, because user's custom implementations will no longer work without modification. So yes, it'd be good to default implement it as you showed in your comment, of course with a nice message for the exception.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey Airblader, sorry I didn't realize that, thanks for your explanation! I will add a default implementation to throw an exception.

@shenzhu shenzhu marked this pull request as ready for review November 15, 2021 04:22
@shenzhu
Copy link
Contributor Author

shenzhu commented Nov 26, 2021

Hey @JingsongLi , thanks for assigning the ticket to me! Would you mind taking a look at this PR when you have a moment?

Copy link
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

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

Sorry for the late reply, I think we can add test for HiveCatalog.

@JingsongLi
Copy link
Contributor

Maybe in HiveCatalogUdfITCase?

@JingsongLi JingsongLi self-requested a review November 29, 2021 03:03
@shenzhu shenzhu force-pushed the szhu/FLINK-15826/rename-function branch from 4e6d4e3 to b6a9b9e Compare November 29, 2021 07:28
Copy link
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

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

Thanks @shenzhu ! Looks good to me!
@Airblader and @wuchong , do you have other comments?

@shenzhu shenzhu force-pushed the szhu/FLINK-15826/rename-function branch from b6a9b9e to 52f18f5 Compare November 29, 2021 18:16
@shenzhu
Copy link
Contributor Author

shenzhu commented Nov 30, 2021

Hey @Airblader ,

I got some architecture tests failing for this PR, the failing messages are as follows

java.lang.AssertionError: Architecture Violation [Priority: MEDIUM] - Rule 'Return and argument types of methods annotated with @PublicEvolving must be annotated with @Public(Evolving).' was violated (3 times):
org.apache.flink.table.catalog.Catalog.renameFunction(org.apache.flink.table.catalog.ObjectPath, java.lang.String, boolean): Argument leaf type org.apache.flink.table.catalog.ObjectPath does not satisfy: reside outside of package 'org.apache.flink..' or annotated with @Public or annotated with @PublicEvolving or annotated with @Deprecated
org.apache.flink.table.catalog.Catalog.renameFunction(org.apache.flink.table.catalog.ObjectPath, java.lang.String, boolean): Exception leaf type org.apache.flink.table.catalog.exceptions.FunctionAlreadyExistException does not satisfy: reside outside of package 'org.apache.flink..' or annotated with @Public or annotated with @PublicEvolving or annotated with @Deprecated
org.apache.flink.table.catalog.Catalog.renameFunction(org.apache.flink.table.catalog.ObjectPath, java.lang.String, boolean): Exception leaf type org.apache.flink.table.catalog.exceptions.FunctionNotExistException does not satisfy: reside outside of package 'org.apache.flink..' or annotated with @Public or annotated with @PublicEvolving or annotated with @Deprecated

Later I added @PublicEvolving annotation and that fixed these tests, however, I thought ObjectPath, FunctionAlreadyExists and FunctionNotExists are not intended for public use(not sure I'm correct here). Based on the README, should I create a JIRA issue for this?

Thanks for your help!

@Airblader
Copy link
Contributor

@shenzhu I'm addressing those in #17898. In the meantime for this PR you can add the violations to the file since you're only exposing additional usages of those classes and not really new kinds of violations.

I don't know if ObjectPath was ever intended to be public, but de facto it simply is now — the Catalog interface entirely relies on it.

@Airblader
Copy link
Contributor

@shenzhu My PR was merged now. If you rebase I think those violations should not show up anymore.

@shenzhu shenzhu force-pushed the szhu/FLINK-15826/rename-function branch from c693223 to 1adea58 Compare December 1, 2021 01:01
@shenzhu
Copy link
Contributor Author

shenzhu commented Dec 1, 2021

@shenzhu My PR was merged now. If you rebase I think those violations should not show up anymore.

Hey @Airblader , thanks for your PR! I just rebased my code, would you mind taking a look at this PR when you have a moment?

@shenzhu
Copy link
Contributor Author

shenzhu commented Feb 28, 2022

Hey @wuchong , would you mind taking a look at this PR when you have a moment? Thanks!

Copy link

This PR is being marked as stale since it has not had any activity in the last 180 days.
If you would like to keep this PR alive, please leave a comment asking for a review.
If the PR has merge conflicts, update it with the latest from the base branch.

If you are having difficulty finding a reviewer, please reach out to the [community](https://flink.apache.org/what-is-flink/community/).

If this PR is no longer valid or desired, please feel free to close it. If no activity occurs in the next 90 days, it will be automatically closed.

Copy link

This PR has been closed since it has not had any activity in 120 days.
If you feel like this was a mistake, or you would like to continue working on it,
please feel free to re-open the PR and ask for a review.

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.

6 participants