Skip to content
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

[FLINK-17902][python] Support the new interfaces about temporary functions in PyFlink #12476

Closed
wants to merge 3 commits into from
Closed

[FLINK-17902][python] Support the new interfaces about temporary functions in PyFlink #12476

wants to merge 3 commits into from

Conversation

SteNicholas
Copy link
Member

What is the purpose of the change

TableEnvironment in PyFlink should be consistent with the interfaces such as createTemporarySystemFunction, dropTemporarySystemFunction, createFunction, dropFunction, createTemporaryFunction, dropTemporaryFunction in the Java TableEnvironment.

Brief change log

  • TableEnvironment add the interfaces including createTemporarySystemFunction, dropTemporarySystemFunction, createFunction, dropFunction, createTemporaryFunction, dropTemporaryFunction.

Verifying this change

  • TableEnvironmentTest and BatchTableEnvironmentTests add method test_create_drop_java_function to verify whether interface createTemporarySystemFunction, dropTemporarySystemFunction, createFunction, dropFunction, createTemporaryFunction, dropTemporaryFunction could work.

Does this pull request potentially affect one of the following parts:

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

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

@flinkbot
Copy link
Collaborator

flinkbot commented Jun 4, 2020

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 b874a61 (Thu Jun 04 05:47:46 UTC 2020)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!

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

@flinkbot
Copy link
Collaborator

flinkbot commented Jun 4, 2020

CI report:

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

Copy link
Contributor

@dianfu dianfu left a comment

Choose a reason for hiding this comment

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

@SteNicholas Thanks a lot for the PR. I think we should support both the Java and Python functions for these interfaces just like register_function and register_java_function does. What do you think?

@@ -147,30 +147,185 @@ def get_catalog(self, catalog_name):
else:
return None

def load_module(self, module_name: str, module: Module):
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the reason of this change? We are to support type hint in 1.12 and so it will be good if the newly introduced interfaces uses type hint.

Copy link
Member Author

Choose a reason for hiding this comment

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

@dianfu I followed the code style from previous, and unified the parameter style. Therefore, I removed the type hint.

@SteNicholas SteNicholas requested a review from dianfu June 5, 2020 10:58
@@ -154,7 +155,9 @@ def load_module(self, module_name: str, module: Module):
ValidationException is thrown when there is already a module with the same name.

:param module_name: Name of the :class:`~pyflink.table.Module`.
:type module_name: str
Copy link
Contributor

Choose a reason for hiding this comment

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

could be removed since the type information is already available in the typehint.

@@ -166,11 +169,254 @@ def unload_module(self, module_name: str):
ValidationException is thrown when there is no module with the given name.

:param module_name: Name of the :class:`~pyflink.table.Module`.
:type module_name: str
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

"""
Registers a java user defined function class as a temporary system function.

Compared to .. seealso:: :func:`create_temporary_function`, system functions are identified
Copy link
Contributor

Choose a reason for hiding this comment

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

create_temporary_function -> create_java_temporary_function

"""
Registers a java user defined function class as a temporary catalog function.

Compared to .. seealso:: :func:`create_temporary_system_function` with a globally defined
Copy link
Contributor

Choose a reason for hiding this comment

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

create_temporary_system_function -> create_java_temporary_system_function

"""
return self._j_tenv.dropTemporarySystemFunction(name)

def create_java_function(self, path: str, function_class_name: str,
Copy link
Contributor

Choose a reason for hiding this comment

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

should also add create_function?

Copy link
Member Author

Choose a reason for hiding this comment

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

@dianfu You are right, this method for python should be supported. I think we could new a pull request for this. In this pull request, just consistent with Java interface.

@SteNicholas SteNicholas requested a review from dianfu June 8, 2020 05:43
dianfu pushed a commit to dianfu/flink that referenced this pull request Jun 9, 2020
@dianfu dianfu closed this in 74231f7 Jun 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants