HyukjinKwon commented on a change in pull request #33634:
URL: https://github.com/apache/spark/pull/33634#discussion_r683915361
##########
File path: python/pyspark/pandas/indexes/base.py
##########
@@ -2292,9 +2292,7 @@ def union(
sdf_self =
self._internal.spark_frame.select(self._internal.index_spark_columns)
sdf_other =
other_idx._internal.spark_frame.select(other_idx._internal.index_spark_columns)
- sdf = sdf_self.union(sdf_other.subtract(sdf_self))
- if isinstance(self, MultiIndex):
- sdf = sdf.drop_duplicates()
+ sdf =
sdf_self.unionAll(sdf_other).exceptAll(sdf_self.intersectAll(sdf_other))
if sort:
Review comment:
@itholic, did you refer to this?
> Bug in Index.union() and MultiIndex.union() dropping duplicate Index
values when Index was not monotonic or sort was set to False (GH36289, GH31326,
GH40862)
It sounds like now it drops duplicates but the codes above look keeping the
duplicates. Should we also at least check `sort` and drop duplicates?
--
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]