You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by di...@apache.org on 2020/09/10 03:18:09 UTC
[flink] branch python_dsl_from_elements created (now 56dc056)
This is an automated email from the ASF dual-hosted git repository.
dianfu pushed a change to branch python_dsl_from_elements
in repository https://gitbox.apache.org/repos/asf/flink.git.
at 56dc056 fix tests
This branch includes the following new commits:
new 56dc056 fix tests
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[flink] 01/01: fix tests
Posted by di...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
dianfu pushed a commit to branch python_dsl_from_elements
in repository https://gitbox.apache.org/repos/asf/flink.git
commit 56dc056bb0e4eebe438a82949d3b62796999db2b
Author: Dian Fu <di...@apache.org>
AuthorDate: Thu Sep 10 11:04:05 2020 +0800
fix tests
---
flink-python/pyflink/table/table_environment.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/flink-python/pyflink/table/table_environment.py b/flink-python/pyflink/table/table_environment.py
index 49a0480..2c32502 100644
--- a/flink-python/pyflink/table/table_environment.py
+++ b/flink-python/pyflink/table/table_environment.py
@@ -1359,9 +1359,11 @@ class TableEnvironment(object):
:return: The result table.
:rtype: pyflink.table.Table
"""
+ if "__len__" not in dir(elements):
+ elements = list(elements)
# in case all the elements are expressions
- if all(isinstance(elem, Expression) for elem in elements):
+ if len(elements) > 0 and all(isinstance(elem, Expression) for elem in elements):
if schema is None:
return Table(self._j_tenv.fromValues(to_expression_jarray(elements)), self)
else:
@@ -1390,9 +1392,6 @@ class TableEnvironment(object):
def verify_obj(obj):
return obj
- if "__len__" not in dir(elements):
- elements = list(elements)
-
# infers the schema if not specified
if schema is None or isinstance(schema, (list, tuple)):
schema = _infer_schema_from_data(elements, names=schema)