You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/10/11 06:31:47 UTC

[GitHub] [spark] amaliujia commented on a diff in pull request #38036: [SPARK-40601][PYTHON] Assert identical key size when cogrouping groups

amaliujia commented on code in PR #38036:
URL: https://github.com/apache/spark/pull/38036#discussion_r991864873


##########
python/pyspark/sql/pandas/group_ops.py:
##########
@@ -366,6 +366,10 @@ class PandasCogroupedOps:
     """
 
     def __init__(self, gd1: "GroupedData", gd2: "GroupedData"):
+        gel1 = gd1._jgd.groupingExprs().length()
+        gel2 = gd2._jgd.groupingExprs().length()
+        assert gel1 == gel2, f"group keys must have same size: {gel1} != {gel2}"

Review Comment:
   Nit: I thinking we can mention `Co-grouping` in the error message to better clarify this is from the cogroup operation?



##########
python/pyspark/sql/pandas/group_ops.py:
##########
@@ -366,6 +366,10 @@ class PandasCogroupedOps:
     """
 
     def __init__(self, gd1: "GroupedData", gd2: "GroupedData"):
+        gel1 = gd1._jgd.groupingExprs().length()
+        gel2 = gd2._jgd.groupingExprs().length()
+        assert gel1 == gel2, f"group keys must have same size: {gel1} != {gel2}"

Review Comment:
   Nit: I thinking we can mention `Cogroup` in the error message to better clarify this is from the cogroup operation?



-- 
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: reviews-unsubscribe@spark.apache.org

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


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