@@ -1183,8 +1183,8 @@ public void testSkippedV2Stats() {
11831183 Types .optional (PrimitiveTypeName .INT96 )
11841184 .columnOrder (ColumnOrder .undefined ())
11851185 .named ("" ),
1186- new NanoTime (2458850 , 0L ). toBinary () ,
1187- new NanoTime (2458881 , 39_600_000_000_000L ). toBinary ()
1186+ new NanoTime (2458850 , 0L ),
1187+ new NanoTime (2458881 , 39_600_000_000_000L )
11881188 );
11891189 }
11901190
@@ -1226,8 +1226,8 @@ public void testV2OnlyStats() {
12261226 new BigInteger ("9864675" ));
12271227 testV2OnlyStats (
12281228 Types .optional (PrimitiveTypeName .INT96 ).named ("" ),
1229- new NanoTime (2458850 , 0L ). toBinary () , // 2020-01-01
1230- new NanoTime (2458881 , 39_600_000_000_000L ). toBinary () ); // 2020-02-01T11:00
1229+ new NanoTime (2458850 , 0L ), // 2020-01-01
1230+ new NanoTime (2458881 , 39_600_000_000_000L )); // 2020-02-01T11:00
12311231 }
12321232
12331233 private void testV2OnlyStats (PrimitiveType type , Object min , Object max ) {
@@ -1266,8 +1266,7 @@ public void testV2StatsEqualMinMax() {
12661266 .named ("" ),
12671267 new BigInteger ("-8752832" ),
12681268 new BigInteger ("-8752832" ));
1269- Binary int96 = new NanoTime (2458850 , 43_200_000_000_000L )
1270- .toBinary (); // 2020-01-01T12:00:00
1269+ NanoTime int96 = new NanoTime (2458850 , 43_200_000_000_000L ); // 2020-01-01T12:00:00
12711270 testV2StatsEqualMinMax (
12721271 Types .optional (PrimitiveTypeName .INT96 ).named ("" ),
12731272 int96 ,
@@ -1291,8 +1290,8 @@ private static <T> Statistics<?> createStats(PrimitiveType type, T min, T max) {
12911290 return createStatsTyped (type , (Long ) min , (Long ) max );
12921291 } else if (c == BigInteger .class ) {
12931292 return createStatsTyped (type , (BigInteger ) min , (BigInteger ) max );
1294- } else if (min instanceof Binary ) {
1295- return createStatsTyped (type , (Binary ) min , (Binary ) max );
1293+ } else if (min instanceof NanoTime ) {
1294+ return createStatsTyped (type , (NanoTime ) min , (NanoTime ) max );
12961295 }
12971296 fail ("Not implemented" );
12981297 return null ;
@@ -1327,12 +1326,14 @@ private static Statistics<?> createStatsTyped(PrimitiveType type, BigInteger min
13271326 return stats ;
13281327 }
13291328
1330- private static Statistics <?> createStatsTyped (PrimitiveType type , Binary min , Binary max ) {
1329+ private static Statistics <?> createStatsTyped (PrimitiveType type , NanoTime min , NanoTime max ) {
1330+ Binary minBinary = min .toBinary ();
1331+ Binary maxBinary = max .toBinary ();
13311332 Statistics <?> stats = Statistics .createStats (type );
1332- stats .updateStats (max );
1333- stats .updateStats (min );
1334- assertEquals (min , stats .genericGetMin ());
1335- assertEquals (max , stats .genericGetMax ());
1333+ stats .updateStats (maxBinary );
1334+ stats .updateStats (minBinary );
1335+ assertEquals (minBinary , stats .genericGetMin ());
1336+ assertEquals (maxBinary , stats .genericGetMax ());
13361337 return stats ;
13371338 }
13381339
@@ -1438,8 +1439,19 @@ public void testColumnOrders() throws IOException {
14381439 }
14391440
14401441 @ Test
1441- public void testLegacyINT96ColumnOrder () throws IOException {
1442- // Create a footer for a single INT96 column schema that does not specify a column order.
1442+ public void testUndefinedINT96ColumnOrder () throws IOException {
1443+ assertInt96ColumnOrderIgnored (null );
1444+ }
1445+
1446+ @ Test
1447+ public void testTypeDefinedOrderINT96ColumnOrder () throws IOException {
1448+ org .apache .parquet .format .ColumnOrder typeOrder = new org .apache .parquet .format .ColumnOrder ();
1449+ typeOrder .setTYPE_ORDER (new org .apache .parquet .format .TypeDefinedOrder ());
1450+ assertInt96ColumnOrderIgnored (typeOrder );
1451+ }
1452+
1453+ private void assertInt96ColumnOrderIgnored (org .apache .parquet .format .ColumnOrder footerColumnOrder )
1454+ throws IOException {
14431455 MessageType schema = parseMessageType ("message test {"
14441456 + " optional int96 int96_col;"
14451457 + "}" );
@@ -1449,8 +1461,12 @@ public void testLegacyINT96ColumnOrder() throws IOException {
14491461 ParquetMetadataConverter converter = new ParquetMetadataConverter ();
14501462 FileMetaData formatMetadata = converter .toParquetMetadata (1 , metadata );
14511463
1452- formatMetadata .unsetColumn_orders ();
1453- assertFalse (formatMetadata .isSetColumn_orders ());
1464+ if (footerColumnOrder == null ) {
1465+ formatMetadata .unsetColumn_orders ();
1466+ assertFalse (formatMetadata .isSetColumn_orders ());
1467+ } else {
1468+ formatMetadata .setColumn_orders (Collections .singletonList (footerColumnOrder ));
1469+ }
14541470
14551471 MessageType resultSchema =
14561472 converter .fromParquetMetadata (formatMetadata ).getFileMetaData ().getSchema ();
0 commit comments