You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by an...@apache.org on 2017/05/05 06:16:55 UTC
phoenix git commit: PHOENIX-3800 NPE when doing UPSERT SELECT into
salted tables(Eiichi Sato)
Repository: phoenix
Updated Branches:
refs/heads/4.10-HBase-0.98 e084c85da -> 62978fca9
PHOENIX-3800 NPE when doing UPSERT SELECT into salted tables(Eiichi Sato)
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/62978fca
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/62978fca
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/62978fca
Branch: refs/heads/4.10-HBase-0.98
Commit: 62978fca90a1a90da54b4d7a70e96819348c4782
Parents: e084c85
Author: Ankit Singhal <an...@gmail.com>
Authored: Fri May 5 11:46:28 2017 +0530
Committer: Ankit Singhal <an...@gmail.com>
Committed: Fri May 5 11:46:28 2017 +0530
----------------------------------------------------------------------
.../apache/phoenix/end2end/UpsertSelectIT.java | 21 +++++++++++++++-----
.../apache/phoenix/compile/UpsertCompiler.java | 2 +-
2 files changed, 17 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/62978fca/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
index d36e0fe..1ccf050 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
@@ -78,20 +78,31 @@ public class UpsertSelectIT extends BaseClientManagedTimeIT {
@Test
public void testUpsertSelectWithNoIndex() throws Exception {
- testUpsertSelect(false);
+ testUpsertSelect(false, false);
}
@Test
public void testUpsertSelecWithIndex() throws Exception {
- testUpsertSelect(true);
+ testUpsertSelect(true, false);
}
- private void testUpsertSelect(boolean createIndex) throws Exception {
+ @Test
+ public void testUpsertSelecWithIndexWithSalt() throws Exception {
+ testUpsertSelect(true, true);
+ }
+
+ @Test
+ public void testUpsertSelecWithNoIndexWithSalt() throws Exception {
+ testUpsertSelect(false, true);
+ }
+
+ private void testUpsertSelect(boolean createIndex, boolean saltTable) throws Exception {
long ts = nextTimestamp();
String tenantId = getOrganizationId();
- initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), null, ts-1, getUrl(), null);
+ byte[][] splits = getDefaultSplits(tenantId);
+ initATableValues(ATABLE_NAME, tenantId, saltTable ? null : splits, null, ts-1, getUrl(), saltTable ? "salt_buckets = 2" : null);
- ensureTableCreated(getUrl(), CUSTOM_ENTITY_DATA_FULL_NAME, CUSTOM_ENTITY_DATA_FULL_NAME, ts-1);
+ ensureTableCreated(getUrl(), CUSTOM_ENTITY_DATA_FULL_NAME, CUSTOM_ENTITY_DATA_FULL_NAME, null, ts-1, saltTable ? "salt_buckets = 2" : null);
String indexName = "IDX1";
if (createIndex) {
Properties props = new Properties();
http://git-wip-us.apache.org/repos/asf/phoenix/blob/62978fca/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 2304d83..5559ad7 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
@@ -677,7 +677,7 @@ public class UpsertCompiler {
for (int i = 0 ; i < projectedExpressions.size(); i++) {
// Must make new column if position has changed
PColumn column = allColumns.get(allColumnsIndexes[i]);
- projectedColumns.add(column.getPosition() == i + posOff ? column : new PColumnImpl(column, i));
+ projectedColumns.add(column.getPosition() == i + posOff ? column : new PColumnImpl(column, i + posOff));
}
// Build table from projectedColumns
// Hack to add default column family to be used on server in case no value column is projected.