shuiqiangchen commented on a change in pull request #13572:
URL: https://github.com/apache/flink/pull/13572#discussion_r503118365
##########
File path: flink-python/pyflink/datastream/stream_execution_environment.py
##########
@@ -711,6 +713,17 @@ def from_collection(self, collection: List[Any],
:param type_info: The TypeInformation for the produced data stream
:return: the data stream representing the given collection.
"""
+ if type_info is None:
+ if any(isinstance(element, (dict, tuple, list)) for element in
collection) or \
+ any(hasattr(element, "__dict__") for element in
collection):
+ data_type = _infer_schema_from_data(collection)
+ else:
+ data_type = _infer_type(collection)
+ converter = _create_converter(data_type)
Review comment:
Maybe we can design a covert util for DataStream collection elements
based on user provided typeInfo. Introducing DataTypes for Table/SQL API in
DataStream API is also a bit confusing.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]