You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "Fokko (via GitHub)" <gi...@apache.org> on 2023/07/05 08:05:54 UTC

[GitHub] [iceberg] Fokko commented on a diff in pull request #7782: Python: Bump to Pydantic v2

Fokko commented on code in PR #7782:
URL: https://github.com/apache/iceberg/pull/7782#discussion_r1252717531


##########
python/pyiceberg/types.py:
##########
@@ -34,27 +34,33 @@
 import re
 from typing import (
     Any,
+    Callable,
     ClassVar,
     Dict,
     Generator,
     Literal,
     Optional,
     Tuple,
+    Type,
+    TypeVar,
 )
 
-from pydantic import Field, PrivateAttr
-from pydantic.typing import AnyCallable
+from pydantic import (
+    Field,
+    PrivateAttr,
+    RootModel,
+    model_validator,
+)
 
 from pyiceberg.typedef import IcebergBaseModel
 from pyiceberg.utils.parsing import ParseNumberFromBrackets
-from pyiceberg.utils.singleton import Singleton
 
 DECIMAL_REGEX = re.compile(r"decimal\((\d+),\s*(\d+)\)")
 FIXED = "fixed"
 FIXED_PARSER = ParseNumberFromBrackets(FIXED)
 
 
-class IcebergType(IcebergBaseModel, Singleton):
+class IcebergType(IcebergBaseModel):

Review Comment:
   Currently, this is the case. The singleton will hash the arguments and if there is already an instance with the same arguments, it will be returned. I'm happy to change this to exclude:
   
   - NestedField
   - StructType
   - MapType
   - ListType
   
   Also, the FixedType, DecimalType, etc could be excluded.



-- 
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-unsubscribe@iceberg.apache.org

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


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