@@ -724,6 +724,24 @@ public void testSpecBuilderForFloat() {
724724 assertTrue (stats .isNumNullsSet ());
725725 assertEquals (42 , stats .getNumNulls ());
726726 assertFalse (stats .hasNonNullValue ());
727+
728+ builder = Statistics .getBuilderForReading (type );
729+ stats = builder .withMin (intToBytes (floatToIntBits (0.0f )))
730+ .withMax (intToBytes (floatToIntBits (42.0f ))).build ();
731+ assertEquals (0 , Float .compare (-0.0f , (Float ) stats .genericGetMin ()));
732+ assertEquals (0 , Float .compare (42.0f , (Float ) stats .genericGetMax ()));
733+
734+ builder = Statistics .getBuilderForReading (type );
735+ stats = builder .withMin (intToBytes (floatToIntBits (-42.0f )))
736+ .withMax (intToBytes (floatToIntBits (-0.0f ))).build ();
737+ assertEquals (0 , Float .compare (-42.0f , (Float ) stats .genericGetMin ()));
738+ assertEquals (0 , Float .compare (0.0f , (Float ) stats .genericGetMax ()));
739+
740+ builder = Statistics .getBuilderForReading (type );
741+ stats = builder .withMin (intToBytes (floatToIntBits (0.0f )))
742+ .withMax (intToBytes (floatToIntBits (-0.0f ))).build ();
743+ assertEquals (0 , Float .compare (-0.0f , (Float ) stats .genericGetMin ()));
744+ assertEquals (0 , Float .compare (0.0f , (Float ) stats .genericGetMax ()));
727745 }
728746
729747 @ Test
@@ -749,5 +767,23 @@ public void testSpecBuilderForDouble() {
749767 assertTrue (stats .isNumNullsSet ());
750768 assertEquals (42 , stats .getNumNulls ());
751769 assertFalse (stats .hasNonNullValue ());
770+
771+ builder = Statistics .getBuilderForReading (type );
772+ stats = builder .withMin (longToBytes (doubleToLongBits (0.0 )))
773+ .withMax (longToBytes (doubleToLongBits (42.0 ))).build ();
774+ assertEquals (0 , Double .compare (-0.0 , (Double ) stats .genericGetMin ()));
775+ assertEquals (0 , Double .compare (42.0 , (Double ) stats .genericGetMax ()));
776+
777+ builder = Statistics .getBuilderForReading (type );
778+ stats = builder .withMin (longToBytes (doubleToLongBits (-42.0 )))
779+ .withMax (longToBytes (doubleToLongBits (-0.0 ))).build ();
780+ assertEquals (0 , Double .compare (-42.0 , (Double ) stats .genericGetMin ()));
781+ assertEquals (0 , Double .compare (0.0 , (Double ) stats .genericGetMax ()));
782+
783+ builder = Statistics .getBuilderForReading (type );
784+ stats = builder .withMin (longToBytes (doubleToLongBits (0.0 )))
785+ .withMax (longToBytes (doubleToLongBits (-0.0 ))).build ();
786+ assertEquals (0 , Double .compare (-0.0 , (Double ) stats .genericGetMin ()));
787+ assertEquals (0 , Double .compare (0.0 , (Double ) stats .genericGetMax ()));
752788 }
753789}
0 commit comments