You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2020/07/07 12:31:37 UTC

[GitHub] [iceberg] openinx commented on a change in pull request #1175: Generilize the BasePartitionkey to abstract the common codes for spark and flink.

openinx commented on a change in pull request #1175:
URL: https://github.com/apache/iceberg/pull/1175#discussion_r450827719



##########
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:
       It's quite confuse for me to see that the above else-if use `accessor.getClass() == PositionAccessor.class` while this line use `accessor instanceof Position2Accessor`.  I see that there's only one Position2Accessor implementation, so changing it from `instanceof`  to `=` should be OK here.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org