This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 258412cb36 [python] Fix bytes bug and isort (#6052)
258412cb36 is described below
commit 258412cb3662cc2d96999a5cb1efd606ebd2ac34
Author: umi <[email protected]>
AuthorDate: Mon Aug 11 16:30:16 2025 +0800
[python] Fix bytes bug and isort (#6052)
---
paimon-python/dev/auto-check.sh | 1 +
paimon-python/pypaimon/api/auth.py | 1 -
paimon-python/pypaimon/catalog/catalog_factory.py | 2 +-
paimon-python/pypaimon/catalog/rest/rest_catalog.py | 11 ++++-------
paimon-python/pypaimon/common/config.py | 2 +-
paimon-python/pypaimon/common/file_io.py | 1 -
paimon-python/pypaimon/table/row/binary_row.py | 2 +-
paimon-python/pypaimon/tests/rest_catalog_test.py | 8 +++++++-
8 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/paimon-python/dev/auto-check.sh b/paimon-python/dev/auto-check.sh
index 4f6ed56617..e7e46d3762 100755
--- a/paimon-python/dev/auto-check.sh
+++ b/paimon-python/dev/auto-check.sh
@@ -24,3 +24,4 @@ cd "$(dirname "$SCRIPT_PATH")/.." || exit
autopep8 ./ --global-config=./dev/cfg.ini
autoflake --config=./dev/cfg.ini ./
+isort ./
diff --git a/paimon-python/pypaimon/api/auth.py
b/paimon-python/pypaimon/api/auth.py
index 9582a65596..de20d96c8e 100644
--- a/paimon-python/pypaimon/api/auth.py
+++ b/paimon-python/pypaimon/api/auth.py
@@ -25,7 +25,6 @@ from collections import OrderedDict
from datetime import datetime, timezone
from typing import Dict, Optional
-
from pypaimon.common.config import CatalogOptions
from .token_loader import DLFToken, DLFTokenLoader, DLFTokenLoaderFactory
diff --git a/paimon-python/pypaimon/catalog/catalog_factory.py
b/paimon-python/pypaimon/catalog/catalog_factory.py
index 36b3e4b55a..7bae23be7e 100644
--- a/paimon-python/pypaimon/catalog/catalog_factory.py
+++ b/paimon-python/pypaimon/catalog/catalog_factory.py
@@ -15,8 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################
-from pypaimon.catalog.catalog import Catalog
from pypaimon.api.options import Options
+from pypaimon.catalog.catalog import Catalog
from pypaimon.catalog.catalog_context import CatalogContext
from pypaimon.catalog.filesystem_catalog import FileSystemCatalog
from pypaimon.catalog.rest.rest_catalog import RESTCatalog
diff --git a/paimon-python/pypaimon/catalog/rest/rest_catalog.py
b/paimon-python/pypaimon/catalog/rest/rest_catalog.py
index 006d8161ed..f597f059f8 100644
--- a/paimon-python/pypaimon/catalog/rest/rest_catalog.py
+++ b/paimon-python/pypaimon/catalog/rest/rest_catalog.py
@@ -16,23 +16,20 @@ See the License for the specific language governing
permissions and
limitations under the License.
"""
from pathlib import Path
-from typing import Dict, List, Optional, Union, Callable, Any
+from typing import Any, Callable, Dict, List, Optional, Union
from urllib.parse import urlparse
-from pypaimon.api import RESTApi, CatalogOptions
-from pypaimon.api.api_response import PagedList, GetTableResponse
-
-from pypaimon.common.file_io import FileIO
-
+from pypaimon.api import CatalogOptions, RESTApi
+from pypaimon.api.api_response import GetTableResponse, PagedList
from pypaimon.api.options import Options
from pypaimon.catalog.catalog import Catalog
from pypaimon.catalog.catalog_context import CatalogContext
-
from pypaimon.catalog.database import Database
from pypaimon.catalog.property_change import PropertyChange
from pypaimon.catalog.rest.rest_token_file_io import RESTTokenFileIO
from pypaimon.catalog.table_metadata import TableMetadata
from pypaimon.common.core_options import CoreOptions
+from pypaimon.common.file_io import FileIO
from pypaimon.common.identifier import Identifier
from pypaimon.schema.schema import Schema
from pypaimon.schema.table_schema import TableSchema
diff --git a/paimon-python/pypaimon/common/config.py
b/paimon-python/pypaimon/common/config.py
index 4bfcc418e7..0478c207bb 100644
--- a/paimon-python/pypaimon/common/config.py
+++ b/paimon-python/pypaimon/common/config.py
@@ -37,7 +37,7 @@ class CatalogOptions:
WAREHOUSE = "warehouse"
TOKEN_PROVIDER = "token.provider"
TOKEN = "token"
- DATA_TOKEN_ENABLED = "data.token.enabled"
+ DATA_TOKEN_ENABLED = "data-token.enabled"
DLF_REGION = "dlf.region"
DLF_ACCESS_KEY_ID = "dlf.access-key-id"
DLF_ACCESS_KEY_SECRET = "dlf.access-key-secret"
diff --git a/paimon-python/pypaimon/common/file_io.py
b/paimon-python/pypaimon/common/file_io.py
index 50ecae96cb..f1b40e2239 100644
--- a/paimon-python/pypaimon/common/file_io.py
+++ b/paimon-python/pypaimon/common/file_io.py
@@ -26,7 +26,6 @@ from urllib.parse import splitport, urlparse
import pyarrow
from pyarrow._fs import FileSystem
-
from pypaimon.common.config import OssOptions, S3Options
from pypaimon.schema.data_types import PyarrowFieldParser
diff --git a/paimon-python/pypaimon/table/row/binary_row.py
b/paimon-python/pypaimon/table/row/binary_row.py
index 7da19062fb..2e44ff417e 100644
--- a/paimon-python/pypaimon/table/row/binary_row.py
+++ b/paimon-python/pypaimon/table/row/binary_row.py
@@ -258,7 +258,7 @@ class BinaryRowSerializer:
variable_data = []
variable_offsets = []
- current_offset = 0
+ current_offset = fixed_part_size
for i, (value, field) in enumerate(zip(binary_row.values,
binary_row.fields)):
if value is None:
diff --git a/paimon-python/pypaimon/tests/rest_catalog_test.py
b/paimon-python/pypaimon/tests/rest_catalog_test.py
index f9db015db0..9d3429a225 100644
--- a/paimon-python/pypaimon/tests/rest_catalog_test.py
+++ b/paimon-python/pypaimon/tests/rest_catalog_test.py
@@ -71,13 +71,16 @@ class RESTCatalogTest(unittest.TestCase):
('user_id', pa.int64()),
('item_id', pa.int64()),
('behavior', pa.string()),
- ('dt', pa.string())
+ ('dt', pa.string()),
+ ('long-dt', pa.string())
])
self.raw_data = {
'user_id': [1, 2, 3, 4, 5, 6, 7, 8],
'item_id': [1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008],
'behavior': ['a', 'b', 'c', None, 'e', 'f', 'g', 'h'],
'dt': ['p1', 'p1', 'p2', 'p1', 'p2', 'p1', 'p2', 'p2'],
+ 'long-dt': ['2024-10-10', '2024-10-10', '2024-10-10',
'2024-01-01', '2024-10-10', '2025-01-23',
+ 'abcdefghijklmnopk', '2025-08-08']
}
self.expected = pa.Table.from_pydict(self.raw_data,
schema=self.pa_schema)
@@ -167,6 +170,7 @@ class RESTCatalogTest(unittest.TestCase):
'item_id': [1001, 1002, 1003, 1004],
'behavior': ['a', 'b', 'c', None],
'dt': ['p1', 'p1', 'p2', 'p1'],
+ 'long-dt': ['2024-10-10', '2024-10-10', '2024-10-10', '2024-01-01']
}
expect = pa.Table.from_pydict(data, schema=self.pa_schema)
@@ -445,6 +449,7 @@ class RESTCatalogTest(unittest.TestCase):
'item_id': [1001, 1002, 1003, 1004],
'behavior': ['a', 'b', 'c', None],
'dt': ['p1', 'p1', 'p2', 'p1'],
+ 'long-dt': ['2024-10-10', '2024-10-10', '2024-10-10',
'2024-01-01'],
}
pa_table = pa.Table.from_pydict(data1, schema=self.pa_schema)
table_write.write_arrow(pa_table)
@@ -460,6 +465,7 @@ class RESTCatalogTest(unittest.TestCase):
'item_id': [1005, 1006, 1007, 1008],
'behavior': ['e', 'f', 'g', 'h'],
'dt': ['p2', 'p1', 'p2', 'p2'],
+ 'long-dt': ['2024-10-10', '2025-01-23', 'abcdefghijklmnopk',
'2025-08-08'],
}
pa_table = pa.Table.from_pydict(data2, schema=self.pa_schema)
table_write.write_arrow(pa_table)