public void execute(DecoratedKey partitionKey, UpdateParameters params) throws InvalidRequestException { assert column.type.isMultiCell() : "Attempted to delete an item by index from a frozen list"; Term.Terminal index = t.bind(params.options); if (index == null) throw new InvalidRequestException("Invalid null value for list index"); if (index == Constants.UNSET_VALUE) return; Row existingRow = params.getPrefetchedRow(partitionKey, params.currentClustering()); int existingSize = existingSize(existingRow, column); int idx = ByteBufferUtil.toInt(index.get(params.options.getProtocolVersion())); if (existingSize == 0) throw new InvalidRequestException("Attempted to delete an element from a list which is null"); if (idx < 0 || idx >= existingSize) throw new InvalidRequestException(String.format("List index %d out of bound, list has size %d", idx, existingSize)); params.addTombstone(column, existingRow.getComplexColumnData(column).getCellByIndex(idx).path()); } }
public void execute(DecoratedKey partitionKey, UpdateParameters params) throws InvalidRequestException { assert column.type.isMultiCell() : "Attempted to delete an item by index from a frozen list"; Term.Terminal index = t.bind(params.options); if (index == null) throw new InvalidRequestException("Invalid null value for list index"); if (index == Constants.UNSET_VALUE) return; Row existingRow = params.getPrefetchedRow(partitionKey, params.currentClustering()); int existingSize = existingSize(existingRow, column); int idx = ByteBufferUtil.toInt(index.get(params.options.getProtocolVersion())); if (existingSize == 0) throw new InvalidRequestException("Attempted to delete an element from a list which is null"); if (idx < 0 || idx >= existingSize) throw new InvalidRequestException(String.format("List index %d out of bound, list has size %d", idx, existingSize)); params.addTombstone(column, existingRow.getComplexColumnData(column).getCellByIndex(idx).path()); } }
public void execute(DecoratedKey partitionKey, UpdateParameters params) throws InvalidRequestException { assert column.type.isMultiCell() : "Attempted to delete an item by index from a frozen list"; Term.Terminal index = t.bind(params.options); if (index == null) throw new InvalidRequestException("Invalid null value for list index"); if (index == Constants.UNSET_VALUE) return; Row existingRow = params.getPrefetchedRow(partitionKey, params.currentClustering()); int existingSize = existingSize(existingRow, column); int idx = ByteBufferUtil.toInt(index.get(params.options.getProtocolVersion())); if (existingSize == 0) throw new InvalidRequestException("Attempted to delete an element from a list which is null"); if (idx < 0 || idx >= existingSize) throw new InvalidRequestException(String.format("List index %d out of bound, list has size %d", idx, existingSize)); params.addTombstone(column, existingRow.getComplexColumnData(column).getCellByIndex(idx).path()); } }
public void execute(DecoratedKey partitionKey, UpdateParameters params) throws InvalidRequestException { assert column.type.isMultiCell() : "Attempted to delete an item by index from a frozen list"; Term.Terminal index = t.bind(params.options); if (index == null) throw new InvalidRequestException("Invalid null value for list index"); if (index == Constants.UNSET_VALUE) return; Row existingRow = params.getPrefetchedRow(partitionKey, params.currentClustering()); int existingSize = existingSize(existingRow, column); int idx = ByteBufferUtil.toInt(index.get(params.options.getProtocolVersion())); if (existingSize == 0) throw new InvalidRequestException("Attempted to delete an element from a list which is null"); if (idx < 0 || idx >= existingSize) throw new InvalidRequestException(String.format("List index %d out of bound, list has size %d", idx, existingSize)); params.addTombstone(column, existingRow.getComplexColumnData(column).getCellByIndex(idx).path()); } }
public void execute(DecoratedKey partitionKey, UpdateParameters params) throws InvalidRequestException { // we should not get here for frozen lists assert column.type.isMultiCell() : "Attempted to set an individual element on a frozen list"; ByteBuffer index = idx.bindAndGet(params.options); ByteBuffer value = t.bindAndGet(params.options); if (index == null) throw new InvalidRequestException("Invalid null value for list index"); if (index == ByteBufferUtil.UNSET_BYTE_BUFFER) throw new InvalidRequestException("Invalid unset value for list index"); Row existingRow = params.getPrefetchedRow(partitionKey, params.currentClustering()); int existingSize = existingSize(existingRow, column); int idx = ByteBufferUtil.toInt(index); if (existingSize == 0) throw new InvalidRequestException("Attempted to set an element on a list which is null"); if (idx < 0 || idx >= existingSize) throw new InvalidRequestException(String.format("List index %d out of bound, list has size %d", idx, existingSize)); CellPath elementPath = existingRow.getComplexColumnData(column).getCellByIndex(idx).path(); if (value == null) params.addTombstone(column, elementPath); else if (value != ByteBufferUtil.UNSET_BYTE_BUFFER) params.addCell(column, elementPath, value); } }
public void execute(DecoratedKey partitionKey, UpdateParameters params) throws InvalidRequestException { // we should not get here for frozen lists assert column.type.isMultiCell() : "Attempted to set an individual element on a frozen list"; ByteBuffer index = idx.bindAndGet(params.options); ByteBuffer value = t.bindAndGet(params.options); if (index == null) throw new InvalidRequestException("Invalid null value for list index"); if (index == ByteBufferUtil.UNSET_BYTE_BUFFER) throw new InvalidRequestException("Invalid unset value for list index"); Row existingRow = params.getPrefetchedRow(partitionKey, params.currentClustering()); int existingSize = existingSize(existingRow, column); int idx = ByteBufferUtil.toInt(index); if (existingSize == 0) throw new InvalidRequestException("Attempted to set an element on a list which is null"); if (idx < 0 || idx >= existingSize) throw new InvalidRequestException(String.format("List index %d out of bound, list has size %d", idx, existingSize)); CellPath elementPath = existingRow.getComplexColumnData(column).getCellByIndex(idx).path(); if (value == null) params.addTombstone(column, elementPath); else if (value != ByteBufferUtil.UNSET_BYTE_BUFFER) params.addCell(column, elementPath, value); } }
public void execute(DecoratedKey partitionKey, UpdateParameters params) throws InvalidRequestException { // we should not get here for frozen lists assert column.type.isMultiCell() : "Attempted to set an individual element on a frozen list"; ByteBuffer index = idx.bindAndGet(params.options); ByteBuffer value = t.bindAndGet(params.options); if (index == null) throw new InvalidRequestException("Invalid null value for list index"); if (index == ByteBufferUtil.UNSET_BYTE_BUFFER) throw new InvalidRequestException("Invalid unset value for list index"); Row existingRow = params.getPrefetchedRow(partitionKey, params.currentClustering()); int existingSize = existingSize(existingRow, column); int idx = ByteBufferUtil.toInt(index); if (existingSize == 0) throw new InvalidRequestException("Attempted to set an element on a list which is null"); if (idx < 0 || idx >= existingSize) throw new InvalidRequestException(String.format("List index %d out of bound, list has size %d", idx, existingSize)); CellPath elementPath = existingRow.getComplexColumnData(column).getCellByIndex(idx).path(); if (value == null) params.addTombstone(column, elementPath); else if (value != ByteBufferUtil.UNSET_BYTE_BUFFER) params.addCell(column, elementPath, value); } }
public void execute(DecoratedKey partitionKey, UpdateParameters params) throws InvalidRequestException { // we should not get here for frozen lists assert column.type.isMultiCell() : "Attempted to set an individual element on a frozen list"; ByteBuffer index = idx.bindAndGet(params.options); ByteBuffer value = t.bindAndGet(params.options); if (index == null) throw new InvalidRequestException("Invalid null value for list index"); if (index == ByteBufferUtil.UNSET_BYTE_BUFFER) throw new InvalidRequestException("Invalid unset value for list index"); Row existingRow = params.getPrefetchedRow(partitionKey, params.currentClustering()); int existingSize = existingSize(existingRow, column); int idx = ByteBufferUtil.toInt(index); if (existingSize == 0) throw new InvalidRequestException("Attempted to set an element on a list which is null"); if (idx < 0 || idx >= existingSize) throw new InvalidRequestException(String.format("List index %d out of bound, list has size %d", idx, existingSize)); CellPath elementPath = existingRow.getComplexColumnData(column).getCellByIndex(idx).path(); if (value == null) params.addTombstone(column, elementPath); else if (value != ByteBufferUtil.UNSET_BYTE_BUFFER) params.addCell(column, elementPath, value); } }