HyukjinKwon commented on a change in pull request #34058:
URL: https://github.com/apache/spark/pull/34058#discussion_r714711128
##########
File path: python/pyspark/pandas/frame.py
##########
@@ -2563,12 +2563,18 @@ def apply_func(pdf: pd.DataFrame) -> pd.DataFrame:
index_spark_columns = None
index_names: Optional[List[Optional[Tuple[Any, ...]]]] = None
- index_fields = None
+
if should_retain_index:
- index_spark_columns = [scol_for(sdf,
index_field.struct_field.name)]
- index_fields = [index_field]
- if index_field.struct_field.name != SPARK_DEFAULT_INDEX_NAME:
- index_names = [(index_field.struct_field.name,)]
+ index_spark_columns = [
+ scol_for(sdf, index_field.struct_field.name) for
index_field in index_fields
+ ]
+ if all(
+ [
+ index_field.struct_field.name !=
SPARK_DEFAULT_INDEX_NAME
Review comment:
Maybe we should use `SPARK_INDEX_NAME_PATTERN` and if the pattern
matches.
--
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]