HyukjinKwon commented on a change in pull request #27565: [WIP][SPARK-30791] 
Dataframe add sameSemantics and sementicHash method
URL: https://github.com/apache/spark/pull/27565#discussion_r379359352
 
 

 ##########
 File path: python/pyspark/sql/dataframe.py
 ##########
 @@ -2153,6 +2153,45 @@ def transform(self, func):
                                               "should have been DataFrame." % 
type(result)
         return result
 
+    @since(3.1)
+    def sameSemantics(self, other):
+        """
+        Return true when the query plan of the given :class:`DataFrame` will 
return the same
+        results as this :class:`DataFrame`.
+
+        >>> df1 = spark.createDataFrame([(1, 2),(4, 5)], ["col1", "col2"])
+        >>> df2 = spark.createDataFrame([(1, 2),(4, 5)], ["col0", "col2"])
+        >>> df3 = spark.createDataFrame([(0, 2),(4, 5)], ["col1", "col2"])
+        >>> df4 = spark.createDataFrame([(1, 2),(4, 5)], ["col1", "col2"])
+        >>> df1.sameSemantics(df2)
+        False
+        >>> df1.sameSemantics(df3)
+        False
+        >>> df1.sameSemantics(df4)
+        True
+        """
+        if not isinstance(other, DataFrame):
+            raise ValueError("other parameter should be of DataFrame; however, 
got %s" % type(other))
+        return self._jdf.sameSemantics(other._jdf)
+
+    @since(3.1)
+    def semanticHash(self):
+        """
+        Returns a `hashCode` for the calculation performed by the query plan 
of this Dataset.
 
 Review comment:
   ```
   Returns a hash code of the logical query plan against this 
:class:`DataFrame`.
   
   .. note:: Unlike the standard hash code, the hash is calculated against the 
query plan
       simplified by tolerating the cosmetic differences such as attribute 
names.
   ```

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to