SEPURI-SAI-KRISHNA commented on PR #45043:
URL: https://github.com/apache/superset/pull/45043#issuecomment-6036187513

   I do not think this one holds. Taking the example as written:
   
   ```python
   df = pd.DataFrame([[1, 2, 3]], columns=["a", "a", "b"])
   list(df.rename(columns={"a": "c", "b": "a"}).columns)
   # ['c', 'c', 'a']
   ```
   
   Duplicate count is 1 before and 1 after, and `nunique` is 2 before and 2 
after, so nothing merged. The `c, c` pair is the pair that was already 
duplicated, relabelled. Master allows this mapping as well, so the guard is not 
changing behaviour here either.
   
   The premise is that an existing duplicate can be resolved. It cannot. 
`rename` maps by label, so every occurrence of `a` moves to the same target and 
a duplicate group can never be split. That makes the count monotone 
non-decreasing, which is why "the count went up" is exactly "two previously 
distinct labels merged", and that is the collision worth rejecting.
   
   Checked rather than argued. Over every mapping on frames of 1 to 4 columns 
drawn from 3 labels onto 4 targets, 6840 in all, the guard agrees with 
`nunique` dropping in every case and the count never decreased once:
   
   ```python
   guard = new.duplicated().sum() > idx.duplicated().sum()
   truth = new.nunique() < idx.nunique()
   # 6840 mappings checked, 0 disagreements
   ```
   
   If there is a case where the count does decrease I would like to see it, 
since that is the one thing that would break this.
   


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

Reply via email to