Principle:Ray project Ray Cross Language Deserialization
| Knowledge Sources | |
|---|---|
| Domains | Serialization, Cross_Language_Interop |
| Last Updated | 2026-02-13 17:00 GMT |
Overview
A mechanism for decoding binary results from foreign-language workers into typed Java objects, with error handling for cross-language exceptions.
Description
Cross-Language Deserialization converts MessagePack-encoded bytes from Python or C++ workers back into Java objects. The decoder reads the 9-byte length header, unpacks the MessagePack value, and converts it to the expected Java type. If the foreign worker raised an exception, a CrossLanguageException is thrown with the formatted error string from the foreign runtime (e.g., Python traceback).
Usage
Deserialization is handled automatically when calling .get() on an ObjectRef from a cross-language task. The return type specified in the function descriptor determines the target Java type.
Theoretical Basis
Deserialization is the inverse of serialization. The key challenge is type mapping between language type systems. MessagePack provides a minimal type system (integers, floats, strings, binary, arrays, maps) that maps predictably to Java types.