Fokko commented on code in PR #40:
URL: https://github.com/apache/iceberg-python/pull/40#discussion_r1352300965


##########
pyiceberg/avro/resolver.py:
##########
@@ -192,7 +194,28 @@ def visit_binary(self, binary_type: BinaryType) -> Writer:
         return BinaryWriter()
 
 
-def resolve(
+CONSTRUCT_WRITER_VISITOR = ConstructWriter()
+
+
+def resolve_writer(
+    data_schema: Union[Schema, IcebergType],
+    write_schema: Union[Schema, IcebergType],
+) -> Writer:
+    """Resolve the file and read schema to produce a reader.
+
+    Args:
+        data_schema (Schema | IcebergType): The schema of the Avro file.
+        write_schema (Schema | IcebergType): The requested read schema which 
is equal, subset or superset of the file schema.
+
+    Raises:
+        NotImplementedError: If attempting to resolve an unrecognized object 
type.
+    """
+    if write_schema == data_schema:
+        return construct_writer(write_schema)
+    return visit_with_partner(write_schema, data_schema, 
WriteSchemaResolver(), SchemaPartnerAccessor())  # type: ignore

Review Comment:
   Yes, this is because the arguments to the function, feel most natural from 
left to right. You have the data in some kind of schema, and you want to 
project that to some write schema.



-- 
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