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/09/05 01:01:05 UTC

[GitHub] [spark] itholic commented on a diff in pull request #42787: [SPARK-43241][PS] `MultiIndex.append` not checking names for equality

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


##########
python/pyspark/pandas/indexes/base.py:
##########
@@ -1917,18 +1917,12 @@ def append(self, other: "Index") -> "Index":
         sdf_other = other._internal.spark_frame.select(other._internal.index_spark_columns)
         sdf_appended = sdf_self.union(sdf_other)
 
-        # names should be kept when MultiIndex, but Index wouldn't keep its name.
-        if isinstance(self, MultiIndex):
-            index_names = self._internal.index_names
-        else:
-            index_names = None
-
         internal = InternalFrame(
             spark_frame=sdf_appended,
             index_spark_columns=[
                 scol_for(sdf_appended, col) for col in self._internal.index_spark_column_names
             ],
-            index_names=index_names,
+            index_names=None,

Review Comment:
   We can simply set the `index_names` to `None` to follow the behavior of Pandas, since Pandas doesn't keep the name of `MultiIndex` when computing the `append` from Pandas 2.0.0. (See https://github.com/pandas-dev/pandas/pull/48288 more detail)
   
   cc @zhengruifeng @HyukjinKwon as CI passed.



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