Make DuplicateKeysError more user friendly [For Issue #2556]
CONTRIBUTOR
> Nice thanks !
> 
> After your changes feel free to mark this PR as "ready for review" ;)

Marking PR ready for review.

@lhoestq Let me know if there is anything else required or if we are good to go ahead and merge.
2022-06-27T18:39:24Z
https://github.com/huggingface/datasets/pull/4545#issuecomment-1167737357
https://api.github.com/repos/huggingface/datasets/issues/4545
IC_kwDODunzps5FmkIN
https://api.github.com/repos/huggingface/datasets/issues/comments/1167737357/reactions
2022-06-27T18:39:24Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1167737357
https://avatars.githubusercontent.com/u/20517962?v=4
https://api.github.com/users/VijayKalmath/events{/privacy}
https://api.github.com/users/VijayKalmath/followers
https://api.github.com/users/VijayKalmath/following{/other_user}
https://api.github.com/users/VijayKalmath/gists{/gist_id}
https://github.com/VijayKalmath
VijayKalmath
MDQ6VXNlcjIwNTE3OTYy
https://api.github.com/users/VijayKalmath/orgs
https://api.github.com/users/VijayKalmath/received_events
https://api.github.com/users/VijayKalmath/repos
https://api.github.com/users/VijayKalmath/starred{/owner}{/repo}
https://api.github.com/users/VijayKalmath/subscriptions
User
https://api.github.com/users/VijayKalmath
public
NONE
_The documentation is not available anymore as the PR was closed or merged._
2022-06-28T09:02:13Z
https://github.com/huggingface/datasets/pull/4545#issuecomment-1168440596
https://api.github.com/repos/huggingface/datasets/issues/4545
IC_kwDODunzps5FpP0U
https://api.github.com/repos/huggingface/datasets/issues/comments/1168440596/reactions
2022-06-28T09:37:06Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1168440596
https://avatars.githubusercontent.com/u/99929124?v=4
https://api.github.com/users/HuggingFaceDocBuilderDev/events{/privacy}
https://api.github.com/users/HuggingFaceDocBuilderDev/followers
https://api.github.com/users/HuggingFaceDocBuilderDev/following{/other_user}
https://api.github.com/users/HuggingFaceDocBuilderDev/gists{/gist_id}
https://github.com/HuggingFaceDocBuilderDev
HuggingFaceDocBuilderDev
U_kgDOBfTMJA
https://api.github.com/users/HuggingFaceDocBuilderDev/orgs
https://api.github.com/users/HuggingFaceDocBuilderDev/received_events
https://api.github.com/users/HuggingFaceDocBuilderDev/repos
https://api.github.com/users/HuggingFaceDocBuilderDev/starred{/owner}{/repo}
https://api.github.com/users/HuggingFaceDocBuilderDev/subscriptions
User
https://api.github.com/users/HuggingFaceDocBuilderDev
public
# What does this PR do?

## Summary

*DuplicateKeysError error does not provide any information regarding the examples which have the same the key.*

*This information is very helpful for debugging the dataset generator script.*

## Additions
-

## Changes
- Changed `DuplicateKeysError Class` in `src/datasets/keyhash.py` to add current index and duplicate_key_indices to error message.
- Changed `check_duplicate_keys` function in `src/datasets/arrow_writer.py` to find indices of examples with duplicate hash if duplicate keys are found.

## Deletions
-

## To do  : 
- [x] Find way to find and print path `<Path to Dataset>` in Error message 

## Issues Addressed : 

Fixes #2556  