From e1be9cec88a6bf563bd1ef6d80caee198c1bb61b Mon Sep 17 00:00:00 2001 From: cccs-eric Date: Wed, 27 Apr 2022 11:23:15 -0400 Subject: [PATCH] fix(local-fs): handling non-iterator response from local fs interface (#4) --- .../iceberg/core/filesystem/filesystem_table_operations.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python_legacy/iceberg/core/filesystem/filesystem_table_operations.py b/python_legacy/iceberg/core/filesystem/filesystem_table_operations.py index 94aece2..3beb2ca 100644 --- a/python_legacy/iceberg/core/filesystem/filesystem_table_operations.py +++ b/python_legacy/iceberg/core/filesystem/filesystem_table_operations.py @@ -17,6 +17,7 @@ import logging from pathlib import Path +from typing import Iterator import uuid from iceberg.exceptions import CommitFailedException, ValidationException @@ -127,7 +128,10 @@ def read_version_hint(self): else: with fs.open(version_hint_file, "r") as fo: # return int(fo.readline().replace("\n", "")) - return int(next(fo.readline())) + line = fo.readline() + if isinstance(line, Iterator): + return int(next(line)) + return int(line) def write_version_hint(self, version): version_hint_file = str(self.version_hint_file())