pandalee99 opened a new pull request, #2610:
URL: https://github.com/apache/fory/pull/2610

   <!--
   **Thanks for contributing to Apache Fory™.**
   
   **If this is your first time opening a PR on fory, you can refer to 
[CONTRIBUTING.md](https://github.com/apache/fory/blob/main/CONTRIBUTING.md).**
   
   Contribution Checklist
   
       - The **Apache Fory™** community has requirements on the naming of pr 
titles. You can also find instructions in 
[CONTRIBUTING.md](https://github.com/apache/fory/blob/main/CONTRIBUTING.md).
   
       - Apache Fory™ has a strong focus on performance. If the PR you submit 
will have an impact on performance, please benchmark it first and provide the 
benchmark result here.
   -->
   
   ## Why?
   In the Fory Go implementation, slices of basic types (such as `[]int32`, 
`[]bool`, etc.) were not correctly mapped to the corresponding array types 
during cross-language serialization. Instead, they were treated as generic LIST 
types, leading to inconsistencies with other languages (Python, Java, etc.).
   
   <!-- Describe the purpose of this PR. -->
   
   ## What does this PR do?
   
   Specialized array serializers were added in `slice.go`:
   
   - `boolArraySerializer` (TypeId: 30) - Handles `[]bool`
   - `int8ArraySerializer` (TypeId: 31) - Handles `[]int8` 
   - `int16ArraySerializer` (TypeId: 32) - Handles `[]int16`
   - `int32ArraySerializer` (TypeId: 33) - Handles `[]int32`
   - `int64ArraySerializer` (TypeId: 34) - Handles `[]int64`
   - `float32ArraySerializer` (TypeId: 36) - Handles `[]float32`
   - `float64ArraySerializer` (TypeId: 37) - Handles `[]float64`
   
   the correct TypeId mapping was ensured:
   
   | Go Type | TypeId | Cross-Language Type |
   |---------|--------|---------------------|
   | []bool | 30 | bool_array |
   | []int8 | 31 | int8_array |
   | []int16 | 32 | int16_array |
   | []int32 | 33 | int32_array |
   | []int64 | 34 | int64_array |
   | []float32 | 36 | float32_array |
   | []float64 | 37 | float64_array |
   | []int, []uint, []interface{} | 21 | list (maintains generality) |
   
   
   
   - Platform-dependent types (`[]int`, `[]uint`) continue to use LIST (TypeId: 
21) to ensure cross-platform compatibility
   - Generic types (`[]interface{}`) use LIST to maintain flexibility
   - Only basic fixed-size types use specialized array serializers
   
   <!-- Describe the details of this PR. -->
   
   ## Related issues
   relate #2430 
   <!--
   Is there any related issue? If this PR closes them you say say fix/closes:
   
   - #xxxx0
   - #xxxx1
   - Fixes #xxxx2
   -->
   
   ## Does this PR introduce any user-facing change?
   
   <!--
   If any user-facing interface changes, please [open an 
issue](https://github.com/apache/fory/issues/new/choose) describing the need to 
do so and update the document if necessary.
   
   Delete section if not applicable.
   -->
   
   - [ ] Does this PR introduce any public API change?
   - [ ] Does this PR introduce any binary protocol compatibility change?
   
   ## Benchmark
   
   <!--
   When the PR has an impact on performance (if you don't know whether the PR 
will have an impact on performance, you can submit the PR first, and if it will 
have impact on performance, the code reviewer will explain it), be sure to 
attach a benchmark data here.
   
   Delete section if not applicable.
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to