Record implements Value, CopyableValue<Record> { public void removeField(int fieldNum) { if (fieldNum < 0 || fieldNum >= this.numFields) { throw new IndexOutOfBoundsException(); } int lastIndex = this.numFields - 1; if (fieldNum < lastIndex) { int len = lastIndex - fieldNum; System.arraycopy(this.offsets, fieldNum + 1, this.offsets, fieldNum, len); System.arraycopy(this.lengths, fieldNum + 1, this.lengths, fieldNum, len); System.arraycopy(this.readFields, fieldNum + 1, this.readFields, fieldNum, len); System.arraycopy(this.writeFields, fieldNum + 1, this.writeFields, fieldNum, len); markModified(fieldNum); } this.offsets[lastIndex] = NULL_INDICATOR_OFFSET; this.lengths[lastIndex] = 0; this.writeFields[lastIndex] = null; setNumFields(lastIndex); } Record();  Record(Value value);  Record(Value val1, Value val2);  Record(int numFields); int getNumFields(); void setNumFields(final int numFields); void makeSpace(int numFields); @SuppressWarnings("unchecked") T getField(final int fieldNum, final Class<T> type); @SuppressWarnings("unchecked") T getField(int fieldNum, T target); boolean getFieldInto(int fieldNum, Value target); boolean getFieldsInto(int[] positions, Value[] targets); void getFieldsIntoCheckingNull(int[] positions, Value[] targets); void setField(int fieldNum, Value value); void addField(Value value); void removeField(int fieldNum); final boolean isNull(int fieldNum); void setNull(int field); void setNull(long mask); void setNull(long[] mask); void clear(); void concatenate(Record record); void unionFields(Record other); void copyTo(Record target); @Override int getBinaryLength(); @Override Record copy(); @Override void copy(DataInputView source, DataOutputView target); Record createCopy(); void copyFrom(final Record source, final int[] sourcePositions, final int[] targetPositions); final boolean equalsFields(int[] positions, Value[] searchValues, Value[] deserializationHolders); void updateBinaryRepresenation(); @Override void write(DataOutputView out); @Override void read(DataInputView in); long serialize(DataOutputView target); void deserialize(DataInputView source);  }
@Test public void testRemoveField() { Record record = null; int oldLen = 0; record = new Record(this.origVal1, this.origVal2); record.addField(this.origVal3); record.removeField(1); assertTrue(record.getNumFields() == 2); StringValue recVal1 = record.getField(0, StringValue.class); IntValue recVal2 = record.getField(1, IntValue.class); assertTrue(recVal1.getValue().equals(this.origVal1.getValue())); assertTrue(recVal2.getValue() == this.origVal3.getValue()); record = this.generateFilledDenseRecord(100); oldLen = record.getNumFields(); record.removeField(0); assertTrue(record.getNumFields() == oldLen - 1); oldLen = record.getNumFields(); record.removeField(oldLen - 1); assertTrue(record.getNumFields() == oldLen - 1); record = this.generateFilledDenseRecord(100); for (int i = 0; i < 100; i++) { oldLen = record.getNumFields(); int pos = this.rand.nextInt(record.getNumFields()); record.removeField(pos); assertTrue(record.getNumFields() == oldLen - 1); } }