You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by gi...@apache.org on 2026/09/18 20:59:06 UTC

(iceberg-python) branch gh-readonly-queue/main/pr-3988-8c96d4211aa6571f2a31ad13d886cb25130a2ea0 created (now a63c87f8d)

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

github-merge-queue[bot] pushed a change to branch gh-readonly-queue/main/pr-3988-8c96d4211aa6571f2a31ad13d886cb25130a2ea0
in repository https://gitbox.apache.org/repos/asf/iceberg-python.git


      at a63c87f8d perf(types): avoid double iteration in transform_dict_value_to_str (#3988)

This branch includes the following new commits:

     new a63c87f8d perf(types): avoid double iteration in transform_dict_value_to_str (#3988)

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.



(iceberg-python) 01/01: perf(types): avoid double iteration in transform_dict_value_to_str (#3988)

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

github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-3988-8c96d4211aa6571f2a31ad13d886cb25130a2ea0
in repository https://gitbox.apache.org/repos/asf/iceberg-python.git

commit a63c87f8d8eb36d633eda39fbece7c2c92ab9efd
Author: Arul Jerald <12...@users.noreply.github.com>
AuthorDate: Fri Sep 18 20:14:03 2026 +0000

    perf(types): avoid double iteration in transform_dict_value_to_str (#3988)
    
    Combine the None-validation and str-conversion loops over dict.items()
    into a single pass, and rename the `dict` parameter to `d` to stop
    shadowing the builtin.
    
    Fixes #3987
---
 pyiceberg/types.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/pyiceberg/types.py b/pyiceberg/types.py
index fd1d8fc0a..525ec21dc 100644
--- a/pyiceberg/types.py
+++ b/pyiceberg/types.py
@@ -73,12 +73,14 @@ GEOMETRY_REGEX = re.compile(r"geometry(?:\(\s*['\"]([^'\"]+)['\"]\s*\))?$")
 GEOGRAPHY_REGEX = re.compile(r"geography(?:\(\s*['\"]([^'\"]+)['\"](?:\s*,\s*['\"]([^'\"]+)['\"])?\s*\))?$")
 
 
-def transform_dict_value_to_str(dict: dict[str, Any]) -> dict[str, str]:
+def transform_dict_value_to_str(d: dict[str, Any]) -> dict[str, str]:
     """Transform all values in the dictionary to string. Raise an error if any value is None."""
-    for key, value in dict.items():
+    result = {}
+    for key, value in d.items():
         if value is None:
             raise ValueError(f"None type is not a supported value in properties: {key}")
-    return {k: str(v).lower() if isinstance(v, bool) else str(v) for k, v in dict.items()}
+        result[key] = str(value).lower() if isinstance(value, bool) else str(value)
+    return result
 
 
 def _parse_decimal_type(decimal: Any) -> tuple[int, int]: