You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2024/12/12 08:16:15 UTC

(iotdb) branch py_BetterErrorMsg created (now 867e11c5556)

This is an automated email from the ASF dual-hosted git repository.

haonan pushed a change to branch py_BetterErrorMsg
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at 867e11c5556 [Py-client] Print Dataset is closed error msg if user continues to fetch from it

This branch includes the following new commits:

     new 867e11c5556 [Py-client] Print Dataset is closed error msg if user continues to fetch from it

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.



(iotdb) 01/01: [Py-client] Print Dataset is closed error msg if user continues to fetch from it

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

haonan pushed a commit to branch py_BetterErrorMsg
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 867e11c55560a1f177b9f0b94c953a6a694b1d80
Author: HTHou <hh...@outlook.com>
AuthorDate: Thu Dec 12 16:15:51 2024 +0800

    [Py-client] Print Dataset is closed error msg if user continues to fetch from it
---
 iotdb-client/client-py/iotdb/Session.py               | 12 ++++++------
 iotdb-client/client-py/iotdb/utils/IoTDBRpcDataSet.py |  3 +++
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/iotdb-client/client-py/iotdb/Session.py b/iotdb-client/client-py/iotdb/Session.py
index bad50642820..23d1f65ccc7 100644
--- a/iotdb-client/client-py/iotdb/Session.py
+++ b/iotdb-client/client-py/iotdb/Session.py
@@ -516,7 +516,7 @@ class Session(object):
             )
             measurements = list(filtered_measurements)
             values = list(filtered_values)
-            if len(measurements) is 0 or len(values) is 0:
+            if len(measurements) == 0 or len(values) == 0:
                 logger.info("All inserting values are none!")
                 return
         request = self.gen_insert_str_record_req(
@@ -556,7 +556,7 @@ class Session(object):
             )
             measurements = list(filtered_measurements)
             values = list(filtered_values)
-            if len(measurements) is 0 or len(values) is 0:
+            if len(measurements) == 0 or len(values) == 0:
                 logger.info("All inserting values are none!")
                 return
         request = self.gen_insert_str_record_req(
@@ -605,7 +605,7 @@ class Session(object):
             measurements = list(filtered_measurements)
             data_types = list(filtered_data_types)
             values = list(filtered_values)
-            if len(measurements) is 0 or len(data_types) is 0 or len(values) is 0:
+            if len(measurements) == 0 or len(data_types) == 0 or len(values) == 0:
                 logger.info("All inserting values are none!")
                 return
         request = self.gen_insert_record_req(
@@ -651,7 +651,7 @@ class Session(object):
             ) = self.__filter_lists_by_values(
                 device_ids, times, measurements_lst, types_lst, values_lst
             )
-            if len(device_ids) is 0:
+            if len(device_ids) == 0:
                 logger.info("All inserting values are none!")
                 return
         if self.__enable_redirection:
@@ -734,7 +734,7 @@ class Session(object):
             measurements = list(filtered_measurements)
             data_types = list(filtered_data_types)
             values = list(filtered_values)
-            if len(measurements) is 0 or len(data_types) is 0 or len(values) is 0:
+            if len(measurements) == 0 or len(data_types) == 0 or len(values) == 0:
                 logger.info("All inserting values are none!")
                 return
         request = self.gen_insert_record_req(
@@ -780,7 +780,7 @@ class Session(object):
             ) = self.__filter_lists_by_values(
                 device_ids, times, measurements_lst, types_lst, values_lst
             )
-            if len(device_ids) is 0:
+            if len(device_ids) == 0:
                 logger.info("All inserting values are none!")
                 return
         if self.__enable_redirection:
diff --git a/iotdb-client/client-py/iotdb/utils/IoTDBRpcDataSet.py b/iotdb-client/client-py/iotdb/utils/IoTDBRpcDataSet.py
index b7e0613395c..c2e1648dfa9 100644
--- a/iotdb-client/client-py/iotdb/utils/IoTDBRpcDataSet.py
+++ b/iotdb-client/client-py/iotdb/utils/IoTDBRpcDataSet.py
@@ -25,6 +25,7 @@ import pandas as pd
 from thrift.transport import TTransport
 from iotdb.thrift.rpc.IClientRPCService import TSFetchResultsReq, TSCloseOperationReq
 from iotdb.tsfile.utils.DateUtils import parse_int_to_date
+from iotdb.utils.IoTDBConnectionException import IoTDBConnectionException
 from iotdb.utils.IoTDBConstants import TSDataType
 
 logger = logging.getLogger("IoTDB")
@@ -417,6 +418,8 @@ class IoTDBRpcDataSet(object):
         return df
 
     def fetch_results(self):
+        if self.__is_closed:
+            raise IoTDBConnectionException("This DataSet is already closed")
         self.__rows_index = 0
         request = TSFetchResultsReq(
             self.__session_id,