Source:
<code>public void testMapTypeWithNulls() throws Exception { Type keyType = BIGINT; Type valueType = BIGINT; TypeManager typeManager = new TypeRegistry(); <START> FunctionRegistry registry = new FunctionRegistry(typeManager, new BlockEncodingManager(typeManager), new FeaturesConfig()); <END> MethodHandle keyNativeEquals = typeManager.resolveOperator(OperatorType.EQUAL, ImmutableList.of(keyType, keyType)); MethodHandle keyBlockNativeEquals = compose(keyNativeEquals, nativeValueGetter(keyType)); MethodHandle keyBlockEquals = compose(keyNativeEquals, nativeValueGetter(keyType), nativeValueGetter(keyType)); MethodHandle keyNativeHashCode = typeManager.resolveOperator(OperatorType.HASH_CODE, ImmutableList.of(keyType)); MethodHandle keyBlockHashCode = compose(keyNativeHashCode, nativeValueGetter(keyType)); MapType mapType = new MapType( keyType, valueType, keyBlockNativeEquals, keyBlockEquals, keyNativeHashCode, keyBlockHashCode); int rows = 10000; try (TempFile tempFile = new TempFile()) { createMapFileWithNullValues(tempFile.getFile(), mapType, rows); try (OrcRecordReader reader = createCustomOrcRecordReader(tempFile, ORC, OrcPredicate.TRUE, mapType)) { assertEquals(reader.getReaderRowCount(), rows); assertEquals(reader.getReaderPosition(), 0); assertEquals(reader.getStreamReaderRetainedSizeInBytes(), 0); assertEquals(reader.getSystemMemoryUsage(), 0); while (true) { int batchSize = reader.nextBatch(); if (batchSize == -1) { break; } Block block = reader.readBlock(mapType, 0); assertEquals(block.getPositionCount(), batchSize); if (batchSize < MAX_BATCH_SIZE) { continue; } assertEquals(reader.getStreamReaderRetainedSizeInBytes(), batchSize * SIZE_OF_BYTE * 2); assertBetweenInclusive(reader.getCurrentStripeRetainedSizeInBytes(), 210000L, 211000L); assertEquals(reader.getStreamReaderRetainedSizeInBytes() + reader.getCurrentStripeRetainedSizeInBytes(), reader.getSystemMemoryUsage()); } assertEquals(reader.nextBatch(), -1); assertEquals(reader.getReaderPosition(), rows); assertEquals(reader.getFilePosition(), reader.getReaderPosition()); } } }</code><technical_language>registry is unused</technical_language>

Target:
public void testMapTypeWithNulls() throws Exception { Type keyType = BIGINT; Type valueType = BIGINT; MethodHandle keyNativeEquals = TYPE_MANAGER.resolveOperator(OperatorType.EQUAL, ImmutableList.of(keyType, keyType)); MethodHandle keyBlockNativeEquals = compose(keyNativeEquals, nativeValueGetter(keyType)); MethodHandle keyBlockEquals = compose(keyNativeEquals, nativeValueGetter(keyType), nativeValueGetter(keyType)); MethodHandle keyNativeHashCode = TYPE_MANAGER.resolveOperator(OperatorType.HASH_CODE, ImmutableList.of(keyType)); MethodHandle keyBlockHashCode = compose(keyNativeHashCode, nativeValueGetter(keyType)); MapType mapType = new MapType( keyType, valueType, keyBlockNativeEquals, keyBlockEquals, keyNativeHashCode, keyBlockHashCode); int rows = 10000; OrcRecordReader reader = null; try (TempFile tempFile = createSingleColumnMapFileWithNullValues(mapType, rows)) { reader = createCustomOrcRecordReader(tempFile, ORC, OrcPredicate.TRUE, mapType, INITIAL_BATCH_SIZE); assertInitialRetainedSizes(reader, rows); long stripeReaderRetainedSize = reader.getCurrentStripeRetainedSizeInBytes(); long streamReaderRetainedSize = reader.getStreamReaderRetainedSizeInBytes(); long readerRetainedSize = reader.getRetainedSizeInBytes(); long readerSystemMemoryUsage = reader.getSystemMemoryUsage(); while (true) { int batchSize = reader.nextBatch(); if (batchSize == -1) { break; } Block block = reader.readBlock(mapType, 0); assertEquals(block.getPositionCount(), batchSize); if (batchSize < MAX_BATCH_SIZE) { continue; } assertGreaterThan(reader.getCurrentStripeRetainedSizeInBytes(), stripeReaderRetainedSize); assertGreaterThanOrEqual(reader.getStreamReaderRetainedSizeInBytes() - streamReaderRetainedSize, 2048L); assertGreaterThan(reader.getRetainedSizeInBytes() - readerRetainedSize, 2048L); assertGreaterThan(reader.getSystemMemoryUsage() - readerSystemMemoryUsage, 2048L); } } finally { if (reader != null) { reader.close(); } } assertClosedRetainedSizes(reader); }