map() function removes columns when input_columns is not None
COLLABORATOR
Hi! Thanks for reporting! This looks like a bug. I've just opened a PR with the fix.
2022-09-12T18:09:38Z
https://github.com/huggingface/datasets/issues/4858#issuecomment-1244113159
https://api.github.com/repos/huggingface/datasets/issues/4858
IC_kwDODunzps5KJ6kH
https://api.github.com/repos/huggingface/datasets/issues/comments/1244113159/reactions
2022-09-12T18:09:38Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1244113159
https://avatars.githubusercontent.com/u/47462742?v=4
https://api.github.com/users/mariosasko/events{/privacy}
https://api.github.com/users/mariosasko/followers
https://api.github.com/users/mariosasko/following{/other_user}
https://api.github.com/users/mariosasko/gists{/gist_id}
https://github.com/mariosasko
mariosasko
MDQ6VXNlcjQ3NDYyNzQy
https://api.github.com/users/mariosasko/orgs
https://api.github.com/users/mariosasko/received_events
https://api.github.com/users/mariosasko/repos
https://api.github.com/users/mariosasko/starred{/owner}{/repo}
https://api.github.com/users/mariosasko/subscriptions
User
https://api.github.com/users/mariosasko
public
NONE
Awesome! Thank you. I'll close the issue once the PR gets merged. :-)
2022-09-12T20:19:13Z
https://github.com/huggingface/datasets/issues/4858#issuecomment-1244370148
https://api.github.com/repos/huggingface/datasets/issues/4858
IC_kwDODunzps5KK5Tk
https://api.github.com/repos/huggingface/datasets/issues/comments/1244370148/reactions
2022-09-12T20:19:13Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1244370148
https://avatars.githubusercontent.com/u/16939722?v=4
https://api.github.com/users/pramodith/events{/privacy}
https://api.github.com/users/pramodith/followers
https://api.github.com/users/pramodith/following{/other_user}
https://api.github.com/users/pramodith/gists{/gist_id}
https://github.com/pramodith
pramodith
MDQ6VXNlcjE2OTM5NzIy
https://api.github.com/users/pramodith/orgs
https://api.github.com/users/pramodith/received_events
https://api.github.com/users/pramodith/repos
https://api.github.com/users/pramodith/starred{/owner}{/repo}
https://api.github.com/users/pramodith/subscriptions
User
https://api.github.com/users/pramodith
public
MEMBER
I guess we should reopen after the revert by:
- #5006
2022-09-21T15:19:52Z
https://github.com/huggingface/datasets/issues/4858#issuecomment-1253861972
https://api.github.com/repos/huggingface/datasets/issues/4858
IC_kwDODunzps5KvGpU
https://api.github.com/repos/huggingface/datasets/issues/comments/1253861972/reactions
2022-09-21T15:19:52Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1253861972
https://avatars.githubusercontent.com/u/8515462?v=4
https://api.github.com/users/albertvillanova/events{/privacy}
https://api.github.com/users/albertvillanova/followers
https://api.github.com/users/albertvillanova/following{/other_user}
https://api.github.com/users/albertvillanova/gists{/gist_id}
https://github.com/albertvillanova
albertvillanova
MDQ6VXNlcjg1MTU0NjI=
https://api.github.com/users/albertvillanova/orgs
https://api.github.com/users/albertvillanova/received_events
https://api.github.com/users/albertvillanova/repos
https://api.github.com/users/albertvillanova/starred{/owner}{/repo}
https://api.github.com/users/albertvillanova/subscriptions
User
https://api.github.com/users/albertvillanova
public
## Describe the bug
The map function, removes features from the dataset that are not present in the _input_columns_ list of columns, despite the columns being removed not mentioned in the _remove_columns_ argument.
## Steps to reproduce the bug
```python
from datasets import Dataset
ds = Dataset.from_dict({"a" : [1,2,3],"b" : [0,1,0], "c" : [2,4,5]})

def double(x,y):
  x = x*2
  y = y*2
  return {"d" : x, "e" : y}

ds.map(double, input_columns=["a","c"])
```

## Expected results
```
Dataset({
    features: ['a', 'b', 'c', 'd', 'e'],
    num_rows: 3
})
```
## Actual results
```
Dataset({
    features: ['a', 'c', 'd', 'e'],
    num_rows: 3
})
```

In this specific example feature **b** should not be removed.

## Environment info
<!-- You can run the command `datasets-cli env` and copy-and-paste its output below. -->
- `datasets` version: 2.4.0
- Platform: linux (colab)
- Python version: 3.7.13
- PyArrow version: 6.0.1
