SimpleSerializableHashTable implements ISerializableTable { @Override public boolean insert(int entry, TuplePointer pointer) throws HyracksDataException { int headerFrameIndex = getHeaderFrameIndex(entry); int offsetInHeaderFrame = getHeaderFrameOffset(entry); IntSerDeBuffer headerFrame = headers[headerFrameIndex]; if (headerFrame == null) { ByteBuffer newFrame = getFrame(frameSize); if (newFrame == null) { return false; } headerFrame = new IntSerDeBuffer(newFrame); headers[headerFrameIndex] = headerFrame; } int contentFrameIndex = headerFrame.getInt(offsetInHeaderFrame); boolean result; if (contentFrameIndex < 0) { result = insertNewEntry(headerFrame, offsetInHeaderFrame, INIT_ENTRY_SIZE, pointer); } else { int offsetInContentFrame = headerFrame.getInt(offsetInHeaderFrame + 1); result = insertNonFirstTuple(headerFrame, offsetInHeaderFrame, contentFrameIndex, offsetInContentFrame, pointer); } if (result) { tupleCount++; } return result; } SimpleSerializableHashTable(int tableSize, final IHyracksFrameMgrContext ctx);  SimpleSerializableHashTable(int tableSize, final IHyracksFrameMgrContext ctx, boolean frameInitRequired); @Override boolean insert(int entry, TuplePointer pointer); @Override /** * Reset the slot information for the entry. The connection (pointer) between header frame and * content frame will be also lost. Specifically, we reset the number of used count in the slot as -1 * so that the space could be reclaimed. */ void delete(int entry); @Override /** * For the given integer value, get the n-th (n = offsetInSlot) tuple pointer in the corresponding slot. */ boolean getTuplePointer(int entry, int offsetInSlot, TuplePointer dataPointer); @Override void reset(); @Override int getCurrentByteSize(); @Override int getTupleCount(); @Override /** * Returns the tuple count in the slot for the given entry. */ int getTupleCount(int entry); @Override void close(); static int getUnitSize(); static int getNumberOfEntryInSlot(); static int getExpectedByteSizePerHashValue(); static long getExpectedTableFrameCount(long tableSize, int frameSize); static long getExpectedTableByteSize(long tableSize, int frameSize); static long calculateFrameCountDeltaForTableSizeChange(long origTableSize, long delta, int frameSize); static long calculateByteSizeDeltaForTableSizeChange(long origTableSize, long delta, int frameSize); @Override boolean isGarbageCollectionNeeded(); @Override int collectGarbage(ITuplePointerAccessor bufferAccessor, ITuplePartitionComputer tpc); @Override String printInfo(); @Override int getTableSize();  }
@Test public void testInsert() throws Exception { for (int i = 0; i < num; i++) { pointer.reset(i, i); nsTable.insert(i % NUM_PART, pointer); } assertGetValue(); }