Skip to content

Commit 9c5fd70

Browse files
committed
Remove broken OoB-check from union deserializer
1 parent 5f77d7b commit 9c5fd70

File tree

5 files changed

+9
-71
lines changed

5 files changed

+9
-71
lines changed

crates/build/re_types_builder/src/codegen/rust/deserializer.rs

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -348,23 +348,15 @@ pub fn quote_arrow_deserializer(
348348

349349
quote! {
350350
let #data_dst = {
351-
// NOTE: `data_src` is a runtime collection of all of the
352-
// input's payload's union arms, while `#type_id` is our comptime union
353-
// arm counter… there's no guarantee it's actually there at
354-
// runtime!
355-
if #data_src.type_ids().inner().len() <= #type_id {
356-
// By not returning an error but rather defaulting to an empty
357-
// vector, we introduce some kind of light forwards compatibility:
358-
// old clients that don't yet know about the new arms can still
359-
// send data in.
360-
return Ok(Vec::new());
361-
362-
// return Err(DeserializationError::missing_union_arm(
363-
// #quoted_datatype, #obj_field_fqname, #type_id,
364-
// )).with_context(#obj_fqname);
365-
}
366-
367-
// NOTE: indexing is safe: checked above.
351+
// `.child()` will panic if the given `type_id` doesn't exist,
352+
// which could happen if the number of union arms has changed
353+
// between serialization and deserialization.
354+
// There is no simple way to check for this using `arrow-rs`
355+
// (no access to `UnionArray::fields` as of arrow 54:
356+
// https://docs.rs/arrow/latest/arrow/array/struct.UnionArray.html)
357+
//
358+
// Still, we're planning on removing arrow unions entirely, so this is… fine.
359+
// TODO(#6388): stop using arrow unions, and remove this peril
368360
let #data_src = #data_src.child(#type_id).as_ref();
369361
#quoted_deserializer.collect::<Vec<_>>()
370362
}

crates/store/re_types/src/datatypes/tensor_buffer.rs

Lines changed: 0 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/store/re_types/src/testing/datatypes/affix_fuzzer3.rs

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/store/re_types/src/testing/datatypes/affix_fuzzer4.rs

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/store/re_types_core/src/datatypes/time_range_boundary.rs

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)