This is an automated email from the ASF dual-hosted git repository.
chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fory-site.git
The following commit(s) were added to refs/heads/main by this push:
new 379e86478 🔄 synced local 'docs/specification/' with remote
'docs/specification/'
379e86478 is described below
commit 379e864789d70499b2c130b626102f61fbc0259a
Author: chaokunyang <[email protected]>
AuthorDate: Mon Jan 5 05:12:54 2026 +0000
🔄 synced local 'docs/specification/' with remote 'docs/specification/'
---
docs/specification/xlang_serialization_spec.md | 189 ++++++++++++++-----------
docs/specification/xlang_type_mapping.md | 106 +++++++-------
2 files changed, 161 insertions(+), 134 deletions(-)
diff --git a/docs/specification/xlang_serialization_spec.md
b/docs/specification/xlang_serialization_spec.md
index 80992c776..d653c5180 100644
--- a/docs/specification/xlang_serialization_spec.md
+++ b/docs/specification/xlang_serialization_spec.md
@@ -40,10 +40,10 @@ This specification defines the Fory xlang binary format.
The format is dynamic r
- int8: a 8-bit signed integer.
- int16: a 16-bit signed integer.
- int32: a 32-bit signed integer.
-- var_int32: a 32-bit signed integer which use fory var_int32 encoding.
+- var32: a 32-bit signed integer which use fory variable-length encoding.
- int64: a 64-bit signed integer.
-- var_int64: a 64-bit signed integer which use fory PVL encoding.
-- sli_int64: a 64-bit signed integer which use fory SLI encoding.
+- var64: a 64-bit signed integer which use fory PVL encoding.
+- h64: a 64-bit signed integer which use fory Hybrid encoding.
- float16: a 16-bit floating point number.
- float32: a 32-bit floating point number.
- float64: a 64-bit floating point number including NaN and Infinity.
@@ -154,41 +154,52 @@ custom types (struct/ext/enum). User type IDs are in a
separate namespace and co
| 2 | INT8 | 8-bit signed integer
|
| 3 | INT16 | 16-bit signed integer
|
| 4 | INT32 | 32-bit signed integer
|
-| 5 | VAR_INT32 | Variable-length encoded 32-bit signed
integer |
+| 5 | VAR32 | Variable-length encoded 32-bit signed
integer |
| 6 | INT64 | 64-bit signed integer
|
-| 7 | VAR_INT64 | Variable-length encoded 64-bit signed
integer |
-| 8 | SLI_INT64 | Small Long as Int encoded 64-bit signed
integer |
-| 9 | FLOAT16 | 16-bit floating point (half precision)
|
-| 10 | FLOAT32 | 32-bit floating point (single precision)
|
-| 11 | FLOAT64 | 64-bit floating point (double precision)
|
-| 12 | STRING | UTF-8/UTF-16/Latin1 encoded string
|
-| 13 | ENUM | Enum registered by numeric ID
|
-| 14 | NAMED_ENUM | Enum registered by namespace + type name
|
-| 15 | STRUCT | Struct registered by numeric ID (schema
consistent) |
-| 16 | COMPATIBLE_STRUCT | Struct with schema evolution support (by
ID) |
-| 17 | NAMED_STRUCT | Struct registered by namespace + type
name |
-| 18 | NAMED_COMPATIBLE_STRUCT | Struct with schema evolution (by name)
|
-| 19 | EXT | Extension type registered by numeric ID
|
-| 20 | NAMED_EXT | Extension type registered by namespace +
type name |
-| 21 | LIST | Ordered collection (List, Array, Vector)
|
-| 22 | SET | Unordered collection of unique elements
|
-| 23 | MAP | Key-value mapping
|
-| 24 | DURATION | Time duration (seconds + nanoseconds)
|
-| 25 | TIMESTAMP | Point in time (nanoseconds since epoch)
|
-| 26 | LOCAL_DATE | Date without timezone (days since epoch)
|
-| 27 | DECIMAL | Arbitrary precision decimal
|
-| 28 | BINARY | Raw binary data
|
-| 29 | ARRAY | Generic array type
|
-| 30 | BOOL_ARRAY | 1D boolean array
|
-| 31 | INT8_ARRAY | 1D int8 array
|
-| 32 | INT16_ARRAY | 1D int16 array
|
-| 33 | INT32_ARRAY | 1D int32 array
|
-| 34 | INT64_ARRAY | 1D int64 array
|
-| 35 | FLOAT16_ARRAY | 1D float16 array
|
-| 36 | FLOAT32_ARRAY | 1D float32 array
|
-| 37 | FLOAT64_ARRAY | 1D float64 array
|
-| 38 | UNION | Tagged union type (one of several
alternatives) |
-| 39 | NONE | Empty/unit type (no data)
|
+| 7 | VAR64 | Variable-length encoded 64-bit signed
integer |
+| 8 | H64 | Hybrid encoded 64-bit signed integer
|
+| 9 | UINT8 | 8-bit unsigned integer
|
+| 10 | UINT16 | 16-bit unsigned integer
|
+| 11 | UINT32 | 32-bit unsigned integer
|
+| 12 | VARU32 | Variable-length encoded 32-bit unsigned
integer |
+| 13 | UINT64 | 64-bit unsigned integer
|
+| 14 | VARU64 | Variable-length encoded 64-bit unsigned
integer |
+| 15 | HU64 | Hybrid encoded 64-bit unsigned integer
|
+| 16 | FLOAT16 | 16-bit floating point (half precision)
|
+| 17 | FLOAT32 | 32-bit floating point (single precision)
|
+| 18 | FLOAT64 | 64-bit floating point (double precision)
|
+| 19 | STRING | UTF-8/UTF-16/Latin1 encoded string
|
+| 20 | LIST | Ordered collection (List, Array, Vector)
|
+| 21 | SET | Unordered collection of unique elements
|
+| 22 | MAP | Key-value mapping
|
+| 23 | ENUM | Enum registered by numeric ID
|
+| 24 | NAMED_ENUM | Enum registered by namespace + type name
|
+| 25 | STRUCT | Struct registered by numeric ID (schema
consistent) |
+| 26 | COMPATIBLE_STRUCT | Struct with schema evolution support (by
ID) |
+| 27 | NAMED_STRUCT | Struct registered by namespace + type
name |
+| 28 | NAMED_COMPATIBLE_STRUCT | Struct with schema evolution (by name)
|
+| 29 | EXT | Extension type registered by numeric ID
|
+| 30 | NAMED_EXT | Extension type registered by namespace +
type name |
+| 31 | UNION | Tagged union type (one of several
alternatives) |
+| 32 | NONE | Empty/unit type (no data)
|
+| 33 | DURATION | Time duration (seconds + nanoseconds)
|
+| 34 | TIMESTAMP | Point in time (nanoseconds since epoch)
|
+| 35 | LOCAL_DATE | Date without timezone (days since epoch)
|
+| 36 | DECIMAL | Arbitrary precision decimal
|
+| 37 | BINARY | Raw binary data
|
+| 38 | ARRAY | Generic array type
|
+| 39 | BOOL_ARRAY | 1D boolean array
|
+| 40 | INT8_ARRAY | 1D int8 array
|
+| 41 | INT16_ARRAY | 1D int16 array
|
+| 42 | INT32_ARRAY | 1D int32 array
|
+| 43 | INT64_ARRAY | 1D int64 array
|
+| 44 | UINT8_ARRAY | 1D uint8 array
|
+| 45 | UINT16_ARRAY | 1D uint16 array
|
+| 46 | UINT32_ARRAY | 1D uint32 array
|
+| 47 | UINT64_ARRAY | 1D uint64 array
|
+| 48 | FLOAT16_ARRAY | 1D float16 array
|
+| 49 | FLOAT32_ARRAY | 1D float32 array
|
+| 50 | FLOAT64_ARRAY | 1D float64 array
|
#### Type ID Encoding for User Types
@@ -202,11 +213,11 @@ Full Type ID = (user_type_id << 8) | internal_type_id
| User ID | Type | Internal ID | Full Type ID | Decimal |
| ------- | ----------------- | ----------- | ---------------- | ------- |
-| 0 | STRUCT | 15 | `(0 << 8) \| 15` | 15 |
-| 0 | ENUM | 13 | `(0 << 8) \| 13` | 13 |
-| 1 | STRUCT | 15 | `(1 << 8) \| 15` | 271 |
-| 1 | COMPATIBLE_STRUCT | 16 | `(1 << 8) \| 16` | 272 |
-| 2 | NAMED_STRUCT | 17 | `(2 << 8) \| 17` | 529 |
+| 0 | STRUCT | 25 | `(0 << 8) \| 25` | 25 |
+| 0 | ENUM | 23 | `(0 << 8) \| 23` | 23 |
+| 1 | STRUCT | 25 | `(1 << 8) \| 25` | 281 |
+| 1 | COMPATIBLE_STRUCT | 26 | `(1 << 8) \| 26` | 282 |
+| 2 | NAMED_STRUCT | 27 | `(2 << 8) \| 27` | 539 |
When reading type IDs:
@@ -904,18 +915,35 @@ have small encoded values:
- size: 1~9 bytes
-Fory supports two encoding schemes for 64-bit integers:
+Uses PVL (Progressive Variable-Length) encoding:
-**Fory SLI (Small Long as Int) Encoding:**
+```
+function write_varuint64(value):
+ while value >= 0x80:
+ buffer.write_byte((value & 0x7F) | 0x80)
+ value = value >> 7
+ buffer.write_byte(value)
+```
+
+| Value Range | Bytes |
+| ------------- | ----- |
+| 0 ~ 127 | 1 |
+| 128 ~ 16383 | 2 |
+| ... | ... |
+| 2^56 ~ 2^63-1 | 9 |
+
+#### unsigned hybrid int64 (HU64)
-Optimized for values that fit in 31 bits (common case for IDs, timestamps,
etc.):
+- size: 4 or 9 bytes
+
+Optimized for unsigned values that fit in 31 bits (common case for IDs, sizes,
counts, etc.):
```
-if value in [0, 2147483647]: // fits in 31 bits
+if value in [0, 2147483647]: // fits in 31 bits (2^31 - 1), full unsigned
range
write 4 bytes: ((int32) value) << 1 // bit 0 is 0, indicating 4-byte
encoding
else:
write 1 byte: 0x01 // bit 0 is 1, indicating 9-byte
encoding
- write 8 bytes: value as little-endian int64
+ write 8 bytes: value as little-endian uint64
```
Reading:
@@ -923,29 +951,12 @@ Reading:
```
first_int32 = read_int32_le()
if (first_int32 & 1) == 0:
- return first_int32 >> 1 // 4-byte encoding
+ return (uint64)(first_int32 >> 1) // 4-byte encoding, unsigned
else:
- return read_int64_le() // read remaining 8 bytes
+ return read_uint64_le() // read remaining 8 bytes
```
-**Fory PVL (Progressive Variable-Length) Encoding:**
-
-Standard varint encoding extended to 64 bits:
-
-```
-function write_varuint64(value):
- while value >= 0x80:
- buffer.write_byte((value & 0x7F) | 0x80)
- value = value >> 7
- buffer.write_byte(value)
-```
-
-| Value Range | Bytes |
-| ------------- | ----- |
-| 0 ~ 127 | 1 |
-| 128 ~ 16383 | 2 |
-| ... | ... |
-| 2^56 ~ 2^63-1 | 9 |
+Note: HU64 uses the full 31 bits for positive values [0, 2^31-1], compared to
H64 which splits the range for signed values [-2^30, 2^30-1].
#### VarUint36Small
@@ -972,32 +983,44 @@ This encoding is optimized for the common case where
string length fits in 7 bit
- size: 1~9 bytes
-**Fory SLI (Small Long as Int) Encoding for signed:**
+Uses ZigZag encoding first, then PVL varint:
+
+```
+// Encode
+zigzag_value = (value << 1) ^ (value >> 63)
+write_varuint64(zigzag_value)
+
+// Decode
+zigzag_value = read_varuint64()
+value = (zigzag_value >> 1) ^ (-(zigzag_value & 1))
+```
+
+#### signed hybrid int64 (H64)
+
+- size: 4 or 9 bytes
Optimized for small signed values:
```
-if value in [-1073741824, 1073741823]: // fits in 31 bits signed
- write 4 bytes: ((int32) value) << 1 // bit 0 is 0
+if value in [-1073741824, 1073741823]: // fits in 30 bits + sign ([-2^30,
2^30-1])
+ write 4 bytes: ((int32) value) << 1 // bit 0 is 0, indicating 4-byte
encoding
else:
- write 1 byte: 0x01 // bit 0 is 1
+ write 1 byte: 0x01 // bit 0 is 1, indicating 9-byte
encoding
write 8 bytes: value as little-endian int64
```
-**Fory PVL (Progressive Variable-Length) Encoding for signed:**
-
-Uses ZigZag encoding first, then varint:
+Reading:
```
-// Encode
-zigzag_value = (value << 1) ^ (value >> 63)
-write_varuint64(zigzag_value)
-
-// Decode
-zigzag_value = read_varuint64()
-value = (zigzag_value >> 1) ^ (-(zigzag_value & 1))
+first_int32 = read_int32_le()
+if (first_int32 & 1) == 0:
+ return (int64)(first_int32 >> 1) // 4-byte encoding, sign-extended
+else:
+ return read_int64_le() // read remaining 8 bytes
```
+Note: H64 uses 30 bits + sign for values [-2^30, 2^30-1], while HU64 uses full
31 bits for unsigned values [0, 2^31-1].
+
#### float32
- size: 4 byte
@@ -1316,7 +1339,7 @@ Field will be ordered as following, every group of fields
will have its own orde
- larger size type first, smaller later, variable size type last.
- when same size, sort by type id
- when same size and type id, sort by snake case field name
- - types:
bool/int8/int16/int32/varint32/int64/varint64/sliint64/float16/float32/float64
+ - types: bool/int8/int16/int32/var32/int64/var64/h64/float16/float32/float64
- nullable primitive fields: same order as primitive fields
- other internal type fields: sort by type id then snake case field name
- list fields: sort by snake case field name
@@ -1495,7 +1518,7 @@ This section provides a step-by-step guide for
implementing Fory xlang serializa
- [ ] Implement `write_varuint64` / `read_varuint64`
- [ ] Implement `write_varint64` / `read_varint64` (with ZigZag)
- [ ] Implement `write_varuint36_small` / `read_varuint36_small` (for
strings)
- - [ ] Optionally implement SLI encoding for int64
+ - [ ] Optionally implement Hybrid encoding (H64/HU64) for int64
3. **Header Handling**
- [ ] Write magic number `0x62d4`
diff --git a/docs/specification/xlang_type_mapping.md
b/docs/specification/xlang_type_mapping.md
index 58e45f166..50dceb7bb 100644
--- a/docs/specification/xlang_type_mapping.md
+++ b/docs/specification/xlang_type_mapping.md
@@ -27,54 +27,65 @@ Note:
## Type Mapping
-| Fory Type | Fory Type ID | Java | Python
| Javascript | C++ | Golang
| Rust |
-| ----------------------- | ------------ | --------------- |
--------------------------------- | --------------- |
------------------------------ | ---------------- | ----------------- |
-| bool | 1 | bool/Boolean | bool
| Boolean | bool | bool
| bool |
-| int8 | 2 | byte/Byte | int/pyfory.Int8
| Type.int8() | int8_t | int8
| i8 |
-| int16 | 3 | short/Short | int/pyfory.Int16
| Type.int16() | int16_t | int16
| i6 |
-| int32 | 4 | int/Integer | int/pyfory.Int32
| Type.int32() | int32_t | int32
| i32 |
-| var_int32 | 5 | int/Integer |
int/pyfory.VarInt32 | Type.varint32() | fory::varint32_t
| fory.varint32 | fory::varint32 |
-| int64 | 6 | long/Long | int/pyfory.Int64
| Type.int64() | int64_t | int64
| i64 |
-| var_int64 | 7 | long/Long |
int/pyfory.VarInt64 | Type.varint64() | fory::varint64_t
| fory.varint64 | fory::varint64 |
-| sli_int64 | 8 | long/Long |
int/pyfory.SliInt64 | Type.sliint64() | fory::sliint64_t
| fory.sliint64 | fory::sliint64 |
-| float16 | 9 | float/Float |
float/pyfory.Float16 | Type.float16() | fory::float16_t
| fory.float16 | fory::f16 |
-| float32 | 10 | float/Float |
float/pyfory.Float32 | Type.float32() | float
| float32 | f32 |
-| float64 | 11 | double/Double |
float/pyfory.Float64 | Type.float64() | double
| float64 | f64 |
-| string | 12 | String | str
| String | string | string
| String/str |
-| enum | 13 | Enum subclasses | enum subclasses
| / | enum | /
| enum |
-| named_enum | 14 | Enum subclasses | enum subclasses
| / | enum | /
| enum |
-| struct | 15 | pojo/record | data class / type
with type hints | object | struct/class | struct
| struct |
-| compatible_struct | 16 | pojo/record | data class / type
with type hints | object | struct/class | struct
| struct |
-| named_struct | 17 | pojo/record | data class / type
with type hints | object | struct/class | struct
| struct |
-| named_compatible_struct | 18 | pojo/record | data class / type
with type hints | object | struct/class | struct
| struct |
-| ext | 19 | pojo/record | data class / type
with type hints | object | struct/class | struct
| struct |
-| named_ext | 20 | pojo/record | data class / type
with type hints | object | struct/class | struct
| struct |
-| list | 21 | List/Collection | list/tuple
| array | vector | slice
| Vec |
-| set | 22 | Set | set
| / | set | fory.Set
| Set |
-| map | 23 | Map | dict
| Map | unordered_map | map
| HashMap |
-| duration | 24 | Duration | timedelta
| Number | duration | Duration
| Duration |
-| timestamp | 25 | Instant | datetime
| Number | std::chrono::nanoseconds | Time
| DateTime |
-| local_date | 26 | Date | datetime
| Number | std::chrono::nanoseconds | Time
| DateTime |
-| decimal | 27 | BigDecimal | Decimal
| bigint | / | /
| / |
-| binary | 28 | byte[] | bytes
| / | `uint8_t[n]/vector<T>` |
`[n]uint8/[]T` | `Vec<uint8_t>` |
-| array | 29 | array | np.ndarray
| / | / |
array/slice | Vec |
-| bool_array | 30 | bool[] |
ndarray(np.bool\_) | / | `bool[n]`
| `[n]bool/[]T` | `Vec<bool>` |
-| int8_array | 31 | byte[] | ndarray(int8)
| / | `int8_t[n]/vector<T>` |
`[n]int8/[]T` | `Vec<i18>` |
-| int16_array | 32 | short[] | ndarray(int16)
| / | `int16_t[n]/vector<T>` |
`[n]int16/[]T` | `Vec<i16>` |
-| int32_array | 33 | int[] | ndarray(int32)
| / | `int32_t[n]/vector<T>` |
`[n]int32/[]T` | `Vec<i32>` |
-| int64_array | 34 | long[] | ndarray(int64)
| / | `int64_t[n]/vector<T>` |
`[n]int64/[]T` | `Vec<i64>` |
-| float16_array | 35 | float[] | ndarray(float16)
| / | `fory::float16_t[n]/vector<T>` |
`[n]float16/[]T` | `Vec<fory::f16>` |
-| float32_array | 36 | float[] | ndarray(float32)
| / | `float[n]/vector<T>` |
`[n]float32/[]T` | `Vec<f32>` |
-| float64_array | 37 | double[] | ndarray(float64)
| / | `double[n]/vector<T>` |
`[n]float64/[]T` | `Vec<f64>` |
-| union | 38 | Union | typing.Union
| / | `std::variant<Ts...>` | /
| tagged union enum |
-| none | 39 | null | None
| null | `std::monostate` | nil
| `()` |
+| Fory Type | Fory Type ID | Java | Python
| Javascript | C++ | Golang | Rust
|
+| ----------------------- | ------------ | --------------- |
-------------------- | -------------- | ------------------------------ |
---------------- | ----------------- |
+| bool | 1 | bool/Boolean | bool
| Boolean | bool | bool | bool
|
+| int8 | 2 | byte/Byte | int/pyfory.int8
| Type.int8() | int8_t | int8 | i8
|
+| int16 | 3 | short/Short | int/pyfory.int16
| Type.int16() | int16_t | int16 | i16
|
+| int32 | 4 | int/Integer | int/pyfory.int32
| Type.int32() | int32_t | int32 | i32
|
+| var32 | 5 | int/Integer | int/pyfory.var32
| Type.var32() | int32_t | int32 | i32
|
+| int64 | 6 | long/Long | int/pyfory.int64
| Type.int64() | int64_t | int64 | i64
|
+| var64 | 7 | long/Long | int/pyfory.var64
| Type.var64() | int64_t | int64 | i64
|
+| h64 | 8 | long/Long | int/pyfory.h64
| Type.h64() | int64_t | int64 | i64
|
+| uint8 | 9 | short/Short | int/pyfory.uint8
| Type.uint8() | uint8_t | uint8 | u8
|
+| uint16 | 10 | int/Integer | int/pyfory.uint16
| Type.uint16() | uint16_t | uint16 | u16
|
+| uint32 | 11 | long/Long | int/pyfory.uint32
| Type.uint32() | uint32_t | uint32 | u32
|
+| varu32 | 12 | long/Long | int/pyfory.varu32
| Type.varu32() | uint32_t | uint32 | u32
|
+| uint64 | 13 | long/Long | int/pyfory.uint64
| Type.uint64() | uint64_t | uint64 | u64
|
+| varu64 | 14 | long/Long | int/pyfory.varu64
| Type.varu64() | uint64_t | uint64 | u64
|
+| hu64 | 15 | long/Long | int/pyfory.hu64
| Type.hu64() | uint64_t | uint64 | u64
|
+| float16 | 16 | float/Float |
float/pyfory.float16 | Type.float16() | fory::float16_t |
fory.float16 | fory::f16 |
+| float32 | 17 | float/Float |
float/pyfory.float32 | Type.float32() | float |
float32 | f32 |
+| float64 | 18 | double/Double |
float/pyfory.float64 | Type.float64() | double |
float64 | f64 |
+| string | 19 | String | str
| String | string | string |
String/str |
+| list | 20 | List/Collection | list/tuple
| array | vector | slice | Vec
|
+| set | 21 | Set | set
| / | set | fory.Set | Set
|
+| map | 22 | Map | dict
| Map | unordered_map | map |
HashMap |
+| enum | 23 | Enum subclasses | enum subclasses
| / | enum | / | enum
|
+| named_enum | 24 | Enum subclasses | enum subclasses
| / | enum | / | enum
|
+| struct | 25 | pojo/record | data class
| object | struct/class | struct |
struct |
+| compatible_struct | 26 | pojo/record | data class
| object | struct/class | struct |
struct |
+| named_struct | 27 | pojo/record | data class
| object | struct/class | struct |
struct |
+| named_compatible_struct | 28 | pojo/record | data class
| object | struct/class | struct |
struct |
+| ext | 29 | pojo/record | data class
| object | struct/class | struct |
struct |
+| named_ext | 30 | pojo/record | data class
| object | struct/class | struct |
struct |
+| union | 31 | Union | typing.Union
| / | `std::variant<Ts...>` | / |
tagged union enum |
+| none | 32 | null | None
| null | `std::monostate` | nil | `()`
|
+| duration | 33 | Duration | timedelta
| Number | duration | Duration |
Duration |
+| timestamp | 34 | Instant | datetime
| Number | std::chrono::nanoseconds | Time |
DateTime |
+| local_date | 35 | Date | datetime
| Number | std::chrono::nanoseconds | Time |
DateTime |
+| decimal | 36 | BigDecimal | Decimal
| bigint | / | / | /
|
+| binary | 37 | byte[] | bytes
| / | `uint8_t[n]/vector<T>` | `[n]uint8/[]T` |
`Vec<uint8_t>` |
+| array | 38 | array | np.ndarray
| / | / | array/slice | Vec
|
+| bool_array | 39 | bool[] |
ndarray(np.bool\_) | / | `bool[n]` |
`[n]bool/[]T` | `Vec<bool>` |
+| int8_array | 40 | byte[] | ndarray(int8)
| / | `int8_t[n]/vector<T>` | `[n]int8/[]T` |
`Vec<i8>` |
+| int16_array | 41 | short[] | ndarray(int16)
| / | `int16_t[n]/vector<T>` | `[n]int16/[]T` |
`Vec<i16>` |
+| int32_array | 42 | int[] | ndarray(int32)
| / | `int32_t[n]/vector<T>` | `[n]int32/[]T` |
`Vec<i32>` |
+| int64_array | 43 | long[] | ndarray(int64)
| / | `int64_t[n]/vector<T>` | `[n]int64/[]T` |
`Vec<i64>` |
+| uint8_array | 44 | short[] | ndarray(uint8)
| / | `uint8_t[n]/vector<T>` | `[n]uint8/[]T` |
`Vec<u8>` |
+| uint16_array | 45 | int[] | ndarray(uint16)
| / | `uint16_t[n]/vector<T>` | `[n]uint16/[]T` |
`Vec<u16>` |
+| uint32_array | 46 | long[] | ndarray(uint32)
| / | `uint32_t[n]/vector<T>` | `[n]uint32/[]T` |
`Vec<u32>` |
+| uint64_array | 47 | long[] | ndarray(uint64)
| / | `uint64_t[n]/vector<T>` | `[n]uint64/[]T` |
`Vec<u64>` |
+| float16_array | 48 | float[] | ndarray(float16)
| / | `fory::float16_t[n]/vector<T>` | `[n]float16/[]T` |
`Vec<fory::f16>` |
+| float32_array | 49 | float[] | ndarray(float32)
| / | `float[n]/vector<T>` | `[n]float32/[]T` |
`Vec<f32>` |
+| float64_array | 50 | double[] | ndarray(float64)
| / | `double[n]/vector<T>` | `[n]float64/[]T` |
`Vec<f64>` |
## 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 Fory 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
+in java has type `int64/var64/h64`, it means the language lacks some types,
and the user must provide extra type
info when using Fory.
## Type annotation
@@ -104,13 +115,6 @@ Here is en example:
```python
class Foo:
- f1: Int32Type(varint=True)
- f2: List[Int32Type(varint=True)]
+ f1: pyfory.var32
+ f2: List[pyfory.var32]
```
-
-## Type wrapper
-
-If the type is not a field of a class, the user must wrap this type with a
Fory type to pass the extra type info.
-
-For example, suppose Fory Java provide a `VarInt64` type, when a user invoke
`fory.serialize(long_value)`, he need to
-invoke like `fory.serialize(new VarInt64(long_value))`.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]