puchengy commented on code in PR #83:
URL: https://github.com/apache/iceberg-python/pull/83#discussion_r1365869931


##########
pyiceberg/schema.py:
##########
@@ -1273,6 +1273,102 @@ def primitive(self, primitive: PrimitiveType) -> 
PrimitiveType:
         return primitive
 
 
+# Implementation copied from Apache Iceberg repo.
+def make_compatible_name(name: str) -> str:
+    if not _valid_avro_name(name):
+        return _sanitize_name(name)
+    return name
+
+
+def _valid_avro_name(name: str) -> bool:
+    length = len(name)
+    assert length > 0, "Empty name"
+    first = name[0]
+    if not (first.isalpha() or first == '_'):
+        return False
+
+    for i in range(1, length):
+        character = name[i]
+        if not (character.isalnum() or character == '_'):
+            return False

Review Comment:
   thanks, I actually asked chatgpt to rewrite the java implementation in 
iceberg repo to me, so it is not knowing iceberg-python styling.



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to