hongzhi-gao commented on code in PR #18638: URL: https://github.com/apache/iotdb/pull/18638#discussion_r4013465896
########## iotdb-client/client-py/iotdb/utils/Field.py: ########## @@ -16,12 +16,18 @@ # under the License. # -# for package -from iotdb.utils.IoTDBConstants import TSDataType -from iotdb.tsfile.utils.date_utils import parse_int_to_date -from iotdb.utils.rpc_utils import convert_to_timestamp, isoformat import numpy as np -import pandas as pd +from iotdb.tsfile.utils.date_utils import parse_int_to_date +from iotdb.utils.IoTDBConstants import TSDataType + + +def _is_missing(value): + if value is None: + return True + value_type = type(value) Review Comment: `pd.NA` cannot be referenced without importing pandas. Checking the sentinel type metadata preserves the existing null behavior while keeping pandas out of the normal row-iteration import path. ########## iotdb-client/client-py/iotdb/utils/SessionDataSet.py: ########## @@ -16,16 +16,17 @@ # under the License. # import logging -from typing import Optional +from typing import TYPE_CHECKING, Optional from iotdb.utils.Field import Field +from iotdb.utils.iotdb_rpc_dataset import IoTDBRpcDataSet # for package from iotdb.utils.IoTDBConstants import TSDataType -from iotdb.utils.iotdb_rpc_dataset import IoTDBRpcDataSet from iotdb.utils.RowRecord import RowRecord -import pandas as pd +if TYPE_CHECKING: + import pandas as pd Review Comment: Pandas is needed here only for static type checking. The runtime annotations are quoted, so importing and iterating a normal Session result does not load pandas. ########## iotdb-client/client-py/iotdb/utils/rpc_utils.py: ########## @@ -78,6 +74,10 @@ def verify_success_with_redirection_for_multi_devices(status: TSStatus, devices: def convert_to_timestamp(time: int, precision: str, timezone: str): + import pandas as pd + from pandas._libs import OutOfBoundsDatetime + from tzlocal import get_localzone_name Review Comment: These imports are intentionally local: timestamp conversion keeps returning the same pandas type, while queries that do not convert timestamps avoid loading pandas and tzlocal. -- 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]
