You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by lz...@apache.org on 2022/07/06 07:22:24 UTC

[flink-table-store] branch master updated: [hotfix] Implement hashCode and equals for SparkScan

This is an automated email from the ASF dual-hosted git repository.

lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-table-store.git


The following commit(s) were added to refs/heads/master by this push:
     new 3a441875 [hotfix] Implement hashCode and equals for SparkScan
3a441875 is described below

commit 3a441875e280592ecd0d9b394e6a34aa9a690660
Author: JingsongLi <lz...@aliyun.com>
AuthorDate: Wed Jul 6 15:22:14 2022 +0800

    [hotfix] Implement hashCode and equals for SparkScan
---
 .../apache/flink/table/store/spark/SparkScan.java  | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/flink-table-store-spark/src/main/java/org/apache/flink/table/store/spark/SparkScan.java b/flink-table-store-spark/src/main/java/org/apache/flink/table/store/spark/SparkScan.java
index 564ca215..da96491d 100644
--- a/flink-table-store-spark/src/main/java/org/apache/flink/table/store/spark/SparkScan.java
+++ b/flink-table-store-spark/src/main/java/org/apache/flink/table/store/spark/SparkScan.java
@@ -33,6 +33,7 @@ import org.apache.spark.sql.connector.read.SupportsReportStatistics;
 import org.apache.spark.sql.types.StructType;
 
 import java.util.List;
+import java.util.Objects;
 import java.util.OptionalLong;
 
 /**
@@ -115,4 +116,25 @@ public class SparkScan implements Scan, SupportsReportStatistics {
             }
         };
     }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+
+        SparkScan that = (SparkScan) o;
+        return table.location().equals(that.table.location())
+                && readSchema().equals(that.readSchema())
+                && predicates.equals(that.predicates);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(table.location(), readSchema(), predicates);
+    }
 }