mutations.put(rowKeyPtr, new RowMutationState(PRow.DELETE_MARKER, 0, statement.getConnection().getStatementExecutionCounter(), NULL_ROWTIMESTAMP_INFO, null)); otherRowKeyPtr.set(maintainers[i].buildRowKey(getter, rowKeyPtr, null, null, HConstants.LATEST_TIMESTAMP)); otherMutations.get(i).put(otherRowKeyPtr, new RowMutationState(PRow.DELETE_MARKER, 0, statement.getConnection().getStatementExecutionCounter(), NULL_ROWTIMESTAMP_INFO, null));
Map<PColumn, byte[]> existingValues = existingRowMutationState.getColumnValues(); if (existingValues != PRow.DELETE_MARKER) { Map<PColumn, byte[]> newRow = rowEntry.getValue().getColumnValues(); estimatedSize -= existingRowMutationState.calculateEstimatedSize(); existingRowMutationState.join(rowEntry.getValue()); estimatedSize += existingRowMutationState.calculateEstimatedSize(); numRows++; estimatedSize += rowEntry.getValue().calculateEstimatedSize();
while (iterator.hasNext()) { Map.Entry<ImmutableBytesPtr, RowMutationState> rowEntry = iterator.next(); byte[] onDupKeyBytes = rowEntry.getValue().getOnDupKeyBytes(); boolean hasOnDupKey = onDupKeyBytes != null; ImmutableBytesPtr key = rowEntry.getKey(); RowMutationState state = rowEntry.getValue(); if (tableWithRowTimestampCol) { RowTimestampColInfo rowTsColInfo = state.getRowTimestampColInfo(); if (rowTsColInfo.useServerTimestamp()) { if (rowEntry.getValue().getColumnValues() == PRow.DELETE_MARKER) { // means delete row.delete(); rowMutations = row.toRowMutations(); for (Map.Entry<PColumn, byte[]> valueEntry : rowEntry.getValue().getColumnValues().entrySet()) { row.setValue(valueEntry.getKey(), valueEntry.getValue());
mutations.put(rowKeyPtr, new RowMutationState(PRow.DELETE_MARKER, 0, statement.getConnection().getStatementExecutionCounter(), NULL_ROWTIMESTAMP_INFO, null)); otherRowKeyPtr.set(maintainers[i].buildRowKey(getter, rowKeyPtr, null, null, HConstants.LATEST_TIMESTAMP)); otherMutations.get(i).put(otherRowKeyPtr, new RowMutationState(PRow.DELETE_MARKER, 0, statement.getConnection().getStatementExecutionCounter(), NULL_ROWTIMESTAMP_INFO, null));
mutations.put(rowKeyPtr, new RowMutationState(PRow.DELETE_MARKER, 0, statement.getConnection().getStatementExecutionCounter(), NULL_ROWTIMESTAMP_INFO, null)); otherRowKeyPtr.set(maintainers[i].buildRowKey(getter, rowKeyPtr, null, null, HConstants.LATEST_TIMESTAMP)); otherMutations.get(i).put(otherRowKeyPtr, new RowMutationState(PRow.DELETE_MARKER, 0, statement.getConnection().getStatementExecutionCounter(), NULL_ROWTIMESTAMP_INFO, null));
mutation.put(ptr, new RowMutationState(columnValues, columnValueSize, statement.getConnection().getStatementExecutionCounter(), rowTsColInfo, onDupKeyBytes));
while (iterator.hasNext()) { Map.Entry<ImmutableBytesPtr, RowMutationState> rowEntry = iterator.next(); byte[] onDupKeyBytes = rowEntry.getValue().getOnDupKeyBytes(); boolean hasOnDupKey = onDupKeyBytes != null; ImmutableBytesPtr key = rowEntry.getKey(); RowMutationState state = rowEntry.getValue(); if (tableWithRowTimestampCol) { RowTimestampColInfo rowTsColInfo = state.getRowTimestampColInfo(); if (rowTsColInfo.useServerTimestamp()) { if (rowEntry.getValue().getColumnValues() == PRow.DELETE_MARKER) { // means delete row.delete(); rowMutations = row.toRowMutations(); for (Map.Entry<PColumn, byte[]> valueEntry : rowEntry.getValue().getColumnValues().entrySet()) { row.setValue(valueEntry.getKey(), valueEntry.getValue());
RowMutationState valueEntry = rowEntry.getValue(); if (valueEntry != null) { Map<PColumn, byte[]> colValues = valueEntry.getColumnValues(); if (colValues != PRow.DELETE_MARKER) { for (PColumn column : colValues.keySet()) {
RowMutationState valueEntry = rowEntry.getValue(); if (valueEntry != null) { Map<PColumn, byte[]> colValues = valueEntry.getColumnValues(); if (colValues != PRow.DELETE_MARKER) { for (PColumn column : colValues.keySet()) {
Map<PColumn, byte[]> existingValues = existingRowMutationState.getColumnValues(); if (existingValues != PRow.DELETE_MARKER) { Map<PColumn, byte[]> newRow = rowEntry.getValue().getColumnValues(); estimatedSize -= existingRowMutationState.calculateEstimatedSize(); existingRowMutationState.join(rowEntry.getValue()); estimatedSize += existingRowMutationState.calculateEstimatedSize(); numRows++; estimatedSize += rowEntry.getValue().calculateEstimatedSize();
while (iterator.hasNext()) { Map.Entry<ImmutableBytesPtr, RowMutationState> rowEntry = iterator.next(); byte[] onDupKeyBytes = rowEntry.getValue().getOnDupKeyBytes(); boolean hasOnDupKey = onDupKeyBytes != null; ImmutableBytesPtr key = rowEntry.getKey(); RowMutationState state = rowEntry.getValue(); if (tableWithRowTimestampCol) { RowTimestampColInfo rowTsColInfo = state.getRowTimestampColInfo(); if (rowTsColInfo.useServerTimestamp()) { if (rowEntry.getValue().getColumnValues() == PRow.DELETE_MARKER) { // means delete row.delete(); rowMutations = row.toRowMutations(); for (Map.Entry<PColumn, byte[]> valueEntry : rowEntry.getValue().getColumnValues().entrySet()) { row.setValue(valueEntry.getKey(), valueEntry.getValue());
mutation.put(ptr, new RowMutationState(columnValues, columnValueSize, statement.getConnection().getStatementExecutionCounter(), rowTsColInfo, onDupKeyBytes));
Map<PColumn, byte[]> existingValues = existingRowMutationState.getColumnValues(); if (existingValues != PRow.DELETE_MARKER) { Map<PColumn, byte[]> newRow = rowEntry.getValue().getColumnValues(); estimatedSize -= existingRowMutationState.calculateEstimatedSize(); existingRowMutationState.join(rowEntry.getValue()); estimatedSize += existingRowMutationState.calculateEstimatedSize(); numRows++; estimatedSize += rowEntry.getValue().calculateEstimatedSize();
void join(RowMutationState newRow) { // If we already have a row and the new row has an ON DUPLICATE KEY clause // ignore the new values (as that's what the server will do). if (newRow.onDupKeyBytes == null) { // increment the column value size by the new row column value size colValuesSize += newRow.colValuesSize; for (Map.Entry<PColumn, byte[]> entry : newRow.columnValues.entrySet()) { PColumn col = entry.getKey(); byte[] oldValue = columnValues.put(col, entry.getValue()); if (oldValue != null) { // decrement column value size by the size of all column values that were replaced colValuesSize -= (col.getEstimatedSize() + oldValue.length); } } } // Concatenate ON DUPLICATE KEY bytes to allow multiple // increments of the same row in the same commit batch. this.onDupKeyBytes = PhoenixIndexBuilder.combineOnDupKey(this.onDupKeyBytes, newRow.onDupKeyBytes); statementIndexes = joinSortedIntArrays(statementIndexes, newRow.getStatementIndexes()); }
void join(RowMutationState newRow) { // If we already have a row and the new row has an ON DUPLICATE KEY clause // ignore the new values (as that's what the server will do). if (newRow.onDupKeyBytes == null) { // increment the column value size by the new row column value size colValuesSize += newRow.colValuesSize; for (Map.Entry<PColumn, byte[]> entry : newRow.columnValues.entrySet()) { PColumn col = entry.getKey(); byte[] oldValue = columnValues.put(col, entry.getValue()); if (oldValue != null) { // decrement column value size by the size of all column values that were replaced colValuesSize -= (col.getEstimatedSize() + oldValue.length); } } } // Concatenate ON DUPLICATE KEY bytes to allow multiple // increments of the same row in the same commit batch. this.onDupKeyBytes = PhoenixIndexBuilder.combineOnDupKey(this.onDupKeyBytes, newRow.onDupKeyBytes); statementIndexes = joinSortedIntArrays(statementIndexes, newRow.getStatementIndexes()); }
@Override public MutationState execute() throws SQLException { // We have a point lookup, so we know we have a simple set of fully qualified // keys for our ranges ScanRanges ranges = context.getScanRanges(); Iterator<KeyRange> iterator = ranges.getPointLookupKeyIterator(); MultiRowMutationState mutation = new MultiRowMutationState(ranges.getPointLookupCount()); while (iterator.hasNext()) { mutation.put(new ImmutableBytesPtr(iterator.next().getLowerRange()), new RowMutationState(PRow.DELETE_MARKER, 0, statement.getConnection().getStatementExecutionCounter(), NULL_ROWTIMESTAMP_INFO, null)); } return new MutationState(dataPlan.getTableRef(), mutation, 0, maxSize, maxSizeBytes, connection); }
@Override public MutationState execute() throws SQLException { // We have a point lookup, so we know we have a simple set of fully qualified // keys for our ranges ScanRanges ranges = context.getScanRanges(); Iterator<KeyRange> iterator = ranges.getPointLookupKeyIterator(); MultiRowMutationState mutation = new MultiRowMutationState(ranges.getPointLookupCount()); while (iterator.hasNext()) { mutation.put(new ImmutableBytesPtr(iterator.next().getLowerRange()), new RowMutationState(PRow.DELETE_MARKER, 0, statement.getConnection().getStatementExecutionCounter(), NULL_ROWTIMESTAMP_INFO, null)); } return new MutationState(dataPlan.getTableRef(), mutation, 0, maxSize, maxSizeBytes, connection); }
public RowMutationState put(ImmutableBytesPtr ptr, RowMutationState rowMutationState) { estimatedSize += rowMutationState.calculateEstimatedSize(); return rowKeyToRowMutationState.put(ptr, rowMutationState); }
private static long calculateRowMutationSize(Entry<ImmutableBytesPtr, RowMutationState> rowEntry) { int rowLength = rowEntry.getKey().getLength(); long colValuesLength = rowEntry.getValue().calculateEstimatedSize(); return (rowLength + colValuesLength); }
private static long calculateRowMutationSize(Entry<ImmutableBytesPtr, RowMutationState> rowEntry) { int rowLength = rowEntry.getKey().getLength(); long colValuesLength = rowEntry.getValue().calculateEstimatedSize(); return (rowLength + colValuesLength); }