private static int existingSize(Row row, ColumnDefinition column) { if (row == null) return 0; ComplexColumnData complexData = row.getComplexColumnData(column); return complexData == null ? 0 : complexData.cellsCount(); }
private static int existingSize(Row row, ColumnDefinition column) { if (row == null) return 0; ComplexColumnData complexData = row.getComplexColumnData(column); return complexData == null ? 0 : complexData.cellsCount(); }
private static Iterator<Cell> getCells(Row row, ColumnDefinition column) { // If we're asking for a complex cells, and we didn't got any row from our read, it's // the same as not having any cells for that column. if (row == null) return Collections.<Cell>emptyIterator(); ComplexColumnData complexData = row.getComplexColumnData(column); return complexData == null ? Collections.<Cell>emptyIterator() : complexData.iterator(); }
private static int existingSize(Row row, ColumnDefinition column) { if (row == null) return 0; ComplexColumnData complexData = row.getComplexColumnData(column); return complexData == null ? 0 : complexData.cellsCount(); }
private static Iterator<Cell> getCells(Row row, ColumnDefinition column) { // If we're asking for a complex cells, and we didn't got any row from our read, it's // the same as not having any cells for that column. if (row == null) return Collections.<Cell>emptyIterator(); ComplexColumnData complexData = row.getComplexColumnData(column); return complexData == null ? Collections.<Cell>emptyIterator() : complexData.iterator(); }
private static int existingSize(Row row, ColumnDefinition column) { if (row == null) return 0; ComplexColumnData complexData = row.getComplexColumnData(column); return complexData == null ? 0 : complexData.cellsCount(); }
private static Iterator<Cell> getCells(Row row, ColumnDefinition column) { // If we're asking for a complex cells, and we didn't got any row from our read, it's // the same as not having any cells for that column. if (row == null) return Collections.<Cell>emptyIterator(); ComplexColumnData complexData = row.getComplexColumnData(column); return complexData == null ? Collections.<Cell>emptyIterator() : complexData.iterator(); }
public boolean isStale(Row data, ByteBuffer indexValue, int nowInSec) { ColumnDefinition columnDef = indexedColumn; ComplexColumnData complexData = data.getComplexColumnData(columnDef); if (complexData == null) return true; for (Cell cell : complexData) { if (cell.isLive(nowInSec) && ((CollectionType) columnDef.type).valueComparator() .compare(indexValue, cell.value()) == 0) return false; } return true; } }
public boolean isStale(Row data, ByteBuffer indexValue, int nowInSec) { ColumnDefinition columnDef = indexedColumn; ComplexColumnData complexData = data.getComplexColumnData(columnDef); if (complexData == null) return true; for (Cell cell : complexData) { if (cell.isLive(nowInSec) && ((CollectionType) columnDef.type).valueComparator() .compare(indexValue, cell.value()) == 0) return false; } return true; } }
public boolean isStale(Row data, ByteBuffer indexValue, int nowInSec) { ColumnDefinition columnDef = indexedColumn; ComplexColumnData complexData = data.getComplexColumnData(columnDef); if (complexData == null) return true; for (Cell cell : complexData) { if (cell.isLive(nowInSec) && ((CollectionType) columnDef.type).valueComparator() .compare(indexValue, cell.value()) == 0) return false; } return true; } }
public void removeRow(Row row) { if (isPrimaryKeyIndex()) return; if (indexedColumn.isComplex()) removeCells(row.clustering(), row.getComplexColumnData(indexedColumn)); else removeCell(row.clustering(), row.getCell(indexedColumn)); }
public void removeRow(Row row) { if (isPrimaryKeyIndex()) return; if (indexedColumn.isComplex()) removeCells(row.clustering(), row.getComplexColumnData(indexedColumn)); else removeCell(row.clustering(), row.getCell(indexedColumn)); }
public void removeRow(Row row) { if (isPrimaryKeyIndex()) return; if (indexedColumn.isComplex()) removeCells(row.clustering(), row.getComplexColumnData(indexedColumn)); else removeCell(row.clustering(), row.getCell(indexedColumn)); }
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()); } }
private static void addValue(Selection.ResultSetBuilder result, ColumnDefinition def, Row row, int nowInSec, ProtocolVersion protocolVersion) { if (def.isComplex()) { assert def.type.isMultiCell(); ComplexColumnData complexData = row.getComplexColumnData(def); if (complexData == null) result.add(null); else if (def.type.isCollection()) result.add(((CollectionType) def.type).serializeForNativeProtocol(complexData.iterator(), protocolVersion)); else result.add(((UserType) def.type).serializeForNativeProtocol(complexData.iterator(), protocolVersion)); } else { result.add(row.getCell(def), nowInSec); } }
private static void addValue(Selection.ResultSetBuilder result, ColumnDefinition def, Row row, int nowInSec, ProtocolVersion protocolVersion) { if (def.isComplex()) { assert def.type.isMultiCell(); ComplexColumnData complexData = row.getComplexColumnData(def); if (complexData == null) result.add(null); else if (def.type.isCollection()) result.add(((CollectionType) def.type).serializeForNativeProtocol(complexData.iterator(), protocolVersion)); else result.add(((UserType) def.type).serializeForNativeProtocol(complexData.iterator(), protocolVersion)); } else { result.add(row.getCell(def), nowInSec); } }
public void insertRow(Row row) { if (row.isStatic() && !indexedColumn.isStatic() && !indexedColumn.isPartitionKey()) return; if (isPrimaryKeyIndex()) { indexPrimaryKey(row.clustering(), getPrimaryKeyIndexLiveness(row), row.deletion()); } else { if (indexedColumn.isComplex()) indexCells(row.clustering(), row.getComplexColumnData(indexedColumn)); else indexCell(row.clustering(), row.getCell(indexedColumn)); } }
public void insertRow(Row row) { if (row.isStatic() && !indexedColumn.isStatic() && !indexedColumn.isPartitionKey()) return; if (isPrimaryKeyIndex()) { indexPrimaryKey(row.clustering(), getPrimaryKeyIndexLiveness(row), row.deletion()); } else { if (indexedColumn.isComplex()) indexCells(row.clustering(), row.getComplexColumnData(indexedColumn)); else indexCell(row.clustering(), row.getCell(indexedColumn)); } }