HyukjinKwon commented on code in PR #37995:
URL: https://github.com/apache/spark/pull/37995#discussion_r982998003
##########
python/pyspark/pandas/series.py:
##########
@@ -6442,6 +6445,8 @@ def argmin(self, axis: Axis = None, skipna: bool = True)
-> int:
raise ValueError("axis can only be 0 or 'index'")
sdf = self._internal.spark_frame.select(self.spark.column,
NATURAL_ORDER_COLUMN_NAME)
seq_col_name = verify_temp_column_name(sdf,
"__distributed_sequence_column__")
+
+ cached = sdf.cache()
Review Comment:
One option is to truncate the plan by explicitly materializing the RDD. For
example,
```python
DataFrame(spark._jsparkSession.internalCreateDataFrame(df._jdf.queryExecution().toRdd(),
df._jdf.schema(), False), df.sparkSession)
```
or
```scala
Dataset.ofRows(spark,
org.apache.spark.sql.execution.LogicalRDD(df.queryExecution.executedPlan.output,
df.queryExecution.toRdd)(spark))
```
in Scala side. In this way, it can avoid triggering additional executions by
`zipWithIndex`.
##########
python/pyspark/pandas/series.py:
##########
@@ -6442,6 +6445,8 @@ def argmin(self, axis: Axis = None, skipna: bool = True)
-> int:
raise ValueError("axis can only be 0 or 'index'")
sdf = self._internal.spark_frame.select(self.spark.column,
NATURAL_ORDER_COLUMN_NAME)
seq_col_name = verify_temp_column_name(sdf,
"__distributed_sequence_column__")
+
+ cached = sdf.cache()
Review Comment:
cc @ueshin FYI
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]