[
https://issues.apache.org/jira/browse/PHOENIX-900?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14323504#comment-14323504
]
ASF GitHub Bot commented on PHOENIX-900:
----------------------------------------
Github user JamesRTaylor commented on a diff in the pull request:
https://github.com/apache/phoenix/pull/37#discussion_r24785566
--- 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 --
Would be nice if the logic for combining column values set and statement
indexes were moved to a method on RowMutationState, like a join method. Also,
would it work to replace the for loop with the following:
existingRowMutationState.getColumnValues().putAll(newRow);
> Partial results for mutations
> -----------------------------
>
> Key: PHOENIX-900
> URL: https://issues.apache.org/jira/browse/PHOENIX-900
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 3.0.0, 4.0.0
> Reporter: Eli Levine
> Assignee: Eli Levine
> Attachments: PHOENIX-900.patch
>
>
> HBase provides a way to retrieve partial results of a batch operation:
> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTable.html#batch%28java.util.List,%20java.lang.Object[]%29
> Chatted with James about this offline:
> Yes, this could be included in the CommitException we throw
> (MutationState:412). We already include the batches that have been
> successfully committed to the HBase server in this exception. Would you be up
> for adding this additional information? You'd want to surface this in a
> Phoenix-y way in a method on CommitException, something like this: ResultSet
> getPartialCommits(). You can easily create an in memory ResultSet using
> MaterializedResultIterator plus the PhoenixResultSet constructor that accepts
> this (just create a new empty PhoenixStatement with the PhoenixConnection for
> the other arg).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)