Repository navigation
Conversation
A Channel record carries a `metadata` field of type `Map<string, string>` (MCAP specification, op=0x04) holding whatever the recorder chose to record about the topic. ROS 2 writes `offered_qos_profiles` there, and rigs commonly add sensor serials or calibration identifiers. No message record reproduces it, so it was not reachable from the dataset at all: `include_metadata` added the schema and channel *ids*, but not the channel's own metadata map. Add it as a `channel_metadata` column under `include_metadata`. The column is typed explicitly as `map<string, string>` rather than left to inference. Arrow reads a Python dict as a `struct` whose fields are the union of the keys it happens to see, which has two consequences: blocks from two files recording different keys carry different types and raise ArrowInvalid on concat_tables, and a channel that never recorded a key becomes indistinguishable from one whose value is null. A map matches the specification's own type, keeps the block schema stable whatever the keys are, and concatenates across files. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request adds support for extracting and appending MCAP channel metadata as a map<string, string> column (named channel_metadata) when reading MCAP files via ray.data.read_mcap. This ensures that channel-level metadata, such as ROS 2 QoS profiles or sensor serials, is preserved and accessible across concatenated blocks. The review feedback suggests two key improvements: handling fallback pandas DataFrame blocks to prevent the metadata column from being silently omitted, and defensively handling cases where channel.metadata might be None or missing.
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
…tadata Signed-off-by: Marwan Sarieddine <[email protected]>
…lock _read_stream builds its blocks from dict rows, which DelegatingBlockBuilder always turns into an Arrow table, so the early return for other block types in _add_channel_metadata was unreachable -- and had it been reached, it would have returned the block without the column, silently. Replace it with an assertion, which also narrows the type for the checker. Raised in review on #65916. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
|
Merged current master into the branch (a merge commit, no history rewrite) so CI runs Both review threads are answered: the non-Arrow branch was unreachable and is now an assertion (a33c0bd), and |
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel of the sampled files is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel the sample did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel of the sampled files is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel the sample did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel of the sampled files is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel the sample did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel of the sampled files is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel the sample did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel of the sampled files is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel the sample did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel of the sampled files is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel the sample did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel of the sampled files is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel the sample did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel of the sampled files is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel the sample did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel of the sampled files is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel the sample did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel of the sampled files is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel the sample did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel of the sampled files is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel the sample did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel of the sampled files is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel the sample did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel of the sampled files is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel the sample did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel of the sampled files is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel the sample did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel of the sampled files is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel the sample did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel of the sampled files is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel the sample did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel of the sampled files is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel the sample did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel of the sampled files is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel the sample did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel of the sampled files is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel the sample did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel of the sampled files is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel the sample did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel of the sampled files is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel the sample did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel of the sampled files is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel the sample did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel planning did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. - `mcap_data_column` makes that decision. A selected channel that is not JSON in any sampled file plans `binary`, read from the summaries. The first sampled file with a selected message in `time_range` types the column from one chunk. A file whose summary cannot settle the selection is scanned, at most four per read. If the sample types nothing, up to 256 more listed files are checked by summary only. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel planning did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. - `mcap_data_column` makes that decision. A selected channel that is not JSON in any sampled file plans `binary`, read from the summaries. The first sampled file with a selected message in `time_range` types the column from one chunk. A file whose summary cannot settle the selection is scanned, at most four per read. If the sample types nothing, up to 256 more listed files are checked by summary only. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
…, row_id `read_mcap` reads a file in one task, so a job's parallelism is capped by its file count: ten 30 GB recordings are ten tasks on a 200-core cluster, and a GPU stage downstream waits for the first whole file. Every file is opened even when its summary already says it holds nothing the read selects. And no row has a stable identity, so a checkpointed pipeline has nothing to resume on. Put the reader on Datasource V2, where listing, sizing and pushdown are the framework's job, under `DataContext.use_datasource_v2` (the switch Parquet already uses). The legacy `MCAPDatasource` stays as the fallback. - `MCAPSummaryIndexer` lists files, reads each summary (two seeks, a few KB) and emits one listing row per chunk: the chunk's byte offset as its unit id, its uncompressed size as its weight. A file whose channels or time bounds cannot match the selection is dropped before any payload is read. A file with no summary is one whole-file row. - `OnlineBinPacker` groups chunks into read tasks of about 128 MiB uncompressed (`RAY_DATA_MCAP_BIN_PACKING_BYTES`), so a large recording is read by many tasks and small ones share one. - `MCAPReader` seeks straight to its chunks. With `log_time_order` it merges them through one heap of chunk indexes and messages, so only the chunks that overlap in time are decompressed at once; without it, file order. Tables are cut at `target_max_block_size`. - `row_id` (`include_row_id`, or automatically when the checkpoint config's `id_column` is `row_id`) names a message by its file, its chunk's byte offset and its position in the chunk, so the same message gets the same id however the read is split and whatever it selects. - Column pruning skips building (and for JSON channels, decoding) columns a projection dropped; a pushed limit stops a task early. - `data` holds decoded JSON values only when every selected channel is JSON-encoded; otherwise every payload stays bytes. Arrow has no column type for a mix of the two (the fallback is a pickled-object column the V2 path refuses), so the planned schema fixes the decision once and every reader follows it, failing with the message named on a payload that is not valid JSON or a channel planning did not see with another encoding. The legacy path kept raw bytes for a message that failed to parse, which poisoned the column the same way. - `mcap_data_column` makes that decision. A selected channel that is not JSON in any sampled file plans `binary`, read from the summaries. The first sampled file with a selected message in `time_range` types the column from one chunk. A file whose summary cannot settle the selection is scanned, at most four per read. If the sample types nothing, up to 256 more listed files are checked by summary only. Rows keep the legacy columns and types. Two additions: `schema_data` is dictionary-encoded (a schema is stored once per file but repeated on every row; ROS 2 definitions run kilobytes each) and `channel_metadata` carries the channel's metadata as a `map<string, string>`, the same changes #65913 and #65916 make to the legacy path. `TimeRange` moves next to the V2 datasource so `datasource_v2` does not import the legacy module; the old import path still works. Co-Authored-By: Claude Fable 5.1 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Marwan Sarieddine <[email protected]>
|
Closing: DataSource V2 (#66654) returns channel metadata as |
…, row_id (#66654) ## Description Part 1 of 3 of the `read_mcap` move to Datasource V2, based on master. #67166 is stacked on it, and #67167 on #67166. The rest of the `read_mcap` stack (#67189 onward) sits on top. **Problem.** One task reads one whole file: - Parallelism is capped by the file count: ten 30 GB recordings are ten tasks. - Every file is opened, even when its index shows it holds nothing selected. - Rows have no stable id, so a checkpointed pipeline cannot resume. **Change.** `read_mcap` moves to Datasource V2, on by default as for `read_parquet` (`DataContext.use_datasource_v2`). The legacy datasource stays as the fallback. ``` files │ listing: read each file's index (a few ranged reads) │ one row per chunk, weighted by the memory reading it takes │ drop chunks that cannot match topics / time_range ▼ chunk rows │ packing: about 128 MiB per read task │ one big file ──► many tasks; small files ──► one task │ with preserve_order: one task per file, in listing order ▼ read tasks: seek to their chunks, merge them by log time ``` - New code lives in `datasource_v2/formats/mcap/`. The V2 interfaces do not change. - Columns and types match the legacy path, with two changes. `schema_data` is dictionary-encoded. A new `channel_metadata` column holds each channel's metadata map as JSON text, dictionary-encoded, so a block stores it once per channel. - `data` holds decoded JSON only when every selected channel is JSON. Otherwise it holds bytes. Planning types it from the selected messages of the first chunk that holds one, as a read task types the messages it holds. - `row_id` is `<path>#c=<chunk offset>:<index>`, stable however the read is split. It is on with `include_row_id=True`, or automatically under `CheckpointConfig(id_column="row_id")`. - New `log_time_order` argument, default `True`. Each task returns each of its files in `log_time` order. With `preserve_order`, each file is read by one task, so it comes out in order from start to end, and files come out in the order they were listed. #67166 splits a large file there too, only where its order holds. - A file whose summary cannot be read gets a read task of its own, so `max_errored_blocks` can skip it alone. - The task size is `RAY_DATA_MCAP_BIN_PACKING_BYTES` (128 MiB). **Changed after the first review round.** Each is its own commit: - Summaries and chunks are read in a few ranged requests, not a few bytes per GET. - An unreadable file gets a read task of its own. - Tables are built column by column, cut counting every column, and chunks are weighted by the memory reading them takes. - The read stops at the row limit. - A file without a chunk index is sorted by log time. - `channel_metadata` is JSON text, stored once per block. - With `preserve_order`, each file is kept in one read task, and files keep their listing order. - Planning skips a chunk it cannot decode, and types `data` from the first chunk's messages. **Measured** on an 845 MB recording with 1,052 chunks: reading its 125 KB summary took about 20,000 GETs and now takes 3. **Decisions to confirm:** - Splitting is on by default. Block boundaries change; rows do not. - With `preserve_order`, this PR reads each file in one task, as the legacy reader does. #67166 lets it split a large file where its log-time order holds. - `ds.schema()` comes from the first chunk that holds a selected message. A field that first appears later is missing from it; the docstring says so. ## Related issues - Related to #65640 and #65641. - No open PR moves MCAP to Datasource V2. #66524 (ORC) and #66182 (Iceberg) are other formats moving to V2. - The generated-ID stack (#65886 to #65888) is orthogonal. - `log_time_order` comes from my #66653, now closed. My legacy-path PRs #65912, #65913 and #65916 are closed in favour of this one. ## Additional information ``` PYTHONPATH=python/ray/data/tests pytest python/ray/data/tests/datasource/test_mcap.py \ python/ray/data/tests/unit/datasource_v2/test_mcap_*.py \ python/ray/data/tests/unit/datasource_v2/test_online_bin_packer.py ``` 178 passed, 3 skipped. pre-commit and pyrefly clean. AI assistance (Claude Code) was used to draft this change; I reviewed every line and ran the tests above locally. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Marwan Sarieddine <[email protected]> Co-authored-by: Claude Fable 5.1 <[email protected]>
Description
A Channel record carries a
metadatafield of typeMap<string, string>— MCAP specification, op=0x04, "Metadata about this channel" — holding whatever the recorder chose to record about the topic. ROS 2 writesoffered_qos_profilesthere, and rigs commonly add sensor serials or calibration identifiers.No message record reproduces it, so today it is not reachable from the dataset at all.
include_metadata=Trueaddschannel_id,message_encoding,schema_name,schema_encodingandschema_data— the schema and the channel's id, but not the channel's own metadata map. A caller who needs it has to re-open the file with themcaplibrary alongside the Ray Data read.This adds a
channel_metadatacolumn under the existinginclude_metadataflag.The column is typed, not inferred
Arrow reads a Python dict as a
structwhose fields are the union of the keys it happens to see. Two consequences, both verified:promote_options="permissive"gets past it).None.A
map<string, string>matches the specification's own type, keeps the block schema stable whatever the keys are, and concatenates across files without promotion. It is built explicitly in_add_channel_metadatarather than added in_message_to_dict, since the builder would otherwise infer the struct.Verified on a real recording
A FAST-LIVO ROS 2 recording (Livox IMU + lidar + two compressed camera streams):
Every rosbag2-produced MCAP populates this field, so this is the common case rather than a corner one.
Why this is not a duplicate
I checked issues and PRs for
mcap,channel_metadataandmetadatain all states.schema_data) — closest overlap, and it touches the same two files. Its diff contains no reference tochannel_metadataorchannel.metadata; it deduplicates a column that already exists rather than adding one. It will conflict textually with this PR on theyieldat the end of_read_stream, where both wrapbuilder.build(). The two compose —_dictionary_encode_schema_data(_add_channel_metadata(builder.build(), channel_metadata))— and whichever lands second, I'll rebase.batch_size) modifies__init__and_read_stream's iteration, not the row contents.mcapin CI) is test infrastructure, now merged.Compatibility
include_metadata=Trueis the default, so this adds a column to the default output.read_mcapis@PublicAPI(stability="alpha"). Verified on this branch merged with current master, by running each operation rather than reasoning about it:union,repartition,sort,random_shuffleand batches spanning old and new blocks all work, and a Parquet directory holding files written before and after this change loads and reads normally.(key, value)pairs, the shapepyarrowgives a map.to_pandas()uses the Arrow-backedmap<string, string>dtype. A pandasmap_batchesround trip preserves the type; a NumPy round trip comes back aslist<list<string>>, because NumPy has no map type.ArrowTypeError: Sorting not supported for type map, which is Arrow's rule for maps, not something this PR can change.Happy to move it behind a separate flag if maintainers prefer.
Review follow-up
The helper used to return a non-Arrow block unchanged, which would have dropped the column silently. That branch was unreachable —
_read_streamonly ever builds Arrow blocks — and is now an assertion, so a non-Arrow block fails instead of losing data.Tests
22 passed on this branch merged with current master; master alone is 18. An earlier run reported one failure,
test_read_mcap_invalid_time_range— a pre-existing bad regex on master, since fixed by #65914. That PR also installedmcapin CI, so the CI run on the merge commit is the first for this PR that actually executes this file and type-checks it withmcap's types visible.Four new tests: the column carries the channel's metadata and is typed
map;include_metadata=Falseomits it; blocks from files with different metadata keys still concatenate (the reason for map over struct); and a channel recording no metadata yields an empty map rather than failing.Lint:
black,ruffclean on all three files.pyrefly checkwithmcapinstalled: 0 errors.AI assistance
AI assistance (Claude) was used for this change. I reviewed every changed line and ran the tests locally.