ColumnStore implements ColumnIterable { public void removeColumn(final Column column) { checkNonNullColumnObject(column); lock(); graphWriteLock(); try { final ColumnImpl columnImpl = (ColumnImpl) column; if (graphStore != null && columnImpl.table != null) { if (AttributeUtils.isNodeColumn(columnImpl)) { for (Node n : graphStore.nodeStore) { Object[] attributes = ((NodeImpl) n).attributes; if (attributes.length > columnImpl.getIndex()) { attributes[columnImpl.getIndex()] = null; } } } else { for (Edge e : graphStore.edgeStore) { Object[] attributes = ((EdgeImpl) e).attributes; if (attributes.length > columnImpl.getIndex()) { attributes[columnImpl.getIndex()] = null; } } } } short id = idMap.removeShort(column.getId()); if (id == NULL_SHORT) { throw new IllegalArgumentException("The column doesnt exist"); } garbageQueue.add(id); int intId = shortToInt(id); columns[intId] = null; if (indexStore != null) { indexStore.removeColumn((ColumnImpl) column); } columnImpl.setStoreId(NULL_ID); updateConfiguration(column); } finally { graphWriteUnlock(); unlock(); } } ColumnStore(Class<T> elementType, boolean indexed);  ColumnStore(GraphStore graphStore, Class<T> elementType, boolean indexed); void addColumn(final Column column); void removeColumn(final Column column); void removeColumn(final String key); int getColumnIndex(final String key); Column getColumnByIndex(final int index); Column getColumn(final String key); boolean hasColumn(String key); @Override Iterator<Column> iterator(); @Override ColumnImpl[] toArray(); @Override List<Column> toList(); @Override void doBreak(); Set<String> getColumnKeys(); void clear(); int size(); boolean deepEquals(ColumnStore<T> obj); int deepHashCode();  }
@Test public void testRemoveColumn() { ColumnStore<Node> store = new ColumnStore(Node.class, false); ColumnImpl col = new ColumnImpl("0", Integer.class, null, null, Origin.DATA, false, false); store.addColumn(col); store.removeColumn(col); Assert.assertFalse(store.hasColumn("0")); Assert.assertEquals(store.size(), 0); Assert.assertEquals(col.getIndex(), ColumnStore.NULL_ID); }
@Test(expectedExceptions = NullPointerException.class) public void testRemoveColumnNull() { ColumnStore<Node> store = new ColumnStore(Node.class, false); store.removeColumn((Column) null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testRemoveColumnNotExist() { ColumnStore<Node> store = new ColumnStore(Node.class, false); ColumnImpl col = new ColumnImpl("0", Integer.class, null, null, Origin.DATA, false, false); store.removeColumn(col); }