You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/06/07 01:40:14 UTC
[GitHub] [flink] dianfu commented on a diff in pull request #19883: [FLINK-27901][python] support TableEnvironment.create(configuration)
dianfu commented on code in PR #19883:
URL: https://github.com/apache/flink/pull/19883#discussion_r890690352
##########
flink-python/pyflink/table/table_environment.py:
##########
@@ -98,18 +99,25 @@ def __init__(self, j_tenv, serializer=PickleSerializer()):
self._open()
@staticmethod
- def create(environment_settings: EnvironmentSettings) -> 'TableEnvironment':
Review Comment:
Also update the documentation in https://nightlies.apache.org/flink/flink-docs-master/docs/dev/python/python_config/.
##########
flink-python/pyflink/table/table_environment.py:
##########
@@ -98,18 +99,25 @@ def __init__(self, j_tenv, serializer=PickleSerializer()):
self._open()
@staticmethod
- def create(environment_settings: EnvironmentSettings) -> 'TableEnvironment':
+ def create(conf_or_settings: Union[EnvironmentSettings, Configuration]) -> 'TableEnvironment':
Review Comment:
This will break backward compatibility. Users may write code as following `TableEnvironment.create(environment_settings=env_settings)`. What about keep the name not changed?
##########
flink-python/pyflink/table/table_environment.py:
##########
@@ -98,18 +99,25 @@ def __init__(self, j_tenv, serializer=PickleSerializer()):
self._open()
@staticmethod
- def create(environment_settings: EnvironmentSettings) -> 'TableEnvironment':
+ def create(conf_or_settings: Union[EnvironmentSettings, Configuration]) -> 'TableEnvironment':
"""
Creates a table environment that is the entry point and central context for creating Table
and SQL API programs.
- :param environment_settings: The environment settings used to instantiate the
+ :param conf_or_settings: The configuration or environment settings used to instantiate the
:class:`~pyflink.table.TableEnvironment`.
:return: The :class:`~pyflink.table.TableEnvironment`.
"""
gateway = get_gateway()
- j_tenv = gateway.jvm.TableEnvironment.create(
- environment_settings._j_environment_settings)
+ if isinstance(conf_or_settings, EnvironmentSettings):
+ environment_settings = conf_or_settings
+ elif isinstance(conf_or_settings, Configuration):
+ environment_settings = EnvironmentSettings.new_instance() \
Review Comment:
EnvironmentSettings.from_configuration(conf_or_settings)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org