Expand description
Registries for custom data: JSON (de)serialization and Arrow encode/decode.
Mirrors Python’s register_serializable_type and register_arrow in custom.py.
The registry only stores type name -> callbacks for lookup; each type provides
its own deserialize/encode/decode via the trait or registration.
Functions§
- decode_
custom_ from_ arrow - Decodes a
RecordBatchintoVec<Data>using the registered decoder. - deserialize_
custom_ from_ json - Looks up and runs the JSON deserializer for the given type name.
Returns
Noneif the type is not registered. - encode_
custom_ to_ arrow - Encodes a slice of custom data trait objects to a
RecordBatchusing the registered encoder. - ensure_
arrow_ registered - Registers Arrow schema, encoder, and decoder for the given custom data type name if not already
registered. If the type is already registered, returns
Ok(())without overwriting (idempotent). Use this where repeated registration can occur (e.g. module init). - ensure_
json_ deserializer_ registered - Registers a JSON deserializer for the given custom data type name if not already registered.
If the type is already registered, returns
Ok(())without overwriting (idempotent). Use this where repeated registration can occur (e.g. module init). - ensure_
py_ extractor_ registered - Registers a
PyExtractorfor the given custom data type name if not already registered. If the type is already registered, returnsOk(())without overwriting (idempotent). Use this where repeated registration can occur (e.g. module init). - ensure_
rust_ extractor_ factory_ registered - Registers a factory that produces a
PyExtractorfor the given type name if not already registered. If the type is already registered, returnsOk(())without overwriting (idempotent). Use this where repeated registration can occur (e.g. module load). - ensure_
rust_ extractor_ registered - Registers a Rust custom data type for Python extraction if not already registered.
If the type is already registered, returns
Ok(())without overwriting (idempotent). Use this where repeated registration can occur (e.g. module load). - get_
arrow_ schema - Returns the Arrow schema for the given custom type name, if registered.
- get_
rust_ extractor - Calls the registered factory for the given type name and returns the extractor, if any.
- register_
arrow - Registers Arrow schema, encoder, and decoder for the given custom data type name.
- register_
json_ deserializer - Registers a JSON deserializer for the given custom data type name.
When
Data::deserializesees this type name, it will call this function. - register_
py_ extractor - Registers a
PyExtractorfor the given custom data type name. Used byCustomDataconstructor to convert Python objects toArc<dyn CustomDataTrait>. - register_
rust_ extractor - Registers a Rust custom data type for Python extraction. Call once per type at module load
(e.g. in the persistence PyO3 module). Uses
register_rust_extractor_factorywith a factory that builds the extractor forT. - register_
rust_ extractor_ factory - Registers a factory that produces a
PyExtractorfor the given type name. Crates (e.g. persistence) call this at load time for each Rust custom data type. Whenregister_custom_data_class(cls)is called with that type’s class, the factory is invoked and the extractor is registered in the mainPyExtractorregistry. - try_
extract_ from_ py - Tries to extract
Arc<dyn CustomDataTrait>from a Python object using the registered extractor. Returns None if no extractor is registered or extraction fails.