yegangy0718 commented on code in PR #7493:
URL: https://github.com/apache/iceberg/pull/7493#discussion_r1181957826


##########
flink/v1.17/flink/src/main/java/org/apache/iceberg/flink/data/RowDataProjection.java:
##########
@@ -254,4 +258,78 @@ public MapData getMap(int pos) {
   public RowData getRow(int pos, int numFields) {
     return (RowData) getValue(pos);
   }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) {
+      return true;
+    }
+
+    if (!(o instanceof RowDataProjection)) {
+      return false;
+    }
+
+    RowDataProjection that = (RowDataProjection) o;
+    return deepEquals(that);

Review Comment:
   do we need to check `o == null`?
   Inside `deepEquals`,  `other.getRowKind()` may fail if `other == null`



##########
flink/v1.17/flink/src/main/java/org/apache/iceberg/flink/data/RowDataProjection.java:
##########
@@ -254,4 +258,78 @@ public MapData getMap(int pos) {
   public RowData getRow(int pos, int numFields) {
     return (RowData) getValue(pos);
   }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) {
+      return true;
+    }
+
+    if (!(o instanceof RowDataProjection)) {
+      return false;
+    }
+
+    RowDataProjection that = (RowDataProjection) o;
+    return deepEquals(that);
+  }
+
+  @Override
+  public int hashCode() {
+    int result = Objects.hashCode(getRowKind());
+    for (int pos = 0; pos < getArity(); pos++) {
+      if (!isNullAt(pos)) {
+        // Arrays.deepHashCode handles array object properly
+        result = 31 * result + Arrays.deepHashCode(new Object[] 
{getValue(pos)});

Review Comment:
   curious, when calculating hashcode, do we need to take Map/List as a special 
case? Will `Arrays.deepHashCode` be able to handle that?  
   Or it's because `This projection will not project the nested children types 
of repeated types like lists and
      maps`, so we can ignore them?



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