auroflow commented on code in PR #28797: URL: https://github.com/apache/flink/pull/28797#discussion_r3645000645
########## flink-python/pyflink/dataframe/convert.py: ########## @@ -0,0 +1,232 @@ +################################################################################ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +################################################################################ + +from typing import Any, Iterable, Iterator, List, Mapping, Optional, Sequence, Tuple, Union, cast + +from pyflink.dataframe.context import get_or_create_table_environment +from pyflink.dataframe.dataframe import DataFrame +from pyflink.util.api_stability_decorators import PublicEvolving + +__all__ = ["from_dict", "from_records"] + + +class _SequenceRowIterable: Review Comment: I intended to use them to make the rows reusable, because the Table API layer iterates the input twice, first during [schema inference](https://github.com/apache/flink/blob/f9485ff173b940c5ddf606d8ca1a92a18bb23ff3/flink-python/pyflink/table/table_environment.py#L1444), then during [conversion](https://github.com/apache/flink/blob/f9485ff173b940c5ddf606d8ca1a92a18bb23ff3/flink-python/pyflink/table/table_environment.py#L1452). A bare generator expression is exhausted by the first pass and produces an empty table. But I do agree the custom iterables are rather confusing. I changed both with list comprehensions, because these conversion methods are mainly for local debugging with small inputs, so we could afford some extra allocations in favor of readability here. WDYT? -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
