Skip to content

Integer values inside arrays are not compressed #1976

Open
@MC-2016

Description

@MC-2016

Search before asking

  • I had searched in the issues and found no similar issues.

Version

fury 0.9.0
Temurin 21.0.5 (x64)
Windows 11

Component(s)

Java

Minimal reproduce step

import org.apache.fury.*;
import org.apache.fury.config.*;

public class FuryRepro
{
	public static class RecordA
	{
		private int			int32 = 1;
	}

	public static class RecordB
	{
		private int			int32 = Integer.MAX_VALUE;
	}

	public static class RecordC
	{
		private int[]		intArray = { 1 };
	}

	public static class RecordD
	{
		private int[]		intArray = { Integer.MAX_VALUE };
	}

	public static void main(String[] args)
	{
		Fury fury = Fury.builder()
			.withLanguage(Language.JAVA)
			.withIntCompressed(true)
			.withCompatibleMode(CompatibleMode.SCHEMA_CONSISTENT)
			.requireClassRegistration(true)
			.build();
		fury.register(RecordA.class);
		fury.register(RecordB.class);
		fury.register(RecordC.class);
		fury.register(RecordD.class);

		System.out.printf("A: %d%n", fury.serialize(new RecordA()).length);
		System.out.printf("B: %d%n", fury.serialize(new RecordB()).length);
		System.out.printf("C: %d%n", fury.serialize(new RecordC()).length);
		System.out.printf("D: %d%n", fury.serialize(new RecordD()).length);
	}
}

What did you expect to see?

The values inside int[] arrays compressed, just like the values of int fields.

What did you see instead?

A: 5
B: 9
C: 10
D: 10

The values of int fields are compressed as expected, but the values inside int[] arrays are not.

Anything Else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions