Skip to main content

Note:

  • For type definition, see Type Systems in Spec
  • int16_t[n]/vector<T> indicates int16_t[n]/vector<int16_t>
  • The cross-language serialization is not stable, do not use it in your production environment.

Type Mapping

Fury TypeFury Type IDJavaPythonJavascriptC++GolangRust
bool1bool/BooleanboolBooleanboolboolbool
int82byte/Byteint/pyfury.Int8Type.int8()int8_tint8i8
int163short/Shortint/pyfury.Int16Type.int16()int16_tint16i6
int324int/Integerint/pyfury.Int32Type.int32()int32_tint32i32
var_int325int/Integerint/pyfury.VarInt32Type.varint32()fury::varint32_tfury.varint32fury::varint32
int646long/Longint/pyfury.Int64Type.int64()int64_tint64i64
var_int647long/Longint/pyfury.VarInt64Type.varint64()fury::varint64_tfury.varint64fury::varint64
sli_int648long/Longint/pyfury.SliInt64Type.sliint64()fury::sliint64_tfury.sliint64fury::sliint64
float169float/Floatfloat/pyfury.Float16Type.float16()fury::float16_tfury.float16fury::f16
float3210float/Floatfloat/pyfury.Float32Type.float32()floatfloat32f32
float6411double/Doublefloat/pyfury.Float64Type.float64()doublefloat64f64
string12StringstrStringstringstringString/str
enum13Enum subclassesenum subclasses/enum/enum
list14List/Collectionlist/tuplearrayvectorsliceVec
set15Setset/setfury.SetSet
map16MapdictMapunordered_mapmapHashMap
duration17DurationtimedeltaNumberdurationDurationDuration
timestamp18InstantdatetimeNumberstd::chrono::nanosecondsTimeDateTime
decimal19BigDecimalDecimalbigint///
binary20byte[]bytes/uint8_t[n]/vector<T>[n]uint8/[]TVec<uint8_t>
array21arraynp.ndarray//array/sliceVec
bool_array22bool[]ndarray(np.bool_)/bool[n][n]bool/[]TVec<bool>
int8_array23byte[]ndarray(int8)/int8_t[n]/vector<T>[n]int8/[]TVec<i18>
int16_array24short[]ndarray(int16)/int16_t[n]/vector<T>[n]int16/[]TVec<i16>
int32_array25int[]ndarray(int32)/int32_t[n]/vector<T>[n]int32/[]TVec<i32>
int64_array26long[]ndarray(int64)/int64_t[n]/vector<T>[n]int64/[]TVec<i64>
float16_array27float[]ndarray(float16)/fury::float16_t[n]/vector<T>[n]float16/[]TVec<fury::f16>
float32_array28float[]ndarray(float32)/float[n]/vector<T>[n]float32/[]TVec<f32>
float64_array29double[]ndarray(float64)/double[n]/vector<T>[n]float64/[]TVec<f64>
tensor30//////
sparse tensor31//////
arrow record batch32//////
arrow table33//////

Type info(not implemented currently)

Due to differences between type systems of languages, those types can't be mapped one-to-one between languages.

If the user notices that one type on a language corresponds to multiple types in Fury type systems, for example, long in java has type int64/varint64/sliint64, it means the language lacks some types, and the user must provide extra type info when using Fury.

Type annotation

If the type is a field of another class, users can provide meta hints for fields of a type, or for the whole type. Such information can be provided in other languages too:

  • java: use annotation.
  • cpp: use macro and template.
  • golang: use struct tag.
  • python: use typehint.
  • rust: use macro.

Here is en example:

  • Java:

    class Foo {
    @Int32Type(varint = true)
    int f1;
    List<@Int32Type(varint = true) Integer> f2;
    }
  • Python:

    class Foo:
    f1: Int32Type(varint=True)
    f2: List[Int32Type(varint=True)]

Type wrapper

If the type is not a field of a class, the user must wrap this type with a Fury type to pass the extra type info.

For example, suppose Fury Java provide a VarInt64 type, when a user invoke fury.serialize(long_value), he need to invoke like fury.serialize(new VarInt64(long_value)).