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/25 07:13:27 UTC

[GitHub] [spark] zhengruifeng opened a new pull request, #38385: [SPARK-40907][PS][SQL] `PandasMode` should copy keys before inserting into Map

zhengruifeng opened a new pull request, #38385:
URL: https://github.com/apache/spark/pull/38385

   ### What changes were proposed in this pull request?
   Make `PandasMode` copy keys before inserting into Map
   
   
   ### Why are the changes needed?
   correctness issue similar to https://github.com/apache/spark/pull/38383
   
   ```
   In [24]: def f(index, iterator): return ['3', '3', '3', '3', '4'] if index == 3 else ['0', '1', '2', '3', '4']
   
   In [25]: rdd = sc.parallelize([1, ], 4).mapPartitionsWithIndex(f)
   
   In [26]: df = spark.createDataFrame(rdd, schema='string')
   
   In [27]: psdf = df.pandas_api()
   
   In [28]: psdf.mode()
   Out[28]: 
     value
   0     4
   
   In [29]: psdf._to_pandas().mode()
   Out[29]: 
     value
   0     3
   ```
   
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   
   ### How was this patch tested?
   added UT


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


[GitHub] [spark] HyukjinKwon closed pull request #38385: [SPARK-40907][PS][SQL] `PandasMode` should copy keys before inserting into Map

Posted by GitBox <gi...@apache.org>.
HyukjinKwon closed pull request #38385: [SPARK-40907][PS][SQL] `PandasMode` should copy keys before inserting into Map
URL: https://github.com/apache/spark/pull/38385


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


[GitHub] [spark] itholic commented on a diff in pull request #38385: [SPARK-40907][PS][SQL] `PandasMode` should copy keys before inserting into Map

Posted by GitBox <gi...@apache.org>.
itholic commented on code in PR #38385:
URL: https://github.com/apache/spark/pull/38385#discussion_r1004236295


##########
python/pyspark/pandas/tests/test_dataframe.py:
##########
@@ -6044,6 +6044,19 @@ def test_mode(self):
         with self.assertRaises(ValueError):
             psdf.mode(axis=2)
 
+        def f(index, iterator):
+            return ["3", "3", "3", "3", "4"] if index == 3 else ["0", "1", "2", "3", "4"]
+
+        rdd = self.spark.sparkContext.parallelize(
+            [
+                1,
+            ],
+            4,

Review Comment:
   nit: can we just is one or two line some thing like:
   
   ```python
   rdd = self.spark.sparkContext.parallelize([1], 4)
       .mapPartitionsWithIndex(f)
   ```
   
   ?? I suspect it's maybe adjusted by black script tho, 😂 



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


[GitHub] [spark] HyukjinKwon commented on pull request #38385: [SPARK-40907][PS][SQL] `PandasMode` should copy keys before inserting into Map

Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on PR #38385:
URL: https://github.com/apache/spark/pull/38385#issuecomment-1290692080

   Merged to master.


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


[GitHub] [spark] zhengruifeng commented on a diff in pull request #38385: [SPARK-40907][PS][SQL] `PandasMode` should copy keys before inserting into Map

Posted by GitBox <gi...@apache.org>.
zhengruifeng commented on code in PR #38385:
URL: https://github.com/apache/spark/pull/38385#discussion_r1004320912


##########
python/pyspark/pandas/tests/test_dataframe.py:
##########
@@ -6044,6 +6044,19 @@ def test_mode(self):
         with self.assertRaises(ValueError):
             psdf.mode(axis=2)
 
+        def f(index, iterator):
+            return ["3", "3", "3", "3", "4"] if index == 3 else ["0", "1", "2", "3", "4"]
+
+        rdd = self.spark.sparkContext.parallelize(
+            [
+                1,
+            ],
+            4,

Review Comment:
   it was just reformated by the script😅



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