### Question:
BytesHashMap { public void free() { free(false); } BytesHashMap(
			final Object owner,
			MemoryManager memoryManager,
			long memorySize,
			LogicalType[] keyTypes,
			LogicalType[] valueTypes);  BytesHashMap(
			final Object owner,
			MemoryManager memoryManager,
			long memorySize,
			LogicalType[] keyTypes,
			LogicalType[] valueTypes,
			boolean inferBucketMemory); boolean isHashSetMode(); LookupInfo lookup(BinaryRow key); BinaryRow append(LookupInfo info, BinaryRow value); long getNumSpillFiles(); long getUsedMemoryInBytes(); long getSpillInBytes(); long getNumElements(); MutableObjectIterator<Entry> getEntryIterator(); ArrayList<MemorySegment> getRecordAreaMemorySegments(); List<MemorySegment> getBucketAreaMemorySegments(); void free(); void free(boolean reservedRecordMemory); void reset(); static final int BUCKET_SIZE; static final int RECORD_EXTRA_LENGTH; }### Answer:
@Test public void testBuildAndRetrieve() throws Exception { final int numMemSegments = needNumMemSegments( NUM_ENTRIES, rowLength(RowType.of(valueTypes)), rowLength(RowType.of(keyTypes)), PAGE_SIZE); int memorySize = numMemSegments * PAGE_SIZE; MemoryManager memoryManager = new MemoryManager(memorySize, 32); BytesHashMap table = new BytesHashMap(this, memoryManager, memorySize, keyTypes, valueTypes); final Random rnd = new Random(RANDOM_SEED); BinaryRow[] rows = getRandomizedInput(NUM_ENTRIES, rnd, true); List<BinaryRow> expected = new ArrayList<>(NUM_ENTRIES); verifyInsert(rows, expected, table); verifyRetrieve(table, rows, expected); table.free(); }
@Test public void testBuildAndUpdate() throws Exception { final Random rnd = new Random(RANDOM_SEED); final BinaryRow[] rows = getRandomizedInput(NUM_ENTRIES, rnd, true); final int numMemSegments = needNumMemSegments( NUM_ENTRIES, rowLength(RowType.of(valueTypes)), rowLength(RowType.of(keyTypes)), PAGE_SIZE); int memorySize = numMemSegments * PAGE_SIZE; MemoryManager memoryManager = new MemoryManager(memorySize, 32); BytesHashMap table = new BytesHashMap(this, memoryManager, memorySize, keyTypes, valueTypes); List<BinaryRow> expected = new ArrayList<>(NUM_ENTRIES); verifyInsertAndUpdate(rnd, rows, expected, table); verifyRetrieve(table, rows, expected); table.free(); }