Title: Deprecate `Dataset.export`
State: closed

Deprecate `Dataset.export` that generates a TFRecord file from a dataset as this method is undocumented, and the usage seems low. Users should use [TFRecordWriter](https://www.tensorflow.org/api_docs/python/tf/io/TFRecordWriter#write) or the official [TFRecord](https://www.tensorflow.org/tutorials/load_data/tfrecord) tutorial (on which this method is based) to write TFRecord files instead.

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.006680 / 0.011353 (-0.004673) | 0.003987 / 0.011008 (-0.007021) | 0.084677 / 0.038508 (0.046169) | 0.076800 / 0.023109 (0.053691) | 0.358338 / 0.275898 (0.082440) | 0.386573 / 0.323480 (0.063094) | 0.005370 / 0.007986 (-0.002616) | 0.003323 / 0.004328 (-0.001005) | 0.064238 / 0.004250 (0.059988) | 0.057859 / 0.037052 (0.020806) | 0.355408 / 0.258489 (0.096919) | 0.388302 / 0.293841 (0.094461) | 0.030784 / 0.128546 (-0.097762) | 0.008381 / 0.075646 (-0.067266) | 0.287971 / 0.419271 (-0.131300) | 0.053078 / 0.043533 (0.009545) | 0.352719 / 0.255139 (0.097580) | 0.370319 / 0.283200 (0.087119) | 0.023064 / 0.141683 (-0.118619) | 1.480661 / 1.452155 (0.028507) | 1.555711 / 1.492716 (0.062995) |

### 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.211289 / 0.018006 (0.193283) | 0.466957 / 0.000490 (0.466467) | 0.003760 / 0.000200 (0.003561) | 0.000076 / 0.000054 (0.000021) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.028552 / 0.037411 (-0.008859) | 0.084469 / 0.014526 (0.069943) | 0.096027 / 0.176557 (-0.080529) | 0.152170 / 0.737135 (-0.584965) | 0.096513 / 0.296338 (-0.199825) |

### 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.382940 / 0.215209 (0.167731) | 3.841735 / 2.077655 (1.764080) | 1.850575 / 1.504120 (0.346455) | 1.676554 / 1.541195 (0.135360) | 1.765241 / 1.468490 (0.296751) | 0.482131 / 4.584777 (-4.102646) | 3.512739 / 3.745712 (-0.232973) | 3.977042 / 5.269862 (-1.292820) | 2.387568 / 4.565676 (-2.178109) | 0.056657 / 0.424275 (-0.367618) | 0.007283 / 0.007607 (-0.000324) | 0.468193 / 0.226044 (0.242149) | 4.704077 / 2.268929 (2.435149) | 2.373467 / 55.444624 (-53.071157) | 2.002470 / 6.876477 (-4.874007) | 2.228280 / 2.142072 (0.086208) | 0.576908 / 4.805227 (-4.228320) | 0.132000 / 6.500664 (-6.368664) | 0.060544 / 0.075469 (-0.014926) |

### 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.256168 / 1.841788 (-0.585619) | 19.965458 / 8.074308 (11.891150) | 14.521435 / 10.191392 (4.330043) | 0.159156 / 0.680424 (-0.521268) | 0.018170 / 0.534201 (-0.516031) | 0.393019 / 0.579283 (-0.186264) | 0.415002 / 0.434364 (-0.019362) | 0.471810 / 0.540337 (-0.068528) | 0.658907 / 1.386936 (-0.728029) |

</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.006836 / 0.011353 (-0.004517) | 0.004067 / 0.011008 (-0.006942) | 0.066242 / 0.038508 (0.027734) | 0.078601 / 0.023109 (0.055491) | 0.369371 / 0.275898 (0.093473) | 0.402026 / 0.323480 (0.078546) | 0.006097 / 0.007986 (-0.001889) | 0.003337 / 0.004328 (-0.000991) | 0.065854 / 0.004250 (0.061603) | 0.057665 / 0.037052 (0.020612) | 0.379709 / 0.258489 (0.121219) | 0.406868 / 0.293841 (0.113027) | 0.031946 / 0.128546 (-0.096600) | 0.008691 / 0.075646 (-0.066955) | 0.071430 / 0.419271 (-0.347841) | 0.049518 / 0.043533 (0.005986) | 0.370439 / 0.255139 (0.115300) | 0.389235 / 0.283200 (0.106036) | 0.023730 / 0.141683 (-0.117953) | 1.509035 / 1.452155 (0.056880) | 1.548890 / 1.492716 (0.056173) |

### 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.229264 / 0.018006 (0.211258) | 0.445801 / 0.000490 (0.445312) | 0.000363 / 0.000200 (0.000163) | 0.000053 / 0.000054 (-0.000001) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.032377 / 0.037411 (-0.005034) | 0.091082 / 0.014526 (0.076556) | 0.104816 / 0.176557 (-0.071740) | 0.161040 / 0.737135 (-0.576095) | 0.105165 / 0.296338 (-0.191173) |

### 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.411012 / 0.215209 (0.195803) | 4.097256 / 2.077655 (2.019602) | 2.088686 / 1.504120 (0.584566) | 1.934429 / 1.541195 (0.393234) | 2.027387 / 1.468490 (0.558896) | 0.476262 / 4.584777 (-4.108515) | 3.518416 / 3.745712 (-0.227296) | 3.260919 / 5.269862 (-2.008943) | 2.041441 / 4.565676 (-2.524235) | 0.056302 / 0.424275 (-0.367973) | 0.007750 / 0.007607 (0.000143) | 0.489966 / 0.226044 (0.263922) | 4.915844 / 2.268929 (2.646916) | 2.617001 / 55.444624 (-52.827623) | 2.333557 / 6.876477 (-4.542920) | 2.484530 / 2.142072 (0.342458) | 0.572009 / 4.805227 (-4.233219) | 0.142557 / 6.500664 (-6.358107) | 0.066711 / 0.075469 (-0.008758) |

### 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.359929 / 1.841788 (-0.481859) | 20.332252 / 8.074308 (12.257943) | 14.585842 / 10.191392 (4.394450) | 0.170498 / 0.680424 (-0.509926) | 0.018450 / 0.534201 (-0.515751) | 0.395449 / 0.579283 (-0.183834) | 0.409666 / 0.434364 (-0.024698) | 0.467937 / 0.540337 (-0.072401) | 0.616078 / 1.386936 (-0.770858) |

</details>
</details>

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