Github user elilevine commented on a diff in the pull request:
https://github.com/apache/phoenix/pull/37#discussion_r24843102
--- Diff:
phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java ---
@@ -134,29 +135,31 @@ public void join(MutationState newMutation) {
}
this.sizeOffset += newMutation.sizeOffset;
// Merge newMutation with this one, keeping state from newMutation
for any overlaps
- for (Map.Entry<TableRef,
Map<ImmutableBytesPtr,Map<PColumn,byte[]>>> entry :
newMutation.mutations.entrySet()) {
+ for (Map.Entry<TableRef, Map<ImmutableBytesPtr,RowMutationState>>
entry : newMutation.mutations.entrySet()) {
// Replace existing entries for the table with new entries
TableRef tableRef = entry.getKey();
PTable table = tableRef.getTable();
boolean isIndex = table.getType() == PTableType.INDEX;
- Map<ImmutableBytesPtr,Map<PColumn,byte[]>> existingRows =
this.mutations.put(tableRef, entry.getValue());
+ Map<ImmutableBytesPtr,RowMutationState> existingRows =
this.mutations.put(tableRef, entry.getValue());
if (existingRows != null) { // Rows for that table already
exist
// Loop through new rows and replace existing with new
- for (Map.Entry<ImmutableBytesPtr,Map<PColumn,byte[]>>
rowEntry : entry.getValue().entrySet()) {
+ for (Map.Entry<ImmutableBytesPtr,RowMutationState>
rowEntry : entry.getValue().entrySet()) {
// Replace existing row with new row
- Map<PColumn,byte[]> existingValues =
existingRows.put(rowEntry.getKey(), rowEntry.getValue());
- if (existingValues != null) {
+ RowMutationState existingRowMutationState =
existingRows.put(rowEntry.getKey(), rowEntry.getValue());
+ if (existingRowMutationState != null) {
+ Map<PColumn,byte[]> existingValues =
existingRowMutationState.getColumnValues();
if (existingValues != PRow.DELETE_MARKER) {
- Map<PColumn,byte[]> newRow =
rowEntry.getValue();
+ Map<PColumn,byte[]> newRow =
rowEntry.getValue().getColumnValues();
// if new row is PRow.DELETE_MARKER, it means
delete, and we don't need to merge it with existing row.
if (newRow != PRow.DELETE_MARKER) {
// Replace existing column values with new
column values
for (Map.Entry<PColumn,byte[]> valueEntry
: newRow.entrySet()) {
-
existingValues.put(valueEntry.getKey(), valueEntry.getValue());
+
existingRowMutationState.getColumnValues().put(valueEntry.getKey(),
valueEntry.getValue());
}
+
existingRowMutationState.getOrderOfStatementsInConnection().addAll(rowEntry.getValue().getOrderOfStatementsInConnection());
--- End diff --
Good call.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---