PHOENIX-3727 Upserts into salted table are failing in Phoenix-Calcite
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/66a152a9 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/66a152a9 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/66a152a9 Branch: refs/heads/calcite Commit: 66a152a94d94aeb1c13f5e0baab413d6d9577d3a Parents: a661ea5 Author: Samarth <[email protected]> Authored: Thu Mar 9 11:02:04 2017 -0800 Committer: Samarth <[email protected]> Committed: Thu Mar 9 11:02:04 2017 -0800 ---------------------------------------------------------------------- .../main/java/org/apache/phoenix/compile/UpsertCompiler.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/66a152a9/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index 260e591..2304d83 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java @@ -129,7 +129,7 @@ public class UpsertCompiler { pkValues[0] = new byte[] {0}; } for(int i = 0; i < numSplColumns; i++) { - pkValues[i] = values[i]; + pkValues[i + (table.getBucketNum() != null ? 1 : 0)] = values[i]; } Long rowTimestamp = null; // case when the table doesn't have a row timestamp column RowTimestampColInfo rowTsColInfo = new RowTimestampColInfo(useServerTimestamp, rowTimestamp); @@ -191,10 +191,6 @@ public class UpsertCompiler { if(tableRef.getTable().getViewIndexId() != null) { values[i++] = PSmallint.INSTANCE.toBytes(tableRef.getTable().getViewIndexId()); } - - for(int k = 0; k < pkSlotIndexes.length; k++) { - pkSlotIndexes[k] += (i + (tableRef.getTable().getBucketNum() != null ? 1 : 0)); - } } int rowCount = 0; Map<ImmutableBytesPtr, RowMutationState> mutation = Maps.newHashMapWithExpectedSize(batchSize);
