rdblue commented on a change in pull request #4016:
URL: https://github.com/apache/iceberg/pull/4016#discussion_r800233058



##########
File path: python/src/iceberg/types.py
##########
@@ -190,13 +242,25 @@ def __init__(self, element: NestedField):
     def element(self) -> NestedField:
         return self._element_field
 
-    def __eq__(self, other):
-        if type(self) is type(other):
-            return self.element == other.element
-        return False
 
+class MapType(IcebergType):
+    """A map type in Iceberg
+
+    Example:
+        >>> MapType(
+                NestedField(True, 1, "required_field", StringType()),

Review comment:
       Map keys are not allowed to be null. If we are creating a map by passing 
two `NestedField` instances, then we should check that. Same thing with names. 
Map key fields must be named "key" and map value fields must be named "value".
   
   This is why the Java API passes the types and field IDs instead of accepting 
nested fields:
   
   ```java
   MapType stringToIntMap = MapType.ofRequired(1, 2, StringType.get(), 
IntegerType.get());
   // Also defines `ofOptional`
   ```




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to