rdblue commented on code in PR #40:
URL: https://github.com/apache/iceberg-python/pull/40#discussion_r1351006286
##########
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:
Did this reverse the order that `write_schema` and `data_schema` were passed
in? Above it says the `data_schema` is the schema of the Avro file, but here it
looks like it matches what I think makes sense, which is that it is the schema
of the data in memory...
We should make sure we have consistency in the schema order.
--
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]