You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "itholic (via GitHub)" <gi...@apache.org> on 2023/03/03 16:21:41 UTC

[GitHub] [spark] itholic commented on a diff in pull request #40270: [SPARK-42497][CONNECT][PYTHON][PS] Support `withSequenceColumn` as PySpark DataFrame internal function.

itholic commented on code in PR #40270:
URL: https://github.com/apache/spark/pull/40270#discussion_r1124690034


##########
python/pyspark/pandas/internal.py:
##########
@@ -911,10 +911,7 @@ def attach_distributed_sequence_column(sdf: SparkDataFrame, column_name: str) ->
         +--------+---+
         """
         if len(sdf.columns) > 0:
-            return SparkDataFrame(
-                sdf._jdf.toDF().withSequenceColumn(column_name),
-                sdf.sparkSession,
-            )
+            return sdf._withSequenceColumn(column_name)

Review Comment:
   I can say this fix is ​​the ultimate goal of this PR.
   
   The existing code doesn't work with Spark Connect, so it can't properly attach a distributed sequence index which is default index type in pandas API on Spark.



##########
python/pyspark/pandas/internal.py:
##########
@@ -911,10 +911,7 @@ def attach_distributed_sequence_column(sdf: SparkDataFrame, column_name: str) ->
         +--------+---+
         """
         if len(sdf.columns) > 0:
-            return SparkDataFrame(
-                sdf._jdf.toDF().withSequenceColumn(column_name),
-                sdf.sparkSession,
-            )
+            return sdf._withSequenceColumn(column_name)

Review Comment:
   I can say this part is ​​the ultimate goal of this PR.
   
   The existing code doesn't work with Spark Connect, so it can't properly attach a distributed sequence index which is default index type in pandas API on Spark.



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