Ensure ConcatenationTable.cast uses target_schema metadata
{'login': 'dtuit', 'id': 8114067, 'node_id': 'MDQ6VXNlcjgxMTQwNjc=', 'avatar_url': 'https://avatars.githubusercontent.com/u/8114067?v=4', 'gravatar_id': '', 'url': 'https://api.github.com/users/dtuit', 'html_url': 'https://github.com/dtuit', 'followers_url': 'https://api.github.com/users/dtuit/followers', 'following_url': 'https://api.github.com/users/dtuit/following{/other_user}', 'gists_url': 'https://api.github.com/users/dtuit/gists{/gist_id}', 'starred_url': 'https://api.github.com/users/dtuit/starred{/owner}{/repo}', 'subscriptions_url': 'https://api.github.com/users/dtuit/subscriptions', 'organizations_url': 'https://api.github.com/users/dtuit/orgs', 'repos_url': 'https://api.github.com/users/dtuit/repos', 'events_url': 'https://api.github.com/users/dtuit/events{/privacy}', 'received_events_url': 'https://api.github.com/users/dtuit/received_events', 'type': 'User', 'site_admin': False}
[]
[]
Hi @lhoestq, Thanks for the detailed comment. I've tested the suggested approach and can confirm it works for the testcase outlined above! The PR is updated with the changes. _The documentation is not available anymore as the PR was closed or merged._
Currently, `ConcatenationTable.cast` does not use target_schema metadata when casting subtables. This causes an issue when using cast_column and the underlying table is a ConcatenationTable.

Code example of where issue arrises:
```
from datasets import Dataset, Image

column1 = [0, 1]
image_paths = ['/images/image1.jpg', '/images/image2.jpg']

ds = Dataset.from_dict({"column1": column1})
ds = ds.add_column("image", image_paths)
ds.cast_column("image", Image()) # Fails here
```
Output
```
...
TypeError: Couldn't cast array of type
string
to
{'bytes': Value(dtype='binary', id=None), 'path': Value(dtype='string', id=None)}
```

{'url': 'https://api.github.com/repos/huggingface/datasets/issues/4614/reactions', 'total_count': 0, '+1': 0, '-1': 0, 'laugh': 0, 'hooray': 0, 'confused': 0, 'heart': 0, 'rocket': 0, 'eyes': 0}
{'url': 'https://api.github.com/repos/huggingface/datasets/pulls/4614', 'html_url': 'https://github.com/huggingface/datasets/pull/4614', 'diff_url': 'https://github.com/huggingface/datasets/pull/4614.diff', 'patch_url': 'https://github.com/huggingface/datasets/pull/4614.patch', 'merged_at': '2022-07-19T13:36:24Z'}