rdblue commented on a change in pull request #1175:
URL: https://github.com/apache/iceberg/pull/1175#discussion_r453073671
##########
File path: spark/src/main/java/org/apache/iceberg/spark/source/PartitionKey.java
##########
@@ -176,61 +70,22 @@ public int hashCode() {
}
}
- private static Accessor<InternalRow> newAccessor(int position, boolean
isOptional, Types.StructType type,
- Accessor<InternalRow>
accessor) {
+ @Override
+ protected Accessor<InternalRow> newAccessor(int position, boolean
isOptional, Types.StructType type,
+ Accessor<InternalRow> accessor) {
int size = type.fields().size();
if (isOptional) {
// the wrapped position handles null layers
return new WrappedPositionAccessor(position, size, accessor);
} else if (accessor.getClass() == PositionAccessor.class) {
return new Position2Accessor(position, size, (PositionAccessor)
accessor);
- } else if (accessor instanceof Position2Accessor) {
+ } else if (accessor.getClass() == Position2Accessor.class) {
Review comment:
Yes, this should be fine and is also more correct. Originally, both used
`instanceof`, but there was a bug when the behavior of `PositionAccessor` was
overridden. Replacing a `PositionAccessor` subclass with a `Position2Accessor`
removed the subclass's behavior. It is only safe to replace a
`PositionAccessor`, not a subclass.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]