This is an automated email from the ASF dual-hosted git repository.
taragolis pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 324df8ed4c Change to lazy loading of io in pandas serializer (#34684)
324df8ed4c is described below
commit 324df8ed4c8b1fa63fc720b16359b08134550774
Author: Bolke de Bruin <[email protected]>
AuthorDate: Sun Oct 1 06:06:26 2023 +0200
Change to lazy loading of io in pandas serializer (#34684)
---
airflow/serialization/serializers/pandas.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/airflow/serialization/serializers/pandas.py
b/airflow/serialization/serializers/pandas.py
index 68c9ad8fba..d805e4b95c 100644
--- a/airflow/serialization/serializers/pandas.py
+++ b/airflow/serialization/serializers/pandas.py
@@ -17,7 +17,6 @@
# under the License.
from __future__ import annotations
-from io import BytesIO
from typing import TYPE_CHECKING
from airflow.utils.module_loading import qualname
@@ -63,6 +62,8 @@ def deserialize(classname: str, version: int, data: object)
-> pd.DataFrame:
if not isinstance(data, str):
raise TypeError(f"serialized {classname} has wrong data type
{type(data)}")
+ from io import BytesIO
+
with BytesIO(bytes.fromhex(data)) as buf:
df = pq.read_table(buf).to_pandas()