Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(kotlin): Add Unsigned Primitive Support #1886

Merged
merged 15 commits into from
Oct 16, 2024

Conversation

wywen
Copy link
Contributor

@wywen wywen commented Oct 15, 2024

What does this PR do?

This PR adds unsigned primitive support to Kotlin Fury.
It also adds tests for the standard kotlin primitives(supported by fury Java), nullable primitive tests, boundary tests for unsigned serializers.

Related issues

#683

Does this PR introduce any user-facing change?

Yes it adds Unsigned support for Kotlin. There's documentation new issue (should add something to document Kotlin!)

  • Does this PR introduce any public API change?
  • Does this PR introduce any binary protocol compatibility change?

Benchmark

N/A

wywen and others added 3 commits October 16, 2024 05:31
Co-authored-by: Shawn Yang <[email protected]>
Co-authored-by: Shawn Yang <[email protected]>
Co-authored-by: Shawn Yang <[email protected]>
Copy link
Collaborator

@chaokunyang chaokunyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great

@wywen
Copy link
Contributor Author

wywen commented Oct 16, 2024

Just to let you know read/writeVarUint16 method doesn't exist in main (is it from a different branch?) I have reverted that commit otherwise it doesn't compile.

@chaokunyang
Copy link
Collaborator

writeVarUint16

My bad, MemoryBuffer didn't provide read/writeVarUint16 method, we can keep using read/writeVarUint32, the performance will be same

@wywen
Copy link
Contributor Author

wywen commented Oct 16, 2024

writeVarUint16

My bad, MemoryBuffer didn't provide read/writeVarUint16 method, we can keep using read/writeVarUint32, the performance will be same

Will doing a reinterpret_cast to short be more compact (kotlin toXYZ methods are reinterpret_cast not static_cast )? I tried it and it passes boundary and roundtrip tests,

kotlin/README.md Outdated
@@ -9,7 +9,7 @@ Fury Kotlin provides additional tests and implementation support for Kotlin type
Fury Kotlin is tested and works with the following types:

- primitives: `Byte`, `Boolean`, `Int`, `Short`, `Long`, `Char`, `Float`, `Double`, `UByte`, `UShort`, `UInt`, `UShort`, `UInt`.
- `Byte`, `Boolean`, `Int`, `Short`, `Long`, `Char`, `Float`, `Double` works out of the box with the default java implementation.
- `Byte`, `Boolean`, `Int`, `Short`, `Long`, `Char`, `Float`, `Double` works out of the box with the default java implementation.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we replace all default java implementation with default fury java implementation

go back to read/writeVarInt because from code it looks like it'll do the
right thing (maybe extra branching)

This reverts commit ee9a5fa.
@wywen
Copy link
Contributor Author

wywen commented Oct 16, 2024

looks like read/writeUint32 will pick the right representation.

@chaokunyang chaokunyang merged commit d44e27d into apache:main Oct 16, 2024
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants