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


##########
pyiceberg/io/pyarrow.py:
##########
@@ -2286,6 +2286,16 @@ def _cast_if_needed(self, field: NestedField, values: 
pa.Array) -> pa.Array:
                         elif target_type.unit == "us" and values.type.unit in 
{"s", "ms", "us"}:
                             return values.cast(target_type)
                     raise ValueError(f"Unsupported schema projection from 
{values.type} to {target_type}")
+                elif field.field_type == TimestamptzNanoType():
+                    # Writers label UTC differently (e.g. "+00:00"); relabel 
so files can be concatenated
+                    if (
+                        pa.types.is_timestamp(target_type)
+                        and target_type.tz == "UTC"
+                        and pa.types.is_timestamp(values.type)
+                        and values.type.unit == "ns"
+                        and (values.type.tz in UTC_ALIASES or values.type.tz 
is None)
+                    ):
+                        return values.cast(target_type)

Review Comment:
   Dropped the `raise` when resolving conflicts
   ```suggestion
                           return values.cast(target_type)
                       raise ValueError(f"Unsupported schema projection from 
{values.type} to {target_type}")
   ```



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