Skip to content

Conversation

@cxzl25
Copy link
Contributor

@cxzl25 cxzl25 commented Apr 19, 2024

What changes were proposed in this pull request?

This PR aims to upgrade Gson to 2.10.1.

Why are the changes needed?

Jan 7, 2023

https://github.com/google/gson/releases/tag/gson-parent-2.10.1

Oct 25, 2022

https://github.com/google/gson/releases/tag/gson-parent-2.10

Aug 1, 2022

https://github.com/google/gson/releases/tag/gson-parent-2.9.1

How was this patch tested?

GA

Was this patch authored or co-authored using generative AI tooling?

No

"loadFactor": 0.024791667237877846,
"expectedFpp": 5.756256582500896E-12
"loadFactor": 0.024791667,
"expectedFpp": 5.7562566E-12
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The com.google.gson.stream.JsonWriter#value(float) method is not provided in gson 1.9.0, but is provided in gson 1.9.1.

google/gson#2130

This causes the test to fail after upgrading gson, because in version 2.9.0, the generated json float will be implicitly converted to double.

json format

float loadFactor = (float) popCount / (float) bitCount;
float expectedFpp = (float) Math.pow(loadFactor, k);
writer.name("numHashFunctions").value(k);
writer.name("bitCount").value(bitCount);
writer.name("popCount").value(popCount);
writer.name("loadFactor").value(loadFactor);
writer.name("expectedFpp").value(expectedFpp);

not json format

float loadFactor = (float) popCount / (float) bitCount;
float expectedFpp = (float) Math.pow(loadFactor, k);
DecimalFormat df = new DecimalFormat("###.####");
sb.append(" numHashFunctions: ").append(k);
sb.append(" bitCount: ").append(bitCount);
sb.append(" popCount: ").append(popCount);
sb.append(" loadFactor: ").append(df.format(loadFactor));
sb.append(" expectedFpp: ").append(expectedFpp);

For other test files in non-json format, we can see that the loadFactor is float.

Entry 0: numHashFunctions: 7 bitCount: 9600 popCount: 4931 loadFactor: 0.5136 expectedFpp: 0.009432924
Entry 1: numHashFunctions: 7 bitCount: 9600 popCount: 4956 loadFactor: 0.5163 expectedFpp: 0.009772834

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

+1, LGTM. Although it changes the value, it looks reasonable to me.

dongjoon-hyun pushed a commit that referenced this pull request Apr 19, 2024
### What changes were proposed in this pull request?
This PR aims to upgrade `Gson` to `2.10.1`.

### Why are the changes needed?
Jan 7, 2023

https://github.com/google/gson/releases/tag/gson-parent-2.10.1

Oct 25, 2022

https://github.com/google/gson/releases/tag/gson-parent-2.10

Aug 1, 2022

https://github.com/google/gson/releases/tag/gson-parent-2.9.1

### How was this patch tested?
GA

### Was this patch authored or co-authored using generative AI tooling?
No

Closes #1897 from cxzl25/ORC-1695.

Authored-by: sychen <sychen@ctrip.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit dc89f18)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
@dongjoon-hyun dongjoon-hyun added this to the 2.0.1 milestone Apr 19, 2024
@dongjoon-hyun
Copy link
Member

Merged to main/2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants