Skip to content

Comments

feat(java): add float support#3254

Open
mengnankkkk wants to merge 17 commits intoapache:mainfrom
mengnankkkk:hotfix/add_float16
Open

feat(java): add float support#3254
mengnankkkk wants to merge 17 commits intoapache:mainfrom
mengnankkkk:hotfix/add_float16

Conversation

@mengnankkkk
Copy link
Contributor

@mengnankkkk mengnankkkk commented Feb 3, 2026

Why?

What does this PR do?

Related issues

Close #3205

Does this PR introduce any user-facing change?

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

Benchmark

Co-authored-by: Shawn Yang <chaokunyang@apache.org>
public static final int EXT_UINT64 = 23;
public static final int EXT_VAR_UINT64 = 24;
public static final int STRING = 25;
public static final int FLOAT16 = 12;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This ID is wrong, here is current id def in main branch:

  /** float8: an 8-bit floating point number. */
  public static final int FLOAT8 = 16;

  /** float16: a 16-bit floating point number. */
  public static final int FLOAT16 = 17;

  /** bfloat16: a 16-bit brain floating point number. */
  public static final int BFLOAT16 = 18;

Same for Float16 array

"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true
},
Copy link
Collaborator

@chaokunyang chaokunyang Feb 22, 2026

Choose a reason for hiding this comment

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

This is syntax error, please fix it


@Data
@AllArgsConstructor
class StructWithSpecialValues {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please also create another tests to struct with Float16List as fields and also test Float16List as top level objects for serialization

public static final int EXT_VAR_UINT32 = 23;
public static final int EXT_UINT64 = 24;
public static final int EXT_VAR_UINT64 = 25;
public static final int STRING = 26;
Copy link
Collaborator

Choose a reason for hiding this comment

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

java/fory-core/src/main/java/org/apache/fory/serializer/FieldGroups.java also needs update to clarify Float16 as build-in fields and grouped into primitive/boxed groups based whethther it's nullable.

java/fory-core/src/main/java/org/apache/fory/builder/BaseObjectCodecBuilder.java also needs update to handle Flaot16 specially, you can start from serializePrimitiveField

java/fory-core/src/main/java/org/apache/fory/serializer/AbstractObjectSerializer.java may also needs updates

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.

[Java] add float16 support to java

2 participants