Title: Allow hyphen in split name
Author: mariosasko (COLLABORATOR)
State: closed
Created: 2023-08-22T13:30:59Z

To fix https://discuss.huggingface.co/t/error-when-setting-up-the-dataset-viewer-streamingrowserror/51276.

Comments:
_The documentation is not available anymore as the PR was closed or merged._

<details>
<summary>Show benchmarks</summary>

PyArrow==8.0.0

<details>
<summary>Show updated benchmarks!</summary>

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.007342 / 0.011353 (-0.004011) | 0.004586 / 0.011008 (-0.006422) | 0.100430 / 0.038508 (0.061922) | 0.081053 / 0.023109 (0.057944) | 0.368130 / 0.275898 (0.092232) | 0.402852 / 0.323480 (0.079372) | 0.004504 / 0.007986 (-0.003482) | 0.003824 / 0.004328 (-0.000505) | 0.075326 / 0.004250 (0.071076) | 0.063329 / 0.037052 (0.026277) | 0.372837 / 0.258489 (0.114348) | 0.437857 / 0.293841 (0.144017) | 0.035512 / 0.128546 (-0.093034) | 0.009756 / 0.075646 (-0.065890) | 0.341035 / 0.419271 (-0.078236) | 0.060503 / 0.043533 (0.016970) | 0.362555 / 0.255139 (0.107416) | 0.409216 / 0.283200 (0.126017) | 0.030093 / 0.141683 (-0.111590) | 1.751550 / 1.452155 (0.299395) | 1.848676 / 1.492716 (0.355959) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.229448 / 0.018006 (0.211442) | 0.500300 / 0.000490 (0.499811) | 0.005195 / 0.000200 (0.004995) | 0.000092 / 0.000054 (0.000037) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.031753 / 0.037411 (-0.005658) | 0.096075 / 0.014526 (0.081549) | 0.111476 / 0.176557 (-0.065081) | 0.179236 / 0.737135 (-0.557899) | 0.113599 / 0.296338 (-0.182739) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.472817 / 0.215209 (0.257608) | 4.715029 / 2.077655 (2.637374) | 2.417934 / 1.504120 (0.913814) | 2.235014 / 1.541195 (0.693819) | 2.323588 / 1.468490 (0.855098) | 0.553751 / 4.584777 (-4.031026) | 4.153467 / 3.745712 (0.407755) | 3.858836 / 5.269862 (-1.411025) | 2.377499 / 4.565676 (-2.188178) | 0.066528 / 0.424275 (-0.357747) | 0.008979 / 0.007607 (0.001372) | 0.561076 / 0.226044 (0.335032) | 5.609817 / 2.268929 (3.340888) | 3.011098 / 55.444624 (-52.433526) | 2.594162 / 6.876477 (-4.282314) | 2.863597 / 2.142072 (0.721525) | 0.681135 / 4.805227 (-4.124092) | 0.158863 / 6.500664 (-6.341801) | 0.072551 / 0.075469 (-0.002918) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 1.492230 / 1.841788 (-0.349558) | 23.028828 / 8.074308 (14.954519) | 16.663265 / 10.191392 (6.471873) | 0.173146 / 0.680424 (-0.507278) | 0.021635 / 0.534201 (-0.512566) | 0.478919 / 0.579283 (-0.100364) | 0.472908 / 0.434364 (0.038544) | 0.547248 / 0.540337 (0.006910) | 0.770288 / 1.386936 (-0.616648) |

</details>
PyArrow==latest

<details>
<summary>Show updated benchmarks!</summary>

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.007728 / 0.011353 (-0.003625) | 0.004477 / 0.011008 (-0.006531) | 0.074858 / 0.038508 (0.036350) | 0.084266 / 0.023109 (0.061157) | 0.420280 / 0.275898 (0.144382) | 0.466835 / 0.323480 (0.143356) | 0.005980 / 0.007986 (-0.002006) | 0.003600 / 0.004328 (-0.000729) | 0.074941 / 0.004250 (0.070691) | 0.066414 / 0.037052 (0.029361) | 0.425949 / 0.258489 (0.167460) | 0.473236 / 0.293841 (0.179395) | 0.037213 / 0.128546 (-0.091333) | 0.009743 / 0.075646 (-0.065903) | 0.083758 / 0.419271 (-0.335513) | 0.057916 / 0.043533 (0.014383) | 0.423031 / 0.255139 (0.167892) | 0.451107 / 0.283200 (0.167907) | 0.028577 / 0.141683 (-0.113106) | 1.810509 / 1.452155 (0.358354) | 1.875579 / 1.492716 (0.382863) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.296052 / 0.018006 (0.278046) | 0.496618 / 0.000490 (0.496128) | 0.028667 / 0.000200 (0.028467) | 0.000140 / 0.000054 (0.000086) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.036694 / 0.037411 (-0.000717) | 0.110873 / 0.014526 (0.096347) | 0.126550 / 0.176557 (-0.050007) | 0.182924 / 0.737135 (-0.554212) | 0.123793 / 0.296338 (-0.172545) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.509881 / 0.215209 (0.294672) | 5.067402 / 2.077655 (2.989747) | 2.696028 / 1.504120 (1.191908) | 2.489861 / 1.541195 (0.948666) | 2.563400 / 1.468490 (1.094910) | 0.571184 / 4.584777 (-4.013593) | 4.154231 / 3.745712 (0.408519) | 3.891004 / 5.269862 (-1.378858) | 2.435290 / 4.565676 (-2.130387) | 0.065825 / 0.424275 (-0.358450) | 0.008460 / 0.007607 (0.000853) | 0.597579 / 0.226044 (0.371534) | 5.914954 / 2.268929 (3.646025) | 3.219305 / 55.444624 (-52.225319) | 2.843548 / 6.876477 (-4.032929) | 3.070300 / 2.142072 (0.928228) | 0.686018 / 4.805227 (-4.119209) | 0.160077 / 6.500664 (-6.340587) | 0.074058 / 0.075469 (-0.001411) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 1.598748 / 1.841788 (-0.243039) | 23.475685 / 8.074308 (15.401377) | 17.257831 / 10.191392 (7.066439) | 0.176539 / 0.680424 (-0.503885) | 0.021969 / 0.534201 (-0.512232) | 0.473565 / 0.579283 (-0.105718) | 0.465471 / 0.434364 (0.031107) | 0.567107 / 0.540337 (0.026769) | 0.783757 / 1.386936 (-0.603179) |

</details>
</details>

![](https://cml.dev/watermark.png#2f6bb450b4a3065a7d5fc50ea67711082749a337 "CML watermark")


Note that the https://github.com/huggingface/datasets-server/ explicitly relies on the fact that a split cannot contain a hyphen. cc @lhoestq 

We can't enable this that easily unfortunately because it could make arrow file names ambiguous in the cache.

e.g. dataset_name-train-0000-of-0008.arrow

Oh, this would indeed make the caching for the multi-proc case ambiguous. Implementing this is only worth it if we get more requests, so I'm closing this PR for now.