Copilot commented on code in PR #17035:
URL: https://github.com/apache/iotdb/pull/17035#discussion_r2702144227
##########
iotdb-client/client-py/iotdb/utils/SessionDataSet.py:
##########
@@ -143,6 +143,24 @@ def construct_row_record_from_data_frame(self):
def close_operation_handle(self):
self.iotdb_rpc_data_set.close()
+ def has_next_df(self) -> bool:
+ """
+ Evaluate if there are more DataFrames to be fetched.
+ :return: whether there are more DataFrames to be fetched
+ """
+ # Check if buffer has data or if there are more results to fetch
+ rpc_ds = self.iotdb_rpc_data_set
+ return rpc_ds._has_buffered_data() or rpc_ds._has_next_result_set()
+
+ def next_df(self) -> "pd.DataFrame | None":
+ """
+ Get the next DataFrame from the result set.
+ Each returned DataFrame contains exactly fetch_size rows,
+ except for the last DataFrame which may contain fewer rows.
+ :return: the next DataFrame, or None if no more data
+ """
+ return self.iotdb_rpc_data_set.next_dataframe()
Review Comment:
The new streaming DataFrame API methods (has_next_df and next_df) lack test
coverage. Given that the project has comprehensive automated tests for other
DataFrame functionality (see test_todf.py, test_dataframe.py), these new
methods should also have integration tests to verify they correctly stream data
in chunks of fetch_size rows and handle edge cases like empty result sets and
partial final chunks.
##########
iotdb-client/client-py/iotdb/utils/SessionDataSet.py:
##########
@@ -143,6 +143,24 @@ def construct_row_record_from_data_frame(self):
def close_operation_handle(self):
self.iotdb_rpc_data_set.close()
+ def has_next_df(self) -> bool:
+ """
+ Evaluate if there are more DataFrames to be fetched.
+ :return: whether there are more DataFrames to be fetched
+ """
+ # Check if buffer has data or if there are more results to fetch
+ rpc_ds = self.iotdb_rpc_data_set
+ return rpc_ds._has_buffered_data() or rpc_ds._has_next_result_set()
+
+ def next_df(self) -> "pd.DataFrame | None":
Review Comment:
The return type annotation uses the modern Python 3.10+ union syntax
"pd.DataFrame | None", which is inconsistent with the project's style. The same
codebase uses Optional[pd.DataFrame] in iotdb_rpc_dataset.py line 256, and
imports Optional from typing. For consistency and better backward
compatibility, this should be changed to use Optional[pd.DataFrame] instead,
matching the pattern used in the underlying next_dataframe() method.
--
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]