JingsongLi commented on code in PR #5101:
URL: https://github.com/apache/paimon/pull/5101#discussion_r1960851828


##########
paimon-common/src/main/java/org/apache/paimon/utils/InternalRowUtils.java:
##########
@@ -55,6 +55,56 @@
 /** Utils for {@link InternalRow} structures. */
 public class InternalRowUtils {
 
+    public static boolean equals(InternalRow row1, InternalRow row2, RowType 
rowType) {
+        int i = 0;
+        int len = rowType.getFieldCount();
+        while (i < len) {
+            Object data1 = get(row1, i, rowType.getTypeAt(i));
+            Object data2 = get(row2, i, rowType.getTypeAt(i));
+
+            if ((data1 == null) != (data2 == null)) {
+                return false;
+            }
+            if (data1 != null) {
+                if (data1 instanceof byte[]) {
+                    if (!java.util.Arrays.equals((byte[]) data1, (byte[]) 
data2)) {
+                        return false;
+                    }
+                } else if (data1 instanceof Float && 
java.lang.Float.isNaN((Float) data1)) {
+                    if (!java.lang.Float.isNaN((Float) data2)) {
+                        return false;
+                    }
+                } else if (data1 instanceof Double && 
java.lang.Double.isNaN((Double) data1)) {
+                    if (!java.lang.Double.isNaN((Double) data2)) {
+                        return false;
+                    }
+                } else {
+                    if (!data1.equals(data2)) {

Review Comment:
   If it is a complex structure, it should use Utils.equals too.



-- 
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: issues-unsubscr...@paimon.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to